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_msk_cluster resource doesn't save arn to state when available #21528

Closed
Tzrlk opened this issue Oct 28, 2021 · 3 comments
Closed

aws_msk_cluster resource doesn't save arn to state when available #21528

Tzrlk opened this issue Oct 28, 2021 · 3 comments
Labels
bug Addresses a defect in current functionality. eventual-consistency Pertains to eventual consistency issues. service/kafka Issues and PRs that pertain to the kafka service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. timeouts Pertains to timeout increases.

Comments

@Tzrlk
Copy link

Tzrlk commented Oct 28, 2021

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 1.0.9
Aws provider: 3.63.0

Affected Resource(s)

  • aws_msk_cluster

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_msk_cluster" "Kafka" {
  timeouts {
    create = "5min"
  }
  #...etc
}

Debug Output

Panic Output

Expected Behavior

While my specific timeout was due to AWS session token expiry, when creation of a new msk cluster resource is triggered, it should store the resulting ARN in the state as soon as it's available. If there's an error during the process, the resource can be tainted, but can later be refreshed if re-attempted or manually fixed.

Actual Behavior

When the timeout stops the creation process, it doesn't store the arn, so terraform is unaware that it has actually created the resource. Subsequent apply operations complain about a name conflict.

Steps to Reproduce

  1. Take a working msk creation configuration.
  2. Either set the create timeout or aws session duration to something impossible.
  3. terraform apply
  4. Observe the timeout error, and that the resource is in a "Creating" state in the console.
  5. terraform apply
  6. Observe the name conflict

Important Factoids

non-automatically renewable AWS session duration

References

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/kafka Issues and PRs that pertain to the kafka service. labels Oct 28, 2021
@Tzrlk
Copy link
Author

Tzrlk commented Oct 28, 2021

Able to work-around the issue by using terraform import aws_msk_cluster.Kafka <arn> after the failure.

@justinretzolk justinretzolk added bug Addresses a defect in current functionality. eventual-consistency Pertains to eventual consistency issues. timeouts Pertains to timeout increases. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 28, 2021
@bflad
Copy link
Contributor

bflad commented Jan 4, 2023

Related: hashicorp/terraform-plugin-sdk#330 -- essentially Terraform does not provide provider resources the ability to not taint a resource on creation error. If the resource is tainted due to an error after the creation, but while waiting for the creation to complete, the resource can be untainted via the terraform untaint command to prevent the need to import it.

I'm not aware off the top of my head if saving Computed attribute values in the response will be preserved in state in this situation (attempting to reference the id attribute instead of the arn attribute can determine what happens in this failure mode since the id attribute is set before raising the error), however the provider developers can consider a d.Set("arn", output.ClusterArn) near

d.SetId(aws.StringValue(output.ClusterArn))
if setting computed attributes does happen to work.

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 Dec 24, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2025
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. eventual-consistency Pertains to eventual consistency issues. service/kafka Issues and PRs that pertain to the kafka service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. timeouts Pertains to timeout increases.
Projects
None yet
Development

No branches or pull requests

3 participants