When modifying a VPC to add IPv6 terraform exits with an error that ::/0 egress entry in the default security group already exists #15202
Labels
bug
Addresses a defect in current functionality.
service/ec2
Issues and PRs that pertain to the ec2 service.
I reported it at hashicorp/terraform#26275, but looks like this is the correct place.
When you have an existing VPC that is configured IPv4 only, and then you add
assign_generated_ipv6_cidr_block = true
to the VPC and also adding an entry like this to the default security group:The terraform (tested on 0.13.2) will error out with the following message:
Error: Error authorizing security group egress rules: InvalidPermission.Duplicate: the specified rule "peer: ::/0, ALL, ALLOW" already exists
What I believe is happening, is when I allocate IPv6 CIDR for the VPC, AWS most likely automatically is adding ::/0 to the default security group. Terraform then tries to add that entry and fails. I don't know a good workaround for this, besides rerunning TF twice, because this entry is required to be listed when stack is created from scratch (it correctly won't be there if not specified), but it will throw an error about duplicate when updating existing VPC that's set up to be IPv4 only.
I did the same thing with CloudFormation and it works as expected, both when creating from scratch and updating the stack.
The text was updated successfully, but these errors were encountered: