Moving all security group rules to separate resources #63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
IMPORTANT NOTE:
after this PR for updating the version of the module need some tricks, due to some Terraform bugs and AWS limitation
Terraform output
Terraform bugs
Terraform has a knows bug it can't remove inline ingress or egress from the
aws_security_group
resource, more about this issue:So all separate rules will conflict with existing inline rules, the only way to fix it currently is to change the Name of Description on Security Group which trigger recreating and truncate inline rules, but is connected to another problem - AWS limitation
AWS limitation
AWS has a couple of resources that are available to the user in view mode but managed by AWS and there is no way to control it by Terraform. In this case, this is a Network Interface that is assigned to Subnets. Each Network Interface has connectivity with a Security Group as dependencies, more about this issue:
Solution
A possible way to solve it and update an existing cluster is re-creating a VPC. This will trigger a replacing ALL network resources but leave untouched other module resources. One of the ways to achieve this, temporary change the CIDR of the network which is assigned to the Vault cluster (after that you can return back after the next apply)