Skip to content
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

[Bug]: aws_budgets_budget_action does not recognize standby as successful creation state #31236

Closed
criccio opened this issue May 5, 2023 · 5 comments · Fixed by #33015
Closed
Labels
bug Addresses a defect in current functionality. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/budgets Issues and PRs that pertain to the budgets service.
Milestone

Comments

@criccio
Copy link

criccio commented May 5, 2023

Terraform Core Version

1.4.6

AWS Provider Version

4.66.1

Affected Resource(s)

  • aws_budgets_budget_action

Expected Behavior

terraform apply should recognize STANDBY as completed state for resource creation.

The AWS help for budget actions describes the valid states as:

  • Standby: An action is attached to the threshold and is actively being evaluated.
  • Pending: The action is started and is waiting for your approval.
  • Completed: The action successfully ran.
  • Reversed: You chose to undo the action. AWS Budgets no longer evaluates the action for the remaining budgeted period.

Which means the initial state of the action will be STANDBY, it will only be PENDING after the action has been triggered

Actual Behavior

terraform apply waits until the timeout expecting a success/failure or pending state:

create: timeout while waiting for state to become 'EXECUTION_SUCCESS, EXECUTION_FAILURE, PENDING' (last state: 'STANDBY', timeout: 5m0s)

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_budgets_budget" "sandbox_budget" {
  name = "sandbox_cost_limit"

  budget_type  = "COST"
  limit_amount = "100"
  limit_unit   = "USD"
  time_unit    = "MONTHLY"
}

resource "aws_budgets_budget_action" "sandbox_budget_action" {
  budget_name        = aws_budgets_budget.sandbox_budget.name
  action_type        = "APPLY_SCP_POLICY"
  approval_model     = "AUTOMATIC"
  notification_type  = "ACTUAL"
  execution_role_arn = aws_iam_role.budget_action_role.arn 

  action_threshold {
    action_threshold_type  = "ABSOLUTE_VALUE"
    action_threshold_value = 100
  }

  definition {
    scp_action_definition {
        policy_id = aws_organizations_policy.readonly.id
        target_ids = [ aws_organizations_account.org_account.id ]
    }
  }

  subscriber {    
    address           = var.notification_email
    subscription_type = "EMAIL"
  }
}

Steps to Reproduce

  • create the terraform file with the budget action resource (repo requires a role, policy to apply, and account)
  • terraform apply

Debug Output

aws_budgets_budget_action.sandbox_budget_action: Creating...
aws_budgets_budget_action.sandbox_budget_action: Still creating... [10s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [20s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [30s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [40s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [50s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [1m0s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [1m10s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [1m20s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [1m30s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [1m40s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [1m50s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [2m0s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [2m10s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [2m20s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [2m30s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [2m40s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [2m50s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [3m0s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [3m10s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [3m20s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [3m30s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [3m40s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [3m50s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [4m0s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [4m10s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [4m20s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [4m30s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [4m40s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [4m50s elapsed]
aws_budgets_budget_action.sandbox_budget_action: Still creating... [5m0s elapsed]
╷
│ Error: waiting for Budget Action () create: timeout while waiting for state to become 'EXECUTION_SUCCESS, EXECUTION_FAILURE, PENDING' (last state: 'STANDBY', timeout: 5m0s)

Panic Output

No response

Important Factoids

See referenced Issue and PR

  • The previous issue was addressed only by extending the timeout - however the issue isn't the time taken to create the resource it's that the resource will always report "standby" as it's default ready state
  • An alternative PR that handles the standby state was closed without merging in favor of a longer timeout

References

#20125
#21664

Would you like to implement a fix?

No

@criccio criccio added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels May 5, 2023
@github-actions
Copy link

github-actions bot commented May 5, 2023

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/budgets Issues and PRs that pertain to the budgets service. label May 5, 2023
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label May 9, 2023
@xwing3
Copy link

xwing3 commented Jun 7, 2023

having the same issue when trying to terraform a budget action, provider version = 5.1.0. Weird thing is that this issue is marked as fixed in #20125

@mjrlee
Copy link
Contributor

mjrlee commented Aug 2, 2023

I'm also seeing this. A PR that resolves the issue was already created: #21664

Could that PR be merged in please?

To clarify, the problem is not to do with the timeout, it's to do with the state that terraform times out waiting for. The PR that was merged to fix this addressed the timeout directly which did not solve the underlying problem of having incorrect target states for waitActionAvailable.

In its current form this is unusable as any attempt to create a budget action through terraform will fail.

@justinretzolk justinretzolk added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 3, 2023
@github-actions github-actions bot added this to the v5.13.0 milestone Aug 15, 2023
@github-actions github-actions bot removed the bug Addresses a defect in current functionality. label Aug 18, 2023
@github-actions
Copy link

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

@github-actions
Copy link

I'm going to lock this issue 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 similar to this, 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 Sep 18, 2023
@justinretzolk justinretzolk added the bug Addresses a defect in current functionality. label Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/budgets Issues and PRs that pertain to the budgets service.
Projects
None yet
4 participants