Skip to content

terraform-backend-git.hcl doesn't work when using terraform -chdir= and  #20

@guimaluf

Description

@guimaluf

When using terraform -chdir and terraform-backend-git.hcl config file, the terraform-backend-git seems unhappy and throws

[terraform-backend-git]: repository must be set

How to reproduce

$ mkdir terraform
$ cat <<EOF > terraform/main.tf
resource "null_resource" "echo" {
  provisioner "local-exec" {
    command = "echo it works"
  }
}
EOF

$ cat <<EOF > terraform-backend-git.hcl
git.repository = "$(git remote get-url origin)"
git.ref = "master"
git.state = "terraform.tfstate"
EOF

$ ./terraform-backend-git-linux-amd64 git terraform -chdir=terraform/ init
[terraform-backend-git]: repository must be set

Doesn't matter if I put the config file in the -chdir target.

$ cp  terraform-backend-git.hcl terraform/
$ ./terraform-backend-git-linux-amd64 git terraform -chdir=terraform/ init
[terraform-backend-git]: repository must be set

Without -chdir it does work

$ cd terraform/
$ ../terraform-backend-git-linux-amd64 git terraform init
[terraform-backend-git]: Using config file: /home/gb637/workspace/tfm-debug/terraform/terraform-backend-git.hcl
[terraform-backend-git]: WARNING: HTTP basic auth is disabled, please specify TF_BACKEND_GIT_HTTP_USERNAME and TF_BACKEND_GIT_HTTP_PASSWORD
[terraform-backend-git]: listen on 127.0.0.1:6061

Thanks for the great work on this project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions