Answers: <p>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.</p>
  
Answers: CC BY-SA 4.0
Answers: 2022-12-11T16:02:29.143Z
Answers: 2022-12-11T16:02:29.143Z
Answers: Pawel Piwosz
Body: <p>I'm attempting to create an AWS RDS Serverless v2 cluster in region <code>ap-southeast-2</code> (Sydney) using the following Terraform configuration:</p>
  <pre><code>provider &quot;aws&quot; {
    region = &quot;ap-southeast-2&quot;
  }
  
  data &quot;aws_availability_zones&quot; &quot;available&quot; {
    state = &quot;available&quot;
  }
  
  resource &quot;aws_rds_cluster&quot; &quot;backend_app_db_cluster&quot; {
    availability_zones = data.aws_availability_zones.available.names
    # ...
  }
  </code></pre>
  <p>When I try to <code>apply</code> this configuration, I get the following error:</p>
  <blockquote>
  <p>InvalidVPCNetworkStateFault: Availability zone '[ap-southeast-2c]' is unavailable in this region, please choose another zone set.</p>
  </blockquote>
  <p>Full output:</p>
  <pre><code>module.database.aws_rds_cluster.backend_app_db_cluster: Creating...
  ╷
  │ Error: creating RDS Cluster (&lt;munged&gt;20221204221217538100000001): InvalidVPCNetworkStateFault: Availability zone '[ap-southeast-2c]' is unavailable in this region, please choose another zone set.
  │   status code: 400, request id: &lt;munged&gt;
  │
  │   with module.database.aws_rds_cluster.backend_app_db_cluster,
  │   on modules/database/main.tf line 54, in resource &quot;aws_rds_cluster&quot; &quot;backend_app_db_cluster&quot;:
  │   54: resource &quot;aws_rds_cluster&quot; &quot;backend_app_db_cluster&quot; {
  </code></pre>
  <p>If I specify the availability zones manually and specifically exclude <code>ap-southeast-2c</code>, it works as expected:</p>
  <pre><code>data &quot;aws_availability_zones&quot; &quot;available&quot; {
    exclude_names = [&quot;ap-southeast-2c&quot;]
    state         = &quot;available&quot;
  }
  </code></pre>
  <pre><code>$ terraform apply
  ...
  module.database.aws_rds_cluster_instance.backend_app_db_cluster_instance: Creation complete after 12m43s [id=tf-&lt;munged&gt;]
  
  Apply complete! Resources: 3 added, 0 changed, 1 destroyed.
  </code></pre>
  <p>Why is <code>aws_availability_zones</code> returning an AZ that's unavailable?</p>
  
Tags: <amazon-web-services><terraform><amazon-rds>
Title: aws_availability_zones returns an availability zone ap-southeast-2c that is not available
UserDisplayName: todofixthis
ThreadText: # aws_availability_zones returns an availability zone ap-southeast-2c that is not available
  
  (Asked by: username_0 on 2022-12-04)
  
  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?
  
  **Tags:** amazon-web-services, terraform, amazon-rds
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-12-11. Score: 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.
  
  
  ---
  
  