-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: cloudfront: IllegalUpdate You cannot update Origin or CallerReference #33338
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Hey @cgrenzel 👋 Thank you for taking the time to raise this! Can you supply a sample Terraform configuration that can be used to reproduce this, and debug logs (redacted as needed)? |
Hello! I'm having the same issue here, and I've attached a sample Terraform configuration: Steps to use that:
Also attached is what I think is the relevant part of terraform's log: terraform-33338.log Thanks! |
@uduncanu Super helpful! Thank you |
This functionality has been released in v5.19.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Terraform Core Version
1.5.6
AWS Provider Version
5.15.0
Affected Resource(s)
Resources:
When deployed by terraform in 2 steps:
aws_cloudfront_distribution
withstaging
set to false; oneaws_cloudfront_distribution
withstaging
true; oneaws_cloudfront_continuous_deployment_policy
referencing the staging distribution in thestaging_distribution_dns_names
.continuous_deployment_policy_id
on the main distribution.Trying to apply changes using terraform to the staging distribution will fail with the message "An error occurred (IllegalUpdate) when calling the UpdateDistribution operation: You cannot update Origin or CallerReference."
The same change works on the main distribution.
Also the same change works for the staging distribution if done outside terraform (CLI, Console).
The change mentioned is a different
path_pattern
of anordered_cache_behaviour
already deployed.Expected Behavior
The update to be successful for both CloudFront Distributions.
Actual Behavior
The update fails for the Staging Distribution only.
Relevant Error/Panic Output Snippet
"An error occurred (IllegalUpdate) when calling the UpdateDistribution operation: You cannot update Origin or CallerReference."
Terraform Configuration Files
Steps to Reproduce
Resources:
Deployed by terraform in 2 steps:
aws_cloudfront_distribution
withstaging
set to false; oneaws_cloudfront_distribution
withstaging
true; oneaws_cloudfront_continuous_deployment_policy
referencing the staging distribution in thestaging_distribution_dns_names
.continuous_deployment_policy_id
on the main distribution.Do any changes on the staging Distribution.
Debug Output
No response
Panic Output
No response
Important Factoids
Through AWS CloudTrail investigation was noticed that the request from Terraform that fails is
UpdateDistribution
[1].The request doesn't include the variable
continuousDeploymentPolicyId
.This variable is not present on the Terraform State for the staging CloudFront Distribution resource.
After hardcoding the Policy ID on the staging distribution and applying, this variable is set on the Terraform State and updates work.
Referencing
aws_cloudfront_continuous_deployment_policy
on code throws circular reference error, so hardcoding was the way to test it.Also the example from the documentation on the
aws_cloudfront_continuous_deployment_policy
resource doesn't setcontinuous_deployment_policy_id
on the staging Distribution. [2].References
[1] https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_UpdateDistribution.html
[2] https://registry.terraform.io/providers/hashicorp/aws/5.15.0/docs/resources/cloudfront_continuous_deployment_policy
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: