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:
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"
}
}