I’m getting an error for a duplicate security grou...
# general
t
I’m getting an error for a duplicate security group for a static ingress array that never changes. The source code:
Copy code
const loadBalancerSecurityGroup = new aws.ec2.SecurityGroup(name + '-load-balancer-sg', {
  tags,
  vpcId: vpc.id,
  egress: [
    {
      protocol: 'tcp',
      fromPort: port,
      toPort: port,
      cidrBlocks: ['0.0.0.0/0']
    }
  ],
  ingress: [
    {
      protocol: 'tcp',
      fromPort: 80,
      toPort: 80,
      cidrBlocks: ['0.0.0.0/0']
    },
    {
      protocol: 'tcp',
      fromPort: 443,
      toPort: 443,
      cidrBlocks: ['0.0.0.0/0']
    }
  ]
})
The errors:
Copy code
* [WARN] A duplicate Security Group rule was found on (sg-XYZ). This may be
a side effect of a now-fixed Terraform issue causing two security groups with
identical attributes but different source_security_group_ids to overwrite each
other in the state. See <https://github.com/hashicorp/terraform/pull/2376> for more
information and instructions for recovery. Error: InvalidPermission.Duplicate: the specified rule "peer: 0.0.0.0/0, TCP, from port: 80, to port: 80, ALLOW" already exists
	status code: 400, request id: d1bceeb0-9183-4877-9018-539e1bd6835d

error: 1 error occurred:
	* [WARN] A duplicate Security Group rule was found on (sg-XYZ). This may be
a side effect of a now-fixed Terraform issue causing two security groups with
identical attributes but different source_security_group_ids to overwrite each
other in the state. See <https://github.com/hashicorp/terraform/pull/2376> for more
information and instructions for recovery. Error: InvalidPermission.Duplicate: the specified rule "peer: 0.0.0.0/0, TCP, from port: 443, to port: 443, ALLOW" already exists
	status code: 400, request id: e69a1967-7418-42d7-8c71-39061f4db122
Any ideas? I’ve reviewed the issue that was linked but it seems unrelated as I’m not specifying any security groups in the rules.