AWS doesn't pick the zone from terraform when creating aurora rds

440 Views Asked by At

Currently we have a requirement of creating both AWS Instance and Aurora RDS instance in a same availability zone. But we noticed that only for RDS instance it doesn't pick the giving availability zone. i.e : When we pass a zone ( eu-west-2a ) via the attribute "availability_zones" inside the terraform resource "aws_rds_cluster" the rds instance creates in another zone (eu-west-2b). This is common for any time regardless the "count" value.

We pass the zone name as a "list" variable in runtime. i.e :

TF_VAR_rds_aval_zones='[\"eu-west-2a\"]' terraform apply -var 'region=${env.region}'

Terraform Output :

.....
  apply_immediately:                 "" => "<computed>"
  availability_zones.#:              "" => "1"
  availability_zones.3230292939:     "" => "eu-west-2a"
  backup_retention_period:           "" => "1"
.....

( But instance creates in "eu-west-2b". There are no any warnings in terraform output )

Getting Subnet IDs for RDS (in Aurora Module) :

subnet_az1 = "${data.terraform_remote_state.vpc_state.private_subnets[0]}"
subnet_az2 = "${data.terraform_remote_state.vpc_state.private_subnets[1]}"
0

There are 0 best solutions below