Terraform Plan UI & EU-West-1 issues

0

Enter image description here Hello, Per the attached, when I ran the terraform plan for AZ EU-West-1, I get that error.

Kindly assist. Oluwasegun Ojeyinka

asked a year ago239 views
4 Answers
1

Hi Ojeyinka,

how many subnets are you passing in the aws_db_subnet_group resource?

Make sure you pass at least 2 subnets

resource "aws_db_subnet_group" "default" {
  name       = "main"
  subnet_ids = [aws_subnet.frontend.id, aws_subnet.backend.id]

  tags = {
    Name = "My DB subnet group"
  }
}

Hope it helps, and if it does I 'd appreciate answer to be accepted so that community can benefit for clarity when searching for similar issues, thanks!

profile picture
EXPERT
answered a year ago
  • @alatech, this is my entire code block RDS subnet script: resource "aws_db_subnet_group" "ACS-rds" { name = "acs-rds" subnet_ids = var.private_subnets

    tags = merge( var.tags, { Name = "ACS-database" }, ) }

    create the RDS instance with the subnets group

    resource "aws_db_instance" "ACS-rds" { allocated_storage = 20 storage_type = "gp2" engine = "mysql" engine_version = "5.7" instance_class = "db.t2.micro" name = "daviddb" username = var.db-username password = var.db-password parameter_group_name = "default.mysql5.7" db_subnet_group_name = aws_db_subnet_group.ACS-rds.name skip_final_snapshot = true vpc_security_group_ids = var.db-sg multi_az = "true" }

  • Hi, what is the content of private_subnets? It must be an array, can you share?

0

I think there is an error in the subnet you are trying to create in the RDS Subnet Group.

  1. please check if the subnets configured in the subnet group are 2AZ or more.
  2. if it is configured with more than 2AZ, please check if each subnet is in an available AZ.

The following command will tell you if it is available or not

aws ec2 describe-availability-zones --region eu-west-1
profile picture
answered a year ago
0

@takakuni, Thank you for the response. This is my entire code block resource "aws_db_subnet_group" "ACS-rds" { name = "acs-rds" subnet_ids = var.private_subnets

tags = merge( var.tags, { Name = "ACS-database" }, ) }

create the RDS instance with the subnets group

resource "aws_db_instance" "ACS-rds" { allocated_storage = 20 storage_type = "gp2" engine = "mysql" engine_version = "5.7" instance_class = "db.t2.micro" name = "daviddb" username = var.db-username password = var.db-password parameter_group_name = "default.mysql5.7" db_subnet_group_name = aws_db_subnet_group.ACS-rds.name skip_final_snapshot = true vpc_security_group_ids = var.db-sg multi_az = "true" }

answered a year ago
0

Hi @Oluwasegun,

I believe the part that corresponds to var.private_subnets contains the subnet IDs in list form. The subnet group requires at least two Availability Zones to be in use by a group of subnets. From the error code, I think var.private_subnets consists only of eu-west-1c. Try the following command for the subnet ID to check the Availability Zone.

aws ec2 describe-subnets --subnet-ids YOUR_SUBNET_ID --query [Subnets[].AvailabilityZone,Subnets[].SubnetId]
profile picture
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions