-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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_db_instance - configured value for vpc_security_group_ids is incorrectly changed during TF plan #41047
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Hey @ktham 👋 Thank you for taking the time to raise this! In this case, the provider is behaving as I would expect. When you add the additional If that is unacceptable in your situation, you can get around this by refactoring your configuration to separate the creation of the security groups and DB instance. Doing so would mean that by the time the change to the DB is being planned, the ID of the new security group is known and will be shown in the plan. Since this is a behavior that the AWS provider is unable to control, and can be solved by refactoring the configuration, I'm going to close this issue. If you run into any other unexpected behavior, please do let us know! |
Warning This issue has been closed, meaning that any additional comments are hard for our team to see. 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. |
Hi @justinretzolk , I believe you have prematurely closed the issue. It is true that the full set cannot be known until apply time but I believe you have the incorrect understanding of expected Terraform behavior. Please see the linked issues. |
cc @jbardin and @apparentlymart |
Posting here for better clarity - @jbardin mentioned in hashicorp/terraform#36221 that Terraform Core currently does what I am asking for above
Results in the plan:
However, the So in other words, Terraform is expected to be able to render the full detail of a partially-unknown set if the provider is indeed providing one, and it seems like the AWS provider isn't currently doing that here for |
Terraform Core Version
1.7.5
AWS Provider Version
5.84.0
Affected Resource(s)
Note: My examples are for
aws_db_instance
, but the same problem also applies toaws_rds_cluster
Expected Behavior
We should expect to see Terraform plan output that looks like this when a new security group is added to
vpc_security_group_ids
Actual Behavior
However, the
aws_db_instance
resource is doing something unexpected, we instead see this👉 👉
sg-46c08c0f
should be retained, but in the plan renderer, what we're seeing is that thevpc_security_group_ids
list as a whole is being replaced with an unknown value.This is very concerning behavior because it gives the impression that the AWS provider might potentially be revoking security group IDs that we expect to be retained.
Terraform Configuration Files
Terraform configuration (step 1)
Terraform configuration (step 2)
Steps to Reproduce
Run terraform apply for step 1 Terraform configuration, then run terraform apply for step 2 configuration from above.
References
This is not a problem with Terraform Core, but a problem with the provider itself.
Please See:
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: