Hello,
I’ve cloned the RDS learning example:
After successfully applying the code, the name of the db_subnet_group get’s changed.
resource "aws_db_subnet_group" "education" {
name = "helloeducation"
subnet_ids = module.vpc.public_subnets
tags = {
Name = "Education"
}
}
The terraform plan
shows that the db_subnet_group has to be recreated.
Terraform will perform the following actions:
# aws_db_instance.education will be updated in-place
~ resource "aws_db_instance" "education" {
~ db_subnet_group_name = "education" -> "helloeducation"
id = "education"
name = ""
tags = {}
# (49 unchanged attributes hidden)
}
# aws_db_subnet_group.education must be replaced
-/+ resource "aws_db_subnet_group" "education" {
~ arn = "arn:aws:rds:eu-west-1:394197307369:subgrp:education" -> (known after apply)
~ id = "education" -> (known after apply)
~ name = "education" -> "helloeducation" # forces replacement
+ name_prefix = (known after apply)
tags = {
"Name" = "Education"
}
# (2 unchanged attributes hidden)
}
Plan: 1 to add, 1 to change, 1 to destroy.
Howerver terraform apply
notices that the RDS database is still using this db_subnet_group, so it cannot be recreated.
aws_db_subnet_group.education: Destroying... [id=education]
Error: InvalidDBSubnetGroupStateFault: Cannot delete the subnet group 'education' because at least one database instance: education ill using it.
status code: 400, request id: caxxxxxxxxxxxxxxxfb7a6
Therefore I’d expect that terraform would also include recreation of the RDS, no?
As per my understanding the parameter should also be flagged with ForceNew: True
in
Thanks&Best