Open EugenKon opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
What adds to confusion is my experience, that cidr_blocks
can only contain only 1 entry in the list. For multiple items apply operation fails. AWS API does not seem to really support multiple CIDR entries in security group rule object. You must create multiple security group rule resources.
I have these thoughts related to this:
list
in the first place?list
(backward-compat?), it would be great to reflect the limitation with validation of the input already in TF module.References:
For my project I did this and it works fine:
cidr_blocks = split(",", var.allowlist_ip)
Where allowlist_ip = "1.1.1.1/32,2.2.2.2/32"
@EugenKon, thanks for your angle.
I looked at sources and it seems TF module supports multiple items to be passed as list. It seems that AWS API accepts comma separated string as input, but internally it creates multiple SG rules from this input.
Where I hit the issue was subsequent change of codebase, where I added more items to the list. From TF data model it seemed like multiple CIDRS are attribute of 1 SG rule object, but in reality multiple SG rules were created. TF does not seem to handle this situation.
@EugenKon I believe if you changed the allowlist_ip
your apply would fail. What is your experience?
@michal-zubac-auriga I'll check that when possible.
Documentation Link
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule#example-usage
Description
What is the docs issue?
It is not clear how to provide cidr_blocks.
should it be
["0.0.0.0/0, 192.168.0.0/16"]
or["0.0.0.0/0", "192.168.0.0/16"]
Proposal
Provide example how it should look like.
References
No response
Would you like to implement a fix?
None