You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When ansible using this inventory plugin is kicked by terraform it crashes with weird error (see example below).
At the same time when you run exactly the same command from CLI you see no error.
This is caused by environment variable "panic cookie" set by Terraform, apparently it produces extra debug output and this affects parsing of JSON.
Probably unsetting this environment variable will fix the issue.
$ cccf35992f8f3cd8d1d28f0109dd953e26664531="7c28215aca87789f95b406b8dd91aa5198406750" TF_STATE=./ ./terraform-inventory --inventory | head
Error reading Terraform state: 0.12 format error: invalid character 'o' looking for beginning of value; pre-0.12 format error: invalid character 'o' looking for beginning of value (nil error means no content/modules found in the respective format)
Output of terraform state pull with panic cookie enabled:
$ cccf35992f8f3cd8d1d28f0109dd953e26664531="7c28215aca87789f95b406b8dd91aa5198406750" terraform state pull | head
2019/09/06 19:34:08 [INFO] Terraform version: 0.12.6
2019/09/06 19:34:08 [INFO] Go runtime version: go1.12.7
2019/09/06 19:34:08 [INFO] CLI args: []string{"terraform", "state", "pull"}
2019/09/06 19:34:08 [INFO] CLI command args: []string{"state", "pull"}
2019/09/06 19:34:08 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/09/06 19:34:08 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/09/06 19:34:08 [DEBUG] New state was assigned lineage "a43f3371-a47c-9629-e2cd-8cca70912403"
2019/09/06 19:34:08 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
2019/09/06 19:34:08 [TRACE] Meta.Backend: instantiated backend of type <nil>
2019/09/06 19:34:08 [DEBUG] checking for provider in "."
2019/09/06 19:34:08 [DEBUG] checking for provider in "/usr/local/bin"
2019/09/06 19:34:08 [DEBUG] checking for provider in ".terraform/plugins/darwin_amd64"
2019/09/06 19:34:08 [DEBUG] found provider "terraform-provider-aws_v2.25.0_x4"
2019/09/06 19:34:08 [DEBUG] found provider "terraform-provider-template_v2.1.2_x4"
2019/09/06 19:34:08 [DEBUG] checking for provisioner in "."
2019/09/06 19:34:08 [DEBUG] checking for provisioner in "/usr/local/bin"
2019/09/06 19:34:08 [DEBUG] checking for provisioner in ".terraform/plugins/darwin_amd64"
2019/09/06 19:34:08 [TRACE] Meta.Backend: backend <nil> does not support operations, so wrapping it in a local backend
2019/09/06 19:34:08 [TRACE] backend/local: state manager for workspace "default" will:
- read initial snapshot from terraform.tfstate
- write new snapshots to terraform.tfstate
- create any backup at terraform.tfstate.backup
2019/09/06 19:34:08 [TRACE] statemgr.Filesystem: reading initial snapshot from terraform.tfstate
2019/09/06 19:34:08 [TRACE] statemgr.Filesystem: read snapshot with lineage "68688936-c608-6e3d-41d7-e0dbdde6deb2" serial 66
o:{
"version": 4,
"terraform_version": "0.12.6",
"serial": 66,
"lineage": "68688936-c608-6e3d-41d7-e0dbdde6deb2",
"outputs": {
"XXXXX": {
"value": [
"18.130.128.80",
"3.10.63.11",
The text was updated successfully, but these errors were encountered:
timurb
changed the title
Inventory crashes when magic cookie is defined
Inventory crashes when panic cookie is defined
Sep 6, 2019
When ansible using this inventory plugin is kicked by terraform it crashes with weird error (see example below).
At the same time when you run exactly the same command from CLI you see no error.
This is caused by environment variable "panic cookie" set by Terraform, apparently it produces extra debug output and this affects parsing of JSON.
Probably unsetting this environment variable will fix the issue.
Steps to reproduce
This works fine:
This crashes:
Output of
terraform state pull
with panic cookie enabled:The text was updated successfully, but these errors were encountered: