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 variable – This value does not have any attributes

having problems with a terraform variable use on a resource:

resource "mso_schema" "on_prem_and_aws" {
  name          = var.hybrid_schema.name
  template_name = var.hybrid_schema.template_name
  tenant_id     = mso_tenant.demo_tenant.id 
}

on the .tf vars file i have:

variable "hybrid_schema" {
  type    = string
  default = "streched"
}

Its giving the 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 schema.tf line 25, in resource "mso_schema" "on_prem_and_aws":
25: name = var.hybrid_schema.name

This value does not have any attributes.

Error: Unsupported attribute

on schema.tf line 26, in resource "mso_schema" "on_prem_and_aws":
26: template_name = var.hybrid_schema.template_name

This value does not have any attributes.

What am i missing here?

Thanks in advance!!

>Solution :

Your hybrid_schema is just a string value. If you want it to be map with keys of name and template_name it should be:

variable "hybrid_schema" {
  default = {
     name = "some name"
     template_name = "template name"
  }
}
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