Skip to content

budgets: normalize limit_amount to avoid scientific notation breaking UpdateBudget#47501

Open
CorinneVerheyde wants to merge 2 commits intohashicorp:mainfrom
CorinneVerheyde:fix/budgets-limit-amount-scientific-notation
Open

budgets: normalize limit_amount to avoid scientific notation breaking UpdateBudget#47501
CorinneVerheyde wants to merge 2 commits intohashicorp:mainfrom
CorinneVerheyde:fix/budgets-limit-amount-scientific-notation

Conversation

@CorinneVerheyde
Copy link
Copy Markdown

Rollback Plan

Revert this change and publish a new provider release.

As this change only normalizes limit_amount when reading aws_budgets_budget, rollback risk is low and isolated to the Budgets resource.

Changes to Security Controls

No.

Description

Large limit_amount values are returned by the AWS Budgets API in scientific notation (e.g. 2.51E+7).

The provider stores this value directly in state during Read:

d.Set("limit_amount", budget.BudgetLimit.Amount)

This causes subsequent UpdateBudget calls to fail with:

ValidationException: Value at 'newBudget.budgetLimit.amount' failed to satisfy constraint

This change normalizes limit_amount to a plain decimal string during Read, so subsequent updates continue to send a valid value to AWS.

An acceptance test TestAccBudgetsBudget_largeLimitAmountUpdate was added to reproduce the issue:

  • create a budget with a large limit_amount
  • perform an in-place update by adding a notification
  • verify the update succeeds

Before fix: fails on update
After fix: passes

Relations

Closes #47487

References

Output from Acceptance Testing

% make testacc TESTS=TestAccBudgetsBudget_largeLimitAmountUpdate PKG=budgets

make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 main 🌿...
TF_ACC=1 go1.26.2 test ./internal/service/budgets/... -v -count 1 -parallel 20 -run='TestAccBudgetsBudget_largeLimitAmountUpdate'  -timeout 360m -vet=off
2026/04/16 23:56:36 Creating Terraform AWS Provider (SDKv2-style)...
2026/04/16 23:56:36 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccBudgetsBudget_largeLimitAmountUpdate
=== PAUSE TestAccBudgetsBudget_largeLimitAmountUpdate
=== CONT  TestAccBudgetsBudget_largeLimitAmountUpdate
--- PASS: TestAccBudgetsBudget_largeLimitAmountUpdate (67.31s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/budgets    67.635s

@CorinneVerheyde CorinneVerheyde requested a review from a team as a code owner April 16, 2026 22:48
@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.

@dosubot dosubot Bot added the bug Addresses a defect in current functionality. label Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 16, 2026

✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible.

@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/budgets Issues and PRs that pertain to the budgets service. size/M Managed by automation to categorize the size of a PR. labels Apr 16, 2026
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Apr 22, 2026
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/budgets Issues and PRs that pertain to the budgets service. size/M 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

Development

Successfully merging this pull request may close these issues.

aws_budgets_budget: scientific notation in limit_amount breaks UpdateBudget

2 participants