0

I'm attempting to create an AWS RDS Serverless v2 cluster in region ap-southeast-2 (Sydney) using the following Terraform configuration:

provider "aws" {
  region = "ap-southeast-2"
}

data "aws_availability_zones" "available" {
  state = "available"
}

resource "aws_rds_cluster" "backend_app_db_cluster" {
  availability_zones = data.aws_availability_zones.available.names
  # ...
}

When I try to apply this configuration, I get the following error:

InvalidVPCNetworkStateFault: Availability zone '[ap-southeast-2c]' is unavailable in this region, please choose another zone set.

Full output:

module.database.aws_rds_cluster.backend_app_db_cluster: Creating...
╷
│ Error: creating RDS Cluster (<munged>20221204221217538100000001): InvalidVPCNetworkStateFault: Availability zone '[ap-southeast-2c]' is unavailable in this region, please choose another zone set.
│   status code: 400, request id: <munged>
│
│   with module.database.aws_rds_cluster.backend_app_db_cluster,
│   on modules/database/main.tf line 54, in resource "aws_rds_cluster" "backend_app_db_cluster":
│   54: resource "aws_rds_cluster" "backend_app_db_cluster" {

If I specify the availability zones manually and specifically exclude ap-southeast-2c, it works as expected:

data "aws_availability_zones" "available" {
  exclude_names = ["ap-southeast-2c"]
  state         = "available"
}
$ terraform apply
...
module.database.aws_rds_cluster_instance.backend_app_db_cluster_instance: Creation complete after 12m43s [id=tf-<munged>]

Apply complete! Resources: 3 added, 0 changed, 1 destroyed.

Why is aws_availability_zones returning an AZ that's unavailable?

1 Answer 1

2

Do you have a subnet in ap-southwest-2c? In order to build the the Subnet group for RDS you have to have subnets in all AZs. If you don't have, Terraform throws this error received from API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.