Ensure all EIP addresses allocated to a VPC are attached to EC2 instances

Error: Not all EIP addresses allocated to a VPC are attached to EC2 instances

Bridgecrew Policy ID: BC_AWS_NETWORKING_48
Checkov Check ID: CKV2_AWS_19
Severity: LOW

Not all EIP addresses allocated to a VPC are attached to EC2 instances

Description

TBA

Fix - Buildtime

Terraform

  • Resource: aws_eip, aws_instance
  • Argument: instance and vpc of aws_eip
resource "aws_eip" "ok_eip" {
  instance = aws_instance.ec2.id
  vpc      = true
}

resource "aws_instance" "ec2" {
  ami               = "ami-21f78e11"
  availability_zone = "us-west-2a"
  instance_type     = "t2.micro"

  tags = {
    Name = "HelloWorld"
  }
}

Did this page help you?