-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[bugfix] aws_cloudfront_distribution: Allow setting logging_config.include_cookies without enabling V1 logging
#44838
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
Conversation
Community GuidelinesThis comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀 Voting for Prioritization
Pull Request Authors
|
4a6154a to
410b286
Compare
logging_config.include_cookies argument even when V1 logging is turned offlogging_config.include_cookies without enabling V1 logging
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=TestAccCloudFrontDistribution_basic\|TestAccCloudFrontDistribution_s3Origin\|TestAccCloudFrontDistribution_includeCookieWhenV1loggingDisabled' PKG=cloudfront
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 HEAD 🌿...
TF_ACC=1 go1.24.8 test ./internal/service/cloudfront/... -v -count 1 -parallel 20 -run=TestAccCloudFrontDistribution_basic\|TestAccCloudFrontDistribution_s3Origin\|TestAccCloudFrontDistribution_includeCookieWhenV1loggingDisabled -timeout 360m -vet=off
2025/11/04 12:18:46 Creating Terraform AWS Provider (SDKv2-style)...
2025/11/04 12:18:46 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN TestAccCloudFrontDistribution_basic
=== PAUSE TestAccCloudFrontDistribution_basic
=== RUN TestAccCloudFrontDistribution_s3Origin
=== PAUSE TestAccCloudFrontDistribution_s3Origin
=== RUN TestAccCloudFrontDistribution_includeCookieWhenV1loggingDisabled
=== PAUSE TestAccCloudFrontDistribution_includeCookieWhenV1loggingDisabled
=== CONT TestAccCloudFrontDistribution_basic
=== CONT TestAccCloudFrontDistribution_includeCookieWhenV1loggingDisabled
=== CONT TestAccCloudFrontDistribution_s3Origin
--- PASS: TestAccCloudFrontDistribution_basic (233.02s)
--- PASS: TestAccCloudFrontDistribution_s3Origin (454.96s)
--- PASS: TestAccCloudFrontDistribution_includeCookieWhenV1loggingDisabled (455.02s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront 460.702s|
@tabito-hara Thanks for the contribution 🎉 👏. |
|
Warning This Issue has been closed, meaning that any additional comments are much easier for the maintainers to miss. Please assume that the maintainers will not see them. Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed. |
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the library.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
Description
Missing argument to enable Cookie Logging for CloudFront Standard Logging (V2) #44827 reported that it is unclear how to enable the cookie logging option with CloudFront V2 logging.
When I enabled the cookie logging option in the AWS Management Console, CloudTrail recorded the following operation:
Even when using V2 logging, the
logging.include_cookiessetting is still evaluated by the AWS API.However, in the current AWS Provider implementation, the
logging_config.enabledargument does not exist. Instead, V1 logging is implicitly enabled when thelogging_configblock is present.Therefore, it is currently not possible to set
include_cookieswhile keeping V1 logging disabled.This PR allows
logging_config.include_cookiesto be set totruewhen V1 logging is disabled (and V2 logging is enabled).logging_config.bucketis changed fromRequiredtoOptional, and now determines whether V1 logging is enabled: iflogging_config.bucketis specified, V1 logging is enabled; if omitted, V1 logging is disabled.logging_config.include_cookiescan be enabled independently of V1 logging.A new attribute,
logging_v1_enabled, is added to allow users to easily monitor the status of V1 logging.Relations
Closes #44827
References
terraform-provider-aws/internal/service/cloudfront/distribution.go
Lines 2650 to 2666 in 69b29c4
Output from Acceptance Testing
One test failed, which is the same error reported in #44691 and #44753.