Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Terraform rds-aws Unsupported attribute "name"

I use terraform-aws-modules/rds/aws as source to a "db" module, that is used by my other database modules as source. Without any code changes to those parts, I’m receiving an error when trying to Plan with Terraform. I’ll give the details below.

I’m running the following module with terraform-aws-modules/rds/aws

module "db" {
  source  = "terraform-aws-modules/rds/aws"
  version = "~> 4.2"

  identifier = var.name

  allocated_storage = var.storage

  db_name  = replace(var.name, "-", "")
 
  ...other fields
}

but when terraform tries to Plan, I receive this error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Error: Unsupported attribute

on .terraform/modules/my-db.db/modules/db_instance/outputs.tf line 63, in output "db_instance_name":
63: value = try(aws_db_instance.this[0].name, "")

This object has no argument, nested block, or exported attribute named
│ "name".

I assume this has to do with "name" being deprecated in aws_db_instance. But I’m not using aws_db_instance, so my guess is that it is actually being used by terraform-aws-modules/rds/aws. I have already updated versions, but nothing seems to work…

>Solution :

"I assume this has to do with "name" being deprecated in aws_db_instance. But I’m not using aws_db_instance"

That’s not true. The module you are using most certainly is using aws_db_instance.

module "db" {
 source  = "terraform-aws-modules/rds/aws"
 version = "~> 4.2"

I have already updated versions, but nothing seems to work…

You haven’t updated the module. Version 4.2 is several major versions behind. The latest version of that module, as of the time I’m posting this answer, is 6.1.1

You will need to update to a newer version of the Terraform module to fix the error you are seeing.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading