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

[BUG] Unable to specify custom .tfvars location with plan #1543

Open
mbordash2 opened this issue Aug 19, 2022 · 1 comment
Open

[BUG] Unable to specify custom .tfvars location with plan #1543

mbordash2 opened this issue Aug 19, 2022 · 1 comment
Labels
feature Request or pull request for a new feature priority:low Low priority issue or pull request status:review_needed Issue or pull request needs reviewed

Comments

@mbordash2
Copy link
Contributor

Bug Description

Runway will look in the root module directory for the tfvars file for an environment and if it is not present, it will return an error.

When you want to define your var files in another location, runway doesn't look to see if you specify a custom -var-file location and requires a placeholder file to be present. As you can see below both .tfvars are added to the command which is not necessary.

VERBOSE:runway.core.components.module:External ALB.env-terraform:module payload: {"options": {"terraform_write_auto_tfvars": true, "args": ["-var-file=vars/dev.tfvars"], "terraform_backend_config": {"bucket": "infra-terraform-state", "region": "us-east-1", "dynamodb_table": "dev-us-east-1-tf-lock-table"}}, "parameters": {}, "class_path": null, "environments": {}, "name": "env-terraform", "path": "external-alb/env-terraform", "tags": [], "type": "terraform", "parallel": [], "explicitly_enabled": true}
Exec: "/opt/homebrew/Cellar/tfenv/2.2.2/bin/tfenv" exec "apply -var-file=dev.tfvars -var-file=vars/dev.tfvars -auto-approve=false"

Also, plan does not even pick up the arg so it will not work at all with a custom .tfvars location.

Expected Behavior

It should not be required to have a ENV.tfvars file in the root directory if -var-file= is specificed in the args:.

apply and plan should have equivalent functionality.

Steps To Reproduce

  - name: External ALB
    modules:
      - path: external-alb/env-terraform
        type: terraform
        options:
          terraform_write_auto_tfvars: true
          args:
            - '-var-file=vars/${env DEPLOY_ENVIRONMENT}.tfvars'
          terraform_backend_config:
            bucket: ${var tf_state_bucket.${env DEPLOY_ENVIRONMENT}}
            region: us-east-1
            dynamodb_table: ${var dynamodb_table.${env DEPLOY_ENVIRONMENT}}

Runway version

2.6.2

Installation Type

pypi (pip, pipenv, poetry, etc)

OS / Environment

  • OS: macOS 12.4
  • python: 3.8.13
  • terraform: 1.2.3

Anything else?

No response

@mbordash2 mbordash2 added bug Something isn't working priority:low Low priority issue or pull request status:review_needed Issue or pull request needs reviewed labels Aug 19, 2022
@jake-skipper
Copy link
Contributor

Fix for this is upcoming in MSI-701.

@mbordash2 mbordash2 added feature Request or pull request for a new feature and removed bug Something isn't working labels Jul 29, 2023
@ITProKyle ITProKyle moved this to Backlog in Runway Development Work Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request or pull request for a new feature priority:low Low priority issue or pull request status:review_needed Issue or pull request needs reviewed
Projects
Status: Backlog
Development

No branches or pull requests

2 participants