Problem is exhibited with all defined local variables.
v0.11.0
From the terraform documentation for local variables:
```# Define the common tags for all resources
locals {
common_tags = {
Component = "awesome-app"
Environment = "production"
}
}
resource "aws_instance" "server" {
ami = "ami-123456"
instance_type = "t2.micro"
tags = "${merge(
local.common_tags,
map(
"Name", "awesome-app-server",
"Role", "server"
)
)}"
}
### Expected Behavior
Terraform has been successfully initialized!
### Actual Behavior
```# terraform11 init
Error loading configuration: Error loading /tmp/local2/main.tf: Error reading config for aws_instance[server]: local.common_tags: resource variables must be three parts: TYPE.NAME.ATTR in:
${merge(
local.common_tags,
map(
"Name", "awesome-app-server",
"Role", "server"
)
)}
Create a .tf file with the above example lines and run terraform init
Hi @tburt11,
Are you certain that this is the exact config you used to reproduce the issue? Using that config exactly as written doesn't produce any errors for me.
@jbardin Hmm... I installed the v0.11.0 on a fresh macbook, and it works OK.
Must be something in my working environment. I will do further testing next week.
Thanks!
Closing - User Error..
did you ever figure out what the issue was? I am seeing this same thing and can't figure it out...
@tburt11 What was the issue?
I observed this exact error message when accidentally using a terraform binary older than 0.10.3 (0.9.11, in my case) on a configuration which used locals in resource definitions. /cc @pixelicous @repl-chris @tburt11
@sureshgoli81 thx, it was the same issue here..
FYI in case you didn't know, you can add a required Terraform version configuration to ensure you're always running against a version you expect, e.g.
terraform {
required_version = ">= 0.10.3"
}
For those asking: The issue also happens if the user accidentally uses locals.whatever_key_of_your_choice
instead of local.whatever_key_of_your_choice
(note the extraneous S)
I had this error because I forgot to properly reference the field I wanted.
This failed:
records = ["${aws_alb.my_alb}"]
This worked:
records = ["${aws_alb.my_alb.dns_name}"]
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
For those asking: The issue also happens if the user accidentally uses
locals.whatever_key_of_your_choice
instead oflocal.whatever_key_of_your_choice
(note the extraneous S)