Open tbernacchi opened 1 year ago
Voting for Prioritization
Volunteering to Work on This Issue
Even on compacted cidrs it fails. Context: variable for the port number.
I did get the same error message for what's likely to be a completely different issue. The first thing I did was to check whether my rule was sharing cidr_blocks, source port, destination port, and protocol with any other rule but that was not the case. By concatenating several lists together, I ended up with a duplicate ip/netmask in the cidr_blocks. Wrapping it with a toset() solved it for me.
I did get the same error message for what's likely to be a completely different issue. The first thing I did was to check whether my rule was sharing cidr_blocks, source port, destination port, and protocol with any other rule but that was not the case. By concatenating several lists together, I ended up with a duplicate ip/netmask in the cidr_blocks. Wrapping it with a toset() solved it for me.
This worked for me.. quite triggering i am not even sure how you worked this out as the error messages is not meaningful
Old Code:
cidr_blocks = concat(
[for subnet_cidr in data.aws_subnet.private_subnets : subnet_cidr.cidr_block],
[for subnet_cidr in data.aws_subnet.public_subnets : subnet_cidr.cidr_block],
var.corporate_cidrs
)
Fix
cidr_blocks = toset(concat(
[for subnet_cidr in data.aws_subnet.private_subnets : subnet_cidr.cidr_block],
[for subnet_cidr in data.aws_subnet.public_subnets : subnet_cidr.cidr_block],
var.corporate_cidrs
))
Terraform Core Version
Terraform v1.3.6 on darwin_amd64
AWS Provider Version
AWS
Affected Resource(s)
Facing same issue describe here: https://github.com/hashicorp/terraform-provider-aws/issues/1506
Expected Behavior
Create the appropriate SG on AWS.
Actual Behavior
Not creating.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
https://gist.github.com/tbernacchi/b574c3623ce98364a97afadf8257b556
Steps to Reproduce
terraform plan --out=plan terraform apply "plan"
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group
Would you like to implement a fix?
No