Terraform: Error: Invalid argument name (Argument names must not be quoted)

Created on 7 Dec 2018  ยท  2Comments  ยท  Source: hashicorp/terraform

After a brew install terraform (installed 0.12.0 dev), this example from the documentation no longer works:

resource "kubernetes_secret" "example" {
  metadata {
    name = "docker-cfg"
  }

  data {
    ".dockerconfigjson" = "${file("${path.module}/.docker/config.json")}"
  }

  type = "kubernetes.io/dockerconfigjson"
}

What is the workaround? This seems like kind of a big problem.

Related: https://github.com/hashicorp/terraform/issues/19240

terraform init
2018/12/07 13:05:46 [INFO] Terraform version: 0.12.0 dev
2018/12/07 13:05:46 [INFO] Go runtime version: go1.11
2018/12/07 13:05:46 [INFO] CLI command args: []string{"init"}

Most helpful comment

OK, it was actually explained in the other issue, but wasn't clear at first. I need to add an equals sign after the data:

resource "kubernetes_secret" "example" {
  metadata {
    name = "docker-cfg"
  }

-  data {
+  data = {
    ".dockerconfigjson" = "${file("${path.module}/.docker/config.json")}"
  }

  type = "kubernetes.io/dockerconfigjson"
}

All 2 comments

OK, it was actually explained in the other issue, but wasn't clear at first. I need to add an equals sign after the data:

resource "kubernetes_secret" "example" {
  metadata {
    name = "docker-cfg"
  }

-  data {
+  data = {
    ".dockerconfigjson" = "${file("${path.module}/.docker/config.json")}"
  }

  type = "kubernetes.io/dockerconfigjson"
}

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

pawelsawicz picture pawelsawicz  ยท  3Comments

rjinski picture rjinski  ยท  3Comments

zeninfinity picture zeninfinity  ยท  3Comments

rnowosielski picture rnowosielski  ยท  3Comments