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

질문됨 일 년 전239회 조회
4개 답변
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
전문가
답변함 일 년 전
  • @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
답변함 일 년 전
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" }

답변함 일 년 전
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
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠