Skip to content
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

terraform output command should expect the path to the configuration files #15581

Open
GarimaSharma opened this issue Jul 18, 2017 · 1 comment

Comments

@GarimaSharma
Copy link

Hi,

We are trying to get terraform output running after changing the state from local filesystem to remote state. terraform plan and terraform apply works well.

We moved our backend.tf in the directory from where we execute terraform commands, and it works well. However we don't want to keep two copies of backend.tf in our codebase.

Terraform Version

Terraform v0.9.11

Terraform Configuration Files

terraform {
  backend "gcs" {
    bucket  = "some-bucket"
    path    = "terraform.tfstate"
    project = "my-project"
  }
}

Debug Output

https://gist.github.com/GarimaSharma/bb188c6d4d0cb4fdb29298691fd02449

Directory Tree For Error

├── README.md
├── etc
│   └── terraform
│   ├── backend.tf
│   ├── buckets.tf
│   ├── https_whitelist.tf
│   ├── logger.tf
│   ├── main.tf
│   ├── networks.tf
│   └── outputs.tf

Directory Tree For Success

├── backend.tf
├── README.md
├── etc
│   └── terraform
│   ├── backend.tf
│   ├── buckets.tf
│   ├── https_whitelist.tf
│   ├── logger.tf
│   ├── main.tf
│   ├── networks.tf
│   └── outputs.tf

Expected Behavior

terraform output takes location of backend.tf (or the whole terraform configuration directory)

Actual Behavior

  • It complaints expecting user to do terraform init
  • Providing tfstate like terraform output -state=.terraform/terraform.tfstate also ends up in complaining for terraform init
  • Providing tfstate like terraform output -state=gs://some-bucket/terraform.tfstate also ends up in complaining for terraform init

Steps to Reproduce

  1. terraform output OR
  2. terraform output -state=.terraform/terraform.tfstate OR
  3. terraform output -state=gs://some-bucket/terraform.tfstate

Important Factoids

  1. We recently changed the backend to GCS. Soon after that, terraform output failed. terraform plan and terraform apply works well since it accepts path the terraform configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants