Terraform: config in json format (config.tf.json) does not work

Created on 21 Mar 2017  ยท  2Comments  ยท  Source: hashicorp/terraform

Terraform Version

Terraform v0.9.1

Affected Resource(s)

  • terraform config

Terraform Configuration Files

{
    "terraform": {
        "backend": {
            "s3": {
                "bucket": "jerome-dev",
                "key": "terraform-backend/1/1/tfstate",
                "region": "us-west-2",
                "lock_table": "DynamoDBTABLE"
            }
        }
    }
}

Expected Behavior

s3 as backend should work

Actual Behavior

  • defaults to local backend instead of s3
  • equivalent HCL form works

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. create config.tf.json
  2. terraform init
  3. terraform apply
bug core

Most helpful comment

It works if you wrap the value of "terraform" and "backend" in array brackets [.

This is still a bug, but just noting you can get it to work now.

{
    "terraform": [{
        "backend": [{
            "s3": {
                "bucket": "jerome-dev",
                "key": "terraform-backend/1/1/tfstate",
                "region": "us-west-2",
                "lock_table": "DynamoDBTABLE"
            }
        }]
    }]
}

All 2 comments

It works if you wrap the value of "terraform" and "backend" in array brackets [.

This is still a bug, but just noting you can get it to work now.

{
    "terraform": [{
        "backend": [{
            "s3": {
                "bucket": "jerome-dev",
                "key": "terraform-backend/1/1/tfstate",
                "region": "us-west-2",
                "lock_table": "DynamoDBTABLE"
            }
        }]
    }]
}

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 this page helpful?
0 / 5 - 0 ratings

Related issues

franklinwise picture franklinwise  ยท  3Comments

rkulagowski picture rkulagowski  ยท  3Comments

rjinski picture rjinski  ยท  3Comments

c4milo picture c4milo  ยท  3Comments

zeninfinity picture zeninfinity  ยท  3Comments