Skip to content

fix: Change etag to read-only for aws_cloudfront_response_headers_policy #38448

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

acwwat
Copy link
Contributor

@acwwat acwwat commented Jul 20, 2024

Description

This PR is to change the etag argument of the aws_cloudfront_response_headers_policy resource to read-only, since users cannot really set it according to the AWS API reference.

Relations

Closes #38244

References

See #38244 (comment) for list of resources referenced during the investigation.

Output from Acceptance Testing

$ make testacc TESTS=TestAccCloudFrontResponseHeadersPolicy PKG=cloudfront
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/cloudfront/... -v -count 1 -parallel 20 -run='TestAccCloudFrontResponseHeadersPolicy'  -timeout 360m
=== RUN   TestAccCloudFrontResponseHeadersPolicyDataSource_basic
=== PAUSE TestAccCloudFrontResponseHeadersPolicyDataSource_basic
=== RUN   TestAccCloudFrontResponseHeadersPolicy_cors
=== PAUSE TestAccCloudFrontResponseHeadersPolicy_cors
=== RUN   TestAccCloudFrontResponseHeadersPolicy_customHeaders
=== PAUSE TestAccCloudFrontResponseHeadersPolicy_customHeaders
=== RUN   TestAccCloudFrontResponseHeadersPolicy_RemoveHeadersConfig
=== PAUSE TestAccCloudFrontResponseHeadersPolicy_RemoveHeadersConfig
=== RUN   TestAccCloudFrontResponseHeadersPolicy_securityHeaders
=== PAUSE TestAccCloudFrontResponseHeadersPolicy_securityHeaders
=== RUN   TestAccCloudFrontResponseHeadersPolicy_serverTimingHeaders
=== PAUSE TestAccCloudFrontResponseHeadersPolicy_serverTimingHeaders
=== RUN   TestAccCloudFrontResponseHeadersPolicy_disappears
=== PAUSE TestAccCloudFrontResponseHeadersPolicy_disappears
=== CONT  TestAccCloudFrontResponseHeadersPolicyDataSource_basic
=== CONT  TestAccCloudFrontResponseHeadersPolicy_securityHeaders
=== CONT  TestAccCloudFrontResponseHeadersPolicy_customHeaders
=== CONT  TestAccCloudFrontResponseHeadersPolicy_RemoveHeadersConfig
=== CONT  TestAccCloudFrontResponseHeadersPolicy_disappears
=== CONT  TestAccCloudFrontResponseHeadersPolicy_cors
=== CONT  TestAccCloudFrontResponseHeadersPolicy_serverTimingHeaders
--- PASS: TestAccCloudFrontResponseHeadersPolicyDataSource_basic (20.54s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_disappears (21.17s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_RemoveHeadersConfig (24.26s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_customHeaders (24.34s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_securityHeaders (34.47s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_cors (34.56s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_serverTimingHeaders (54.73s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront 54.959s

$

@acwwat acwwat requested a review from a team as a code owner July 20, 2024 23:25
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

Copy link

Thank you for your contribution! 🚀

Please note that typically Go dependency changes are handled in this repository by dependabot or the maintainers. This is to prevent pull request merge conflicts and further delay reviews of contributions. Remove any changes to the go.mod or go.sum files and commit them into this pull request.

Additional details:

  • Check open pull requests with the dependencies label to view other dependency updates.
  • If this pull request includes an update the AWS Go SDK (or any other dependency) version, only updates submitted via dependabot will be merged. This pull request will need to remove these changes and will need to be rebased after the existing dependency update via dependabot has been merged for this pull request to be reviewed.
  • If this pull request is for supporting a new AWS service:
    • Ensure the new AWS service changes are following the Contributing Guide section on new services, in particular that the dependency addition and initial provider support are in a separate pull request from other changes (e.g. new resources). Contributions not following this item will not be reviewed until the changes are split.
    • If this pull request is already a separate pull request from the above item, you can ignore this message.

@terraform-aws-provider terraform-aws-provider bot added service/cloudfront Issues and PRs that pertain to the cloudfront service. size/XS Managed by automation to categorize the size of a PR. labels Jul 20, 2024
@acwwat acwwat force-pushed the b-aws_cloudfront_response_headers_policy-set_etag_to_computed branch from f25ecd7 to e6c1766 Compare July 20, 2024 23:26
Copy link

Thank you for your contribution! 🚀

Please note that typically Go dependency changes are handled in this repository by dependabot or the maintainers. This is to prevent pull request merge conflicts and further delay reviews of contributions. Remove any changes to the go.mod or go.sum files and commit them into this pull request.

Additional details:

  • Check open pull requests with the dependencies label to view other dependency updates.
  • If this pull request includes an update the AWS Go SDK (or any other dependency) version, only updates submitted via dependabot will be merged. This pull request will need to remove these changes and will need to be rebased after the existing dependency update via dependabot has been merged for this pull request to be reviewed.
  • If this pull request is for supporting a new AWS service:
    • Ensure the new AWS service changes are following the Contributing Guide section on new services, in particular that the dependency addition and initial provider support are in a separate pull request from other changes (e.g. new resources). Contributions not following this item will not be reviewed until the changes are split.
    • If this pull request is already a separate pull request from the above item, you can ignore this message.

@jar-b
Copy link
Member

jar-b commented Jul 22, 2024

This fix makes sense to me given the context from this comment. However, removal of the optional argument technically represents a breaking change. To avoid impacting to existing configurations where etag is explicitly set, we'll need to wait on this for the next major release (v6.0.0).

@jar-b jar-b added this to the v6.0.0 milestone Jul 22, 2024
@jar-b jar-b added the breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. label Jul 22, 2024
@justinretzolk justinretzolk added the external-maintainer Contribution from a trusted external contributor. label Jul 29, 2024
@jar-b jar-b self-assigned this Apr 2, 2025
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Apr 2, 2025
@jar-b jar-b changed the base branch from main to release/6.0.0-beta April 2, 2025 17:57
@jar-b jar-b force-pushed the b-aws_cloudfront_response_headers_policy-set_etag_to_computed branch from e6c1766 to f8ee3c5 Compare April 2, 2025 18:06
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

% ake testacc PKG=cloudfront TESTS=TestAccCloudFrontResponseHeadersPolicy_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.24.1 test ./internal/service/cloudfront/... -v -count 1 -parallel 20 -run='TestAccCloudFrontResponseHeadersPolicy_'  -timeout 360m -vet=off
2025/04/02 14:24:31 Initializing Terraform AWS Provider...

--- PASS: TestAccCloudFrontResponseHeadersPolicy_disappears (13.12s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_customHeaders (14.79s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_RemoveHeadersConfig (15.13s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_securityHeaders (22.62s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_cors (22.76s)
--- PASS: TestAccCloudFrontResponseHeadersPolicy_serverTimingHeaders (36.80s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront 43.546s

@jar-b
Copy link
Member

jar-b commented Apr 2, 2025

Thanks for your contribution, @acwwat! 👍

@jar-b jar-b merged commit d6d386f into hashicorp:release/6.0.0-beta Apr 2, 2025
41 checks passed
Copy link

github-actions bot commented Apr 2, 2025

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.

Copy link

github-actions bot commented May 3, 2025

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2025
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label May 7, 2025
@acwwat acwwat deleted the b-aws_cloudfront_response_headers_policy-set_etag_to_computed branch June 22, 2025 04:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking-change Introduces a breaking change in current functionality; usually deferred to the next major release. external-maintainer Contribution from a trusted external contributor. service/cloudfront Issues and PRs that pertain to the cloudfront service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: (also doc issue) importing cloudfront response header policy includes etag which is undocumented as an argument and causes apply failures
4 participants