-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
migrating from aws_security_group to aws_security_group_rule #7058
Comments
Hi @bernadinm 👋 Each Terraform resource is independent in the sense that it:
The design philosophy here is to prevent you from attempting to manage the same infrastructure in two places. In your case, Terraform is seeing that you are:
The last two have no knowledge of the first and Terraform design philosophies indicate that you need to terraform import module.dcos.module.dcos-infrastructure.module.dcos-security-groups.aws_security_group_rule.internal_ingress_rule sg-03f37cf438fef1b5d_ingress_all_0_65536_172.12.0.0/16
terraform import module.dcos.module.dcos-infrastructure.module.dcos-security-groups.aws_security_group_rule.internal_egress_rule sg-03f37cf438fef1b5d_egress_all_0_65536_0.0.0.0/0 The import section of the The Terraform AWS provider (or any Terraform provider really) is not currently able to change or influence this behavior at this time without upstream enhancements in core code of Terraform since that code handles the relationship of multiple resources. If you would like to see an enhancement to provide a codified way to accomplish moving infrastructure management between resources or giving Terraform the ability to infer the correct behavior in a situation like this, you can file a new issue upstream or potentially check out this similar one: hashicorp/terraform#19354 Hope this helps! |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
This configuration shows that it went from defining all the rules from
aws_security_group
toaws_security_group_rule
as well but removing the previously define rules from within the group, until independent rules.Before
After
Debug Output
Panic Output
Expected Behavior
I've expected for it to review that the required updates were already made and there was nothing that was needed to do and no failure would show.
Actual Behavior
It thought that it needed to add these to the existing security group, even though it already existed.
Steps to Reproduce
terraform apply
terraform apply
and observe halted failureAre there any other GitHub issues (open or closed) or pull requests that should be linked here? Vendor documentation? For example:
--->
The text was updated successfully, but these errors were encountered: