-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_cloudformation_stack: template_body not interpolated? #5462
Comments
Hi @alsonkemp - sorry for the trouble here. I just did a quick local test and was unable to reproduce the uninterpolated template_body on my first couple of tries. Here's the test config I'm working with: resource "template_file" "networkstack" {
template = <<STACK
{
"Resources" : {
"MyVPC": {
"Type" : "AWS::EC2::VPC",
"Properties" : {
"CidrBlock" : "10.0.0.0/16",
"Tags" : [
{"Key": "Name", "Value": "Primary_CF_VPC"}
]
}
}
},
"Outputs" : {
"DefaultSgId" : {
"Description": "The ID of default security group",
"Value" : { "Fn::GetAtt" : [ "MyVPC", "DefaultSecurityGroup" ]}
},
"VpcID" : {
"Description": "The VPC ID",
"Value" : { "Ref" : "MyVPC" }
}
}
}
STACK
}
resource "aws_cloudformation_stack" "network" {
name = "tf-networking-stack"
template_body = "${template_file.networkstack.rendered}"
} Do you see any differences between that test config and yours that might be key to reproducing this bug? |
@phinze The thick plottens... I have the same error when running your sample. FWIW, I'm on Debian Testing (and fairly up-to-date). See below. template_body: "" => "Error parsing JSON: invalid character '$' looking for beginning of value"
|
I'll try this in the Vagrant VM... |
I had the same failure in the Vagrant VM.
|
I was able to reproduce this and I have a strong feeling (admittedly I can't confirm) it can be solved via #4961 It was reproduced with I reckon it's just race condition - if you're lucky (and |
@radeksimko Might be a race condition, but, across 3 machines, I've hit it on 100% of runs. Do you know of any workarounds? On a second note, why does aws_cloudformation_stack swallow the template error? |
@phinze Can you provide any indications of where the bug might be? I'm not a golang-nut, but I might be able to help. |
Still no repro here - @alsonkemp can you confirm you hit this on 0.6.14 as well? |
@phinze You were not able to get my repro from #5462 (comment) to work? I have not re-tried against 0.6.14. I will do so soon. |
Still seeing the same error.
template_body: "" => "Error parsing JSON: invalid character '$' looking for beginning of value"** |
See #3076 which I believe is caused by the same bug. |
Can confirm that I am seeing this with 0.6.15 too - plan errors parsing the JSON but the apply succeeds and is using the correct policy |
This is fixed on master as I also can't reproduce the exact copy/paste example above (even using the deprecated template_file resource). Closing! |
I found this issue today, when I'm trying to populate "template_body" of the resource, "azurerm_template_deployment", with the rendered content of a template. The plan failed with the message, "Error parsing JSON: invalid character '$' looking for beginning of value", but the apply succeded. |
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. |
I'm on 0.6.12. I have the following resource:
I'm getting JSON errors, so I added a debug printf to terraform's normalizeJson to see how I had messed up the JSON. The printf yielded the following:
So it appears that the template_body was not interpolated?
The text was updated successfully, but these errors were encountered: