Closed crysyn closed 5 years ago
Seems to be the same issue I just reported also https://github.com/hashicorp/terraform/issues/20362
Does indeed, Reported it yesterday under another similar issue and was just reposting it as a root issue
Hi @crysyn,
Thanks for the crash report. Can you share how you got the cash with a 0.12 build?
It looks like the problem is that tags
is a map, while the config shown here is a list of maps. That may have done some strange things in 0.11, but 0.12 should catch the error very early on while decoding the config.
This is the output from master:
Error: Incorrect attribute value type
on main.tf line 10, in resource "aws_ecs_task_definition" "task-definition":
10: tags = ["${merge(map("Type", "Task-Definition"), local.common-tags)}"]
Inappropriate value for attribute "tags": map of string required.
Wow, how did I miss this was in the tags and not the json file..
In any case, here is how the local.common-tags is built up
{
common-tags = "${map(
"Owner", "${var.owner-name}",
"Project", "${var.project-name}",
"Environment", "${var.environment-name}",
"Name", "${local.project-env-name}"
)}"
project-env-name = "${var.project-name}-${var.environment-name}"
}
This is a tag block I use extensively through out the files to keep everything created targeted at the project they are a part of.. but now that I am thinking back over this there is another area I removed the tags from due to errors being reported for that specific resource. If I can find that again I will include that object as well.
Oh, @jbardin, all I did was download a copy of the v0.12.0-alpha4 and run it from a local folder after wiping out the state (which is what I did in most of my tests between the versions). Sorry I forgot to include this before.
Changing the tags block out to
tags =
{
Owner = "${var.owner-name}"
Project = "${var.project-name}"
Environment = "${var.environment-name}"
Name = "${local.project-env-name}"
}
did get it to accept the tag block if that helps as well.
Sorry, I'm not sure I'm following here. The issue I mentioned isn't with the content of the tags
map, but rather that your original config is assigning a list containing a map to tags
. This would be caught right away in 0.12 and should never get to that panic. In 0.11 the list-of-maps data can sneak through the limited type system, and will produce that panic you've shown.
If you have a config that panics under 0.12, I can verify it against master for you, but I think the underlying issue here is likely solved.
I would say its covered by the error output on master then. it Panic'd on the alpha4.
OK, I'll mark this as resolved then, since it will no longer be possible to feed incorrect data types into the legacy sdk.
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.
Was asked to resubmit this issue on its own.
Terraform Version v0.11.*, v0.12.0-alpha4
Terraform Configuration Files
Crash Output
Expected Behavior
I expect the task definition to be processed properly
Actual Behavior
It panics out on the data format, despite being from the documentation.
Steps to Reproduce
Please list the full steps required to reproduce the issue, for example:
terraform init
terraform plan