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

aws_organizations_account tries to recreate resource if status is SUSPENDED (introduced in v4.9.0) #24949

Closed
jakemulley opened this issue May 23, 2022 · 4 comments
Labels
bug Addresses a defect in current functionality. service/organizations Issues and PRs that pertain to the organizations service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@jakemulley
Copy link
Contributor

jakemulley commented May 23, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v1.2.0
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v4.9.0

Affected Resource(s)

  • aws_organizations_account

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_organizations_account" "test" {
  name  = "Test"
  email = "test@test.com"
}

Expected Behavior

A suspended account should not try to recreate if it is within its 90-day post-closure period.

Actual Behavior

In terraform-provider-aws prior to v4.9.0 (e.g. v4.8.0), Terraform reports no changes to a suspended account referenced via the above resource block:

aws_organizations_account.test: Refreshing state... [id=***]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

However, in terraform-rpovider-aws v4.9.0, Terraform tries to recreate the account:

  # aws_organizations_account.test will be created
  + resource "aws_organizations_account" "test" {
      + arn               = (known after apply)
      + close_on_deletion = false
      + email             = (sensitive)
      + id                = (known after apply)
      + joined_method     = (known after apply)
      + joined_timestamp  = (known after apply)
      + name              = "Test"
      + parent_id         = (known after apply)
      + status            = (known after apply)
      + tags_all          = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Steps to Reproduce

  1. Use aws_organizations_account to create an AWS account via Terraform
  2. Close the account via the console or any other means (CLI, etc)
  3. Run terraform plan on the resource

References

Potentially introduced via #23931, where organizations.AccountStatusSuspended is used to return resource.NotFoundError.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/organizations Issues and PRs that pertain to the organizations service. labels May 23, 2022
@justinretzolk
Copy link
Member

Hey @jakemulley 👋 Thank you for taking the time to raise this! While it's not exactly the same thing, there was a (vaguely) similar bug that was fixed via #24899, which was included in the v4.15.1 release of the provider. Can you test with this later version and see if that fix happened to correct this as well?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels May 24, 2022
@jakemulley
Copy link
Contributor Author

Hello @justinretzolk!

I've given it a try under v4.15.1:

Terraform v1.2.1
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v4.15.1

Unfortunately, I get the same attempt to recreate, so looks like it's a slightly different one:

  # aws_organizations_account.test will be created
  + resource "aws_organizations_account" "test" {
      + arn               = (known after apply)
      + close_on_deletion = false
      + email             = (sensitive)
      + id                = (known after apply)
      + joined_method     = (known after apply)
      + joined_timestamp  = (known after apply)
      + name              = "Test"
      + parent_id         = (known after apply)
      + status            = (known after apply)
      + tags_all          = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label May 14, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
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 Jul 14, 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. service/organizations Issues and PRs that pertain to the organizations service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

2 participants