I'm trying to create a new AWS RDS instance thru Terraform, but I'm has been receiving a strange error as below snippet:
resource "aws_db_subnet_group" "sng_marketplace_stg" {
name = "sng-marketplace-stg"
tags = { Name = "Marketplace Staging" }
subnet_ids = [
"${aws_subnet.sbn_1_us.id}",
"${aws_subnet.sbn_2_us.id}"
]
}
resource "aws_db_instance" "marketplace_staging" {
identifier = "db-marketplace-stg-staging"
engine = "postgres"
engine_version = "12.4"
# ...
# omitted
# ...
db_subnet_group_name = "${aws_db_subnet_group.sng_marketplace_stg.id}"
}
-
- The 1st group creates a subnet group called
sng-marketplace-stgthis step is ok, and TF can apply.
- The 1st group creates a subnet group called
-
- The 2nd step raise error a
Error creating DB Instance: DBSubnetGroupNotFoundFault: DBSubnetGroup 'sng-marketplace-stg' not found.
- The 2nd step raise error a
Well, when I access AWS Console RDS the subnet group has been created, as expected, but if I rerun the TF apply (or plan) the terraform show the correct change (create new RDS instance), but when applied, the error is raised again, like if the subnet group not exist.
Anybody saw this error before or any suggestion to fix it?
Thank 4 any help or direction to solution.
The complete error trace here:
Error: Error applying plan:
1 error occurred:
* aws_db_instance.marketplace_staging: 1 error occurred:
* aws_db_instance.marketplace_staging: Error creating DB Instance: DBSubnetGroupNotFoundFault: DBSubnetGroup 'sng-marketplace-stg' not found.
status code: 404, request id: da567898-...