/*
DB Subnets
*/
resource "aws_db_subnet_group" "dbsng01dat01ppew${var.environmentnumber}x" {
name = "dbsng01dat01ppew${var.environmentnumber}x"
description = "RDS - Postgres - Preprod ${var.environmentnumber}"
tags {
Name = "RDS - Postgres"
}
}
/*
RDS
*/
resource "aws_db_instance" "rd01dat00" {
allocated_storage = 100
engine = "postgres"
engine_version = "9.3.2"
instance_class = "${var.rd01class}"
identifier = "rd01dat00ppdew${var.environmentnumber}x"
# Username and password storage here is sub optimal. Should replace this step with a replicate_source_db removing the need for this
username = "${var.pguser}"
password = "${var.pgpass}"
db_subnet_group_name = "dbsng01dat01ppew${var.environmentnumber}x"
# parameter_group_name = ""
}
That's the relevant code (I think); the failure is :
* aws_db_instance.rd01dat00: Error creating DB Instance: DBSubnetGroupNotFoundFault: DBSubnetGroup 'dbsng01dat01ppew3x' not found.
If I rerun the terraform apply, it sees the group (which has been successfully created), and it works.
Anyone else seeing this behaviour, or am I doing something daft?
Thanks
Graham Nicholls