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

Index issue while removing object in between of list #245

Closed
kapil1699 opened this issue Jul 22, 2022 · 4 comments
Closed

Index issue while removing object in between of list #245

kapil1699 opened this issue Jul 22, 2022 · 4 comments

Comments

@kapil1699
Copy link

Issue: I havr created SG with 4 inbound rules. variables for inbound rules is list in module.

Now if I am removing 1st inbound rule from list the terraform is saying tha it is going to destroy and create replacement.

Because now 2nd inbound rule comes to 1st in list that is the reason terraform is throwing that error.

How we can avoid this and remove safly without touching othet inbound rules.

Note: I have 100+ inbound rule if I remove in between from list then it could create big problem of recreation.

I found one solution of using terraform state mv but moving each time by running 100+ command seems tedious.

Please suggest.

@OuFinx
Copy link

OuFinx commented Aug 4, 2022

Agree with @kapil1699
I have the same troubles

@SolidSly
Copy link
Contributor

In my opinion, the solution of this problem will be to switch the ingress / egress rules to a for_each system instead of using a list. However, this means that a part of the module should be updated to support this new pattern.

@antonbabenko
Copy link
Member

@SolidSly You are right. We will have to do such an update and major rewrite of this module in the upcoming months. We already did it in some other modules under the terraform-aws-modules organization.

I am going to close this issue for now.

@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 Nov 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants