Hi,
I am trying to create vpc endpoint for the 1st time using cloud formation stack template in the terraform script, but I am getting the below error. Please help
Terraform Version:0.12.20
resource “aws_cloudformation_stack” “vpc_endpoints” {
name = “{var.ProjectName}-{data.aws_region.current.name}-vpc-endpoints-stack”
template_body = file("${path.module}/1-vpc-endpoints.yml")
parameters = {
VPC = aws_vpc.x_vpc.id
VPCCidrBlock = aws_vpc.x_vpc.cidr_block
PublicSubnetA = aws_subnet.x_public_subnet.id
PrivateSubnetA = aws_subnet.x_private_subnet_a.id
PrivateSubnetB = aws_subnet.x_private_subnet_b.id
PrivateSubnetRouteTable = aws_route_table.private_rt_a.id
PublicSubnetRouteTable = aws_route_table.public_only.id
}
Error: ROLLBACK_COMPLETE: [“The following resource(s) failed to create: [SSMMessagesEndpoint, TrendPrivateHostedZone, SSMEndpoint, TrendEndpoint, EC2MessagesEndpoint]. .
Rollback requested by user.” “Resource creation cancelled” "Found another VPC endpoint subnet in the availability zone of subnet-XXXXX.
“Found another VPC endpoint subnet in the availability zone of subnet-XXXX.
VPC endpoint subnets should be in different availability zones supported by the VPC endpoint service.
(Service: AmazonEC2; Status Code: 400; Error Code: DuplicateSubnetsInSameZone; Request ID: XXXXXX)”.
I have total 3 subnets, 1 public and 2 private. It is saying the public subnet is already having a vpc endpoint. I am new to the terraform and aws. Please help.