-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
[New Resource]: aws_cloudfront_continuous_deployment_policy
#32936
Conversation
Community NoteVoting for Prioritization
For Submitters
|
a983fc0
to
acbc072
Compare
acbc072
to
aae2c8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀.
% make testacc TESTARGS='-run=TestAccCloudFrontContinuousDeploymentPolicy_\|TestAccCloudFrontDistribution_' PKG=cloudfront ACCTEST_PARALLELISM=4
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/cloudfront/... -v -count 1 -parallel 4 -run=TestAccCloudFrontContinuousDeploymentPolicy_\|TestAccCloudFrontDistribution_ -timeout 180m
=== RUN TestAccCloudFrontContinuousDeploymentPolicy_basic
=== PAUSE TestAccCloudFrontContinuousDeploymentPolicy_basic
=== RUN TestAccCloudFrontContinuousDeploymentPolicy_disappears
=== PAUSE TestAccCloudFrontContinuousDeploymentPolicy_disappears
=== RUN TestAccCloudFrontContinuousDeploymentPolicy_trafficConfig
=== PAUSE TestAccCloudFrontContinuousDeploymentPolicy_trafficConfig
=== RUN TestAccCloudFrontDistribution_basic
=== PAUSE TestAccCloudFrontDistribution_basic
=== RUN TestAccCloudFrontDistribution_disappears
=== PAUSE TestAccCloudFrontDistribution_disappears
=== RUN TestAccCloudFrontDistribution_tags
=== PAUSE TestAccCloudFrontDistribution_tags
=== RUN TestAccCloudFrontDistribution_s3Origin
=== PAUSE TestAccCloudFrontDistribution_s3Origin
=== RUN TestAccCloudFrontDistribution_customOrigin
=== PAUSE TestAccCloudFrontDistribution_customOrigin
=== RUN TestAccCloudFrontDistribution_originPolicyDefault
=== PAUSE TestAccCloudFrontDistribution_originPolicyDefault
=== RUN TestAccCloudFrontDistribution_originPolicyOrdered
=== PAUSE TestAccCloudFrontDistribution_originPolicyOrdered
=== RUN TestAccCloudFrontDistribution_multiOrigin
=== PAUSE TestAccCloudFrontDistribution_multiOrigin
=== RUN TestAccCloudFrontDistribution_orderedCacheBehavior
=== PAUSE TestAccCloudFrontDistribution_orderedCacheBehavior
=== RUN TestAccCloudFrontDistribution_orderedCacheBehaviorCachePolicy
=== PAUSE TestAccCloudFrontDistribution_orderedCacheBehaviorCachePolicy
=== RUN TestAccCloudFrontDistribution_orderedCacheBehaviorResponseHeadersPolicy
=== PAUSE TestAccCloudFrontDistribution_orderedCacheBehaviorResponseHeadersPolicy
=== RUN TestAccCloudFrontDistribution_forwardedValuesToCachePolicy
=== PAUSE TestAccCloudFrontDistribution_forwardedValuesToCachePolicy
=== RUN TestAccCloudFrontDistribution_Origin_emptyDomainName
=== PAUSE TestAccCloudFrontDistribution_Origin_emptyDomainName
=== RUN TestAccCloudFrontDistribution_Origin_emptyOriginID
=== PAUSE TestAccCloudFrontDistribution_Origin_emptyOriginID
=== RUN TestAccCloudFrontDistribution_Origin_connectionAttempts
=== PAUSE TestAccCloudFrontDistribution_Origin_connectionAttempts
=== RUN TestAccCloudFrontDistribution_Origin_connectionTimeout
=== PAUSE TestAccCloudFrontDistribution_Origin_connectionTimeout
=== RUN TestAccCloudFrontDistribution_Origin_originShield
=== PAUSE TestAccCloudFrontDistribution_Origin_originShield
=== RUN TestAccCloudFrontDistribution_Origin_originAccessControl
=== PAUSE TestAccCloudFrontDistribution_Origin_originAccessControl
=== RUN TestAccCloudFrontDistribution_noOptionalItems
=== PAUSE TestAccCloudFrontDistribution_noOptionalItems
=== RUN TestAccCloudFrontDistribution_http11
=== PAUSE TestAccCloudFrontDistribution_http11
=== RUN TestAccCloudFrontDistribution_isIPV6Enabled
=== PAUSE TestAccCloudFrontDistribution_isIPV6Enabled
=== RUN TestAccCloudFrontDistribution_noCustomErrorResponse
=== PAUSE TestAccCloudFrontDistribution_noCustomErrorResponse
=== RUN TestAccCloudFrontDistribution_DefaultCacheBehaviorForwardedValuesCookies_whitelistedNames
=== PAUSE TestAccCloudFrontDistribution_DefaultCacheBehaviorForwardedValuesCookies_whitelistedNames
=== RUN TestAccCloudFrontDistribution_DefaultCacheBehaviorForwardedValues_headers
=== PAUSE TestAccCloudFrontDistribution_DefaultCacheBehaviorForwardedValues_headers
=== RUN TestAccCloudFrontDistribution_DefaultCacheBehavior_trustedKeyGroups
=== PAUSE TestAccCloudFrontDistribution_DefaultCacheBehavior_trustedKeyGroups
=== RUN TestAccCloudFrontDistribution_DefaultCacheBehavior_trustedSigners
=== PAUSE TestAccCloudFrontDistribution_DefaultCacheBehavior_trustedSigners
=== RUN TestAccCloudFrontDistribution_DefaultCacheBehavior_realtimeLogARN
=== PAUSE TestAccCloudFrontDistribution_DefaultCacheBehavior_realtimeLogARN
=== RUN TestAccCloudFrontDistribution_OrderedCacheBehavior_realtimeLogARN
=== PAUSE TestAccCloudFrontDistribution_OrderedCacheBehavior_realtimeLogARN
=== RUN TestAccCloudFrontDistribution_enabled
=== PAUSE TestAccCloudFrontDistribution_enabled
=== RUN TestAccCloudFrontDistribution_retainOnDelete
=== PAUSE TestAccCloudFrontDistribution_retainOnDelete
=== RUN TestAccCloudFrontDistribution_OrderedCacheBehaviorForwardedValuesCookies_whitelistedNames
=== PAUSE TestAccCloudFrontDistribution_OrderedCacheBehaviorForwardedValuesCookies_whitelistedNames
=== RUN TestAccCloudFrontDistribution_OrderedCacheBehaviorForwardedValues_headers
=== PAUSE TestAccCloudFrontDistribution_OrderedCacheBehaviorForwardedValues_headers
=== RUN TestAccCloudFrontDistribution_ViewerCertificate_acmCertificateARN
=== PAUSE TestAccCloudFrontDistribution_ViewerCertificate_acmCertificateARN
=== RUN TestAccCloudFrontDistribution_ViewerCertificateACMCertificateARN_conflictsWithCloudFrontDefaultCertificate
=== PAUSE TestAccCloudFrontDistribution_ViewerCertificateACMCertificateARN_conflictsWithCloudFrontDefaultCertificate
=== RUN TestAccCloudFrontDistribution_waitForDeployment
=== PAUSE TestAccCloudFrontDistribution_waitForDeployment
=== RUN TestAccCloudFrontDistribution_preconditionFailed
=== PAUSE TestAccCloudFrontDistribution_preconditionFailed
=== RUN TestAccCloudFrontDistribution_originGroups
=== PAUSE TestAccCloudFrontDistribution_originGroups
=== CONT TestAccCloudFrontContinuousDeploymentPolicy_basic
=== CONT TestAccCloudFrontDistribution_Origin_originAccessControl
=== CONT TestAccCloudFrontDistribution_originGroups
=== CONT TestAccCloudFrontDistribution_preconditionFailed
--- PASS: TestAccCloudFrontDistribution_originGroups (550.58s)
=== CONT TestAccCloudFrontDistribution_waitForDeployment
--- PASS: TestAccCloudFrontDistribution_preconditionFailed (855.25s)
=== CONT TestAccCloudFrontDistribution_ViewerCertificateACMCertificateARN_conflictsWithCloudFrontDefaultCertificate
--- PASS: TestAccCloudFrontDistribution_Origin_originAccessControl (888.74s)
=== CONT TestAccCloudFrontDistribution_ViewerCertificate_acmCertificateARN
--- PASS: TestAccCloudFrontDistribution_ViewerCertificateACMCertificateARN_conflictsWithCloudFrontDefaultCertificate (221.24s)
=== CONT TestAccCloudFrontDistribution_OrderedCacheBehaviorForwardedValues_headers
--- PASS: TestAccCloudFrontContinuousDeploymentPolicy_basic (1124.39s)
=== CONT TestAccCloudFrontDistribution_OrderedCacheBehaviorForwardedValuesCookies_whitelistedNames
--- PASS: TestAccCloudFrontDistribution_waitForDeployment (586.86s)
=== CONT TestAccCloudFrontDistribution_retainOnDelete
--- PASS: TestAccCloudFrontDistribution_ViewerCertificate_acmCertificateARN (256.92s)
=== CONT TestAccCloudFrontDistribution_enabled
--- PASS: TestAccCloudFrontDistribution_OrderedCacheBehaviorForwardedValues_headers (249.54s)
=== CONT TestAccCloudFrontDistribution_OrderedCacheBehavior_realtimeLogARN
--- PASS: TestAccCloudFrontDistribution_OrderedCacheBehaviorForwardedValuesCookies_whitelistedNames (246.37s)
=== CONT TestAccCloudFrontDistribution_DefaultCacheBehavior_realtimeLogARN
--- PASS: TestAccCloudFrontDistribution_retainOnDelete (452.59s)
=== CONT TestAccCloudFrontDistribution_DefaultCacheBehavior_trustedSigners
--- PASS: TestAccCloudFrontDistribution_OrderedCacheBehavior_realtimeLogARN (268.64s)
=== CONT TestAccCloudFrontDistribution_DefaultCacheBehavior_trustedKeyGroups
--- PASS: TestAccCloudFrontDistribution_DefaultCacheBehavior_realtimeLogARN (378.06s)
=== CONT TestAccCloudFrontDistribution_DefaultCacheBehaviorForwardedValues_headers
--- PASS: TestAccCloudFrontDistribution_DefaultCacheBehavior_trustedSigners (214.52s)
=== CONT TestAccCloudFrontDistribution_DefaultCacheBehaviorForwardedValuesCookies_whitelistedNames
--- PASS: TestAccCloudFrontDistribution_enabled (659.85s)
=== CONT TestAccCloudFrontDistribution_noCustomErrorResponse
--- PASS: TestAccCloudFrontDistribution_DefaultCacheBehavior_trustedKeyGroups (216.62s)
=== CONT TestAccCloudFrontDistribution_isIPV6Enabled
--- PASS: TestAccCloudFrontDistribution_DefaultCacheBehaviorForwardedValues_headers (300.96s)
=== CONT TestAccCloudFrontDistribution_http11
--- PASS: TestAccCloudFrontDistribution_DefaultCacheBehaviorForwardedValuesCookies_whitelistedNames (302.00s)
=== CONT TestAccCloudFrontDistribution_noOptionalItems
--- PASS: TestAccCloudFrontDistribution_isIPV6Enabled (464.76s)
=== CONT TestAccCloudFrontDistribution_multiOrigin
--- PASS: TestAccCloudFrontDistribution_noCustomErrorResponse (476.56s)
=== CONT TestAccCloudFrontDistribution_Origin_originShield
--- PASS: TestAccCloudFrontDistribution_http11 (461.90s)
=== CONT TestAccCloudFrontDistribution_Origin_connectionTimeout
--- PASS: TestAccCloudFrontDistribution_noOptionalItems (421.92s)
=== CONT TestAccCloudFrontDistribution_Origin_connectionAttempts
--- PASS: TestAccCloudFrontDistribution_multiOrigin (475.65s)
=== CONT TestAccCloudFrontDistribution_Origin_emptyOriginID
--- PASS: TestAccCloudFrontDistribution_Origin_emptyOriginID (2.54s)
=== CONT TestAccCloudFrontDistribution_Origin_emptyDomainName
--- PASS: TestAccCloudFrontDistribution_Origin_emptyDomainName (2.72s)
=== CONT TestAccCloudFrontDistribution_forwardedValuesToCachePolicy
--- PASS: TestAccCloudFrontDistribution_Origin_originShield (475.72s)
=== CONT TestAccCloudFrontDistribution_orderedCacheBehaviorResponseHeadersPolicy
--- PASS: TestAccCloudFrontDistribution_Origin_connectionAttempts (462.33s)
=== CONT TestAccCloudFrontDistribution_orderedCacheBehaviorCachePolicy
--- PASS: TestAccCloudFrontDistribution_Origin_connectionTimeout (485.96s)
=== CONT TestAccCloudFrontDistribution_orderedCacheBehavior
--- PASS: TestAccCloudFrontDistribution_orderedCacheBehaviorResponseHeadersPolicy (590.99s)
=== CONT TestAccCloudFrontDistribution_tags
--- PASS: TestAccCloudFrontDistribution_orderedCacheBehaviorCachePolicy (616.07s)
=== CONT TestAccCloudFrontDistribution_originPolicyOrdered
--- PASS: TestAccCloudFrontDistribution_tags (304.55s)
=== CONT TestAccCloudFrontDistribution_originPolicyDefault
--- PASS: TestAccCloudFrontDistribution_orderedCacheBehavior (698.62s)
=== CONT TestAccCloudFrontDistribution_customOrigin
--- PASS: TestAccCloudFrontDistribution_forwardedValuesToCachePolicy (943.63s)
=== CONT TestAccCloudFrontDistribution_s3Origin
--- PASS: TestAccCloudFrontDistribution_originPolicyOrdered (502.96s)
=== CONT TestAccCloudFrontDistribution_basic
--- PASS: TestAccCloudFrontDistribution_originPolicyDefault (461.70s)
=== CONT TestAccCloudFrontDistribution_disappears
--- PASS: TestAccCloudFrontDistribution_s3Origin (470.40s)
=== CONT TestAccCloudFrontContinuousDeploymentPolicy_trafficConfig
--- PASS: TestAccCloudFrontDistribution_customOrigin (482.79s)
=== CONT TestAccCloudFrontContinuousDeploymentPolicy_disappears
--- PASS: TestAccCloudFrontDistribution_disappears (196.53s)
--- PASS: TestAccCloudFrontDistribution_basic (202.88s)
--- PASS: TestAccCloudFrontContinuousDeploymentPolicy_disappears (583.16s)
--- PASS: TestAccCloudFrontContinuousDeploymentPolicy_trafficConfig (1093.93s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront 5270.485s
This functionality has been released in v5.12.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! |
Hi. When upgrading the aws provider to include this change,
Thanks. |
Hi @joshaw - I suspect this behavior may be surfacing because the distribution is managed within a module, versus the root configuration. In a minimal reproduction I'm able to create a distribution with Show/Hide Reproduction% terraform -v
Terraform v1.5.6
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.11.0 % terraform state show aws_cloudfront_distribution.test
# aws_cloudfront_distribution.test:
resource "aws_cloudfront_distribution" "test" {
arn = "arn:aws:cloudfront::<redacted>:distribution/E5X3A02ABA9VI"
caller_reference = "terraform-20230831172837150800000001"
domain_name = "duw7kxbs3shas.cloudfront.net"
enabled = true
etag = "E2IH1MAAVWQ9IK"
hosted_zone_id = "Z2FDTNDATAQYW2"
http_version = "http2"
id = "E5X3A02ABA9VI"
in_progress_validation_batches = 0
is_ipv6_enabled = false
last_modified_time = "2023-08-31 17:28:37.35 +0000 UTC"
price_class = "PriceClass_All"
retain_on_delete = false
status = "Deployed"
tags_all = {}
trusted_key_groups = [
{
enabled = false
items = []
},
]
trusted_signers = [
{
enabled = false
items = []
},
]
wait_for_deployment = true
default_cache_behavior {
allowed_methods = [
"GET",
"HEAD",
]
cached_methods = [
"GET",
"HEAD",
]
compress = false
default_ttl = 0
max_ttl = 0
min_ttl = 0
smooth_streaming = false
target_origin_id = "test"
trusted_key_groups = []
trusted_signers = []
viewer_protocol_policy = "allow-all"
forwarded_values {
headers = []
query_string = false
query_string_cache_keys = []
cookies {
forward = "all"
whitelisted_names = []
}
}
}
origin {
connection_attempts = 3
connection_timeout = 10
domain_name = "www.example.com"
origin_id = "test"
custom_origin_config {
http_port = 80
https_port = 443
origin_keepalive_timeout = 5
origin_protocol_policy = "https-only"
origin_read_timeout = 30
origin_ssl_protocols = [
"TLSv1.2",
]
}
}
restrictions {
geo_restriction {
locations = []
restriction_type = "none"
}
}
viewer_certificate {
cloudfront_default_certificate = true
minimum_protocol_version = "TLSv1"
}
} Then, changed the pinned provider version and ran % terraform -v
Terraform v1.5.6
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.14.0 % terraform plan
aws_cloudfront_distribution.test: Refreshing state... [id=E5X3A02ABA9VI]
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed. After an apply with no changes, the new % terraform apply
aws_cloudfront_distribution.test: Refreshing state... [id=E5X3A02ABA9VI]
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed. % terraform state show aws_cloudfront_distribution.test
# aws_cloudfront_distribution.test:
resource "aws_cloudfront_distribution" "test" {
aliases = []
arn = "arn:aws:cloudfront::<redacted>:distribution/E5X3A02ABA9VI"
caller_reference = "terraform-20230831172837150800000001"
domain_name = "duw7kxbs3shas.cloudfront.net"
enabled = true
etag = "E2IH1MAAVWQ9IK"
hosted_zone_id = "Z2FDTNDATAQYW2"
http_version = "http2"
id = "E5X3A02ABA9VI"
in_progress_validation_batches = 0
is_ipv6_enabled = false
last_modified_time = "2023-08-31 17:28:37.35 +0000 UTC"
price_class = "PriceClass_All"
retain_on_delete = false
staging = false
status = "Deployed"
tags = {}
tags_all = {}
trusted_key_groups = [
{
enabled = false
items = []
},
]
trusted_signers = [
{
enabled = false
items = []
},
]
wait_for_deployment = true
default_cache_behavior {
allowed_methods = [
"GET",
"HEAD",
]
cached_methods = [
"GET",
"HEAD",
]
compress = false
default_ttl = 0
max_ttl = 0
min_ttl = 0
smooth_streaming = false
target_origin_id = "test"
trusted_key_groups = []
trusted_signers = []
viewer_protocol_policy = "allow-all"
forwarded_values {
headers = []
query_string = false
query_string_cache_keys = []
cookies {
forward = "all"
whitelisted_names = []
}
}
}
origin {
connection_attempts = 3
connection_timeout = 10
domain_name = "www.example.com"
origin_id = "test"
custom_origin_config {
http_port = 80
https_port = 443
origin_keepalive_timeout = 5
origin_protocol_policy = "https-only"
origin_read_timeout = 30
origin_ssl_protocols = [
"TLSv1.2",
]
}
}
restrictions {
geo_restriction {
locations = []
restriction_type = "none"
}
}
viewer_certificate {
cloudfront_default_certificate = true
minimum_protocol_version = "TLSv1"
}
} I suspect the additional module layer between the root configuration and distribution resource is preventing Terraform from accurately detecting that "read-only" change. Some possible options to try:
The goal of both would be to get the computed |
That's really helpful context, thank you. I will try those options. |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
Adds continuous deployment support for CloudFront distributions.
aws_cloudfront_continuous_deployment_policy
resourcestaging
andcontinuous_deployment_policy_id
arguments to theaws_cloudfront_distribution
resourceRelations
Closes #28920
References
Output from Acceptance Testing