Skip to content

fix(amp): omit unchanged destination on scraper update to prevent CloudWatch destination failure 🤖🤖🤖 - #50463

Merged
ewbankkit merged 2 commits into
hashicorp:mainfrom
somaz94:fix/scraper-cloudwatch-destination-update-50421
Oct 16, 2026
Merged

ewbankkit merged 2 commits into
hashicorp:mainfrom
somaz94:fix/scraper-cloudwatch-destination-update-50421

Conversation

@somaz94

@somaz94 somaz94 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

No. This change only affects which fields are sent in the UpdateScraper request.

Description

Updating any in-place attribute (for example scrape_configuration) of an aws_prometheus_scraper with a CloudWatch destination fails, because the provider always sends destination in the UpdateScraper request, and the API rejects it for CloudWatch destinations even when the value is unchanged.

This PR leaves Destination out of the update input when it has not changed (new.Destination.Equal(old.Destination)). When destination does change, it is still sent as before, so behavior for AMP destinations is unchanged.

TestAccAMPScraper_cloudWatchDestination gets an extra step that changes scrape_interval from 30s to 60s to exercise the in-place update path, followed by an import verification step. The config helper testAccScraperConfig_cloudWatchDestination takes an optional interval argument so existing callers keep working.

AI usage disclosure

An LLM agent was used to help locate the update code path, draft the fix and the extra acceptance test step, and draft this description. I reviewed every changed line and the package compiles (go test -run '^$' ./internal/service/amp/...).

Relations

Closes #50421

References

Output from Acceptance Testing

I do not have access to an AWS environment that can provision the VPC and CloudWatch resources this test needs, so I have not been able to run the acceptance tests. I would appreciate it if a maintainer could run:

% make testacc TESTS=TestAccAMPScraper_cloudWatchDestination PKG=amp

The new step updates scrape_interval in place and should pass with this change, and fail with the current main.

@github-actions

Copy link
Copy Markdown
Contributor

Community Guidelines

This 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

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions Bot added needs-triage Waiting for first response or review from a maintainer. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/amp Issues and PRs that pertain to the amp service. size/S Managed by automation to categorize the size of a PR. labels Oct 14, 2026
somaz94 added a commit to somaz94/somaz94 that referenced this pull request Oct 14, 2026
@somaz94
somaz94 marked this pull request as ready for review October 14, 2026 09:22
@somaz94
somaz94 requested a review from a team as a code owner October 14, 2026 09:22
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 15, 2026
@ewbankkit ewbankkit self-assigned this Oct 15, 2026
@github-actions github-actions Bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 15, 2026

@ewbankkit ewbankkit left a comment

Copy link
Copy Markdown
Collaborator

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=TestAccAMPScraper_cloudWatchDestination\|TestAccAMPScraper_alias' PKG=amp
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Validating schemas
ok      github.com/hashicorp/terraform-provider-aws/internal/provider/sdkv2     5.899s
ok      github.com/hashicorp/terraform-provider-aws/internal/provider/framework 5.919s
make: Running acceptance tests on branch: 🌿 HEAD 🌿...
TF_ACC=1 go1.26.9 test ./internal/service/amp/... -v -count 1 -parallel 20  -run=TestAccAMPScraper_cloudWatchDestination\|TestAccAMPScraper_alias -timeout 360m -vet=off -buildvcs=false
2026/10/15 11:55:16 Creating Terraform AWS Provider (SDKv2-style)...
2026/10/15 11:55:16 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccAMPScraper_alias
=== PAUSE TestAccAMPScraper_alias
=== RUN   TestAccAMPScraper_cloudWatchDestination
=== PAUSE TestAccAMPScraper_cloudWatchDestination
=== CONT  TestAccAMPScraper_alias
=== CONT  TestAccAMPScraper_cloudWatchDestination
--- PASS: TestAccAMPScraper_cloudWatchDestination (1804.96s)
--- PASS: TestAccAMPScraper_alias (2636.91s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/amp        2643.000s

@ewbankkit

Copy link
Copy Markdown
Collaborator

@somaz94 Thanks for the contribution 🎉 👏.

@ewbankkit
ewbankkit merged commit 1f9344d into hashicorp:main Oct 16, 2026
49 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added this to the v6.70.0 milestone Oct 16, 2026
@github-actions github-actions Bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This functionality has been released in v6.70.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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Addresses a defect in current functionality. service/amp Issues and PRs that pertain to the amp service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.

Projects

None yet

2 participants