Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Init/apply is broken for remote backends #195

Open
ghost opened this issue Nov 6, 2020 · 1 comment
Open

Init/apply is broken for remote backends #195

ghost opened this issue Nov 6, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 6, 2020

Original init command works if we add TF_WORKSPACE env var, but apply for some reason runs init again, but explicitly unsets TF_WORKSPACE, resulting in a error:

export workspace
unset TF_WORKSPACE
...
terraform init -input=false -no-color $INIT_ARGS "$module_path"
terraform workspace select -no-color "$workspace" "$module_path" || terraform workspace new -no-color "$workspace" "$module_path"
terraform apply -auto-approve $PLAN_ARGS "$module_path"
Initializing modules...

Initializing the backend...

The currently selected workspace (default) does not exist.
  This is expected behavior when the selected workspace did not have an
  existing non-empty state. Please enter a number to select a workspace:
  
  1. test-ci

  Enter a value: 
@whyman
Copy link
Contributor

whyman commented Nov 6, 2020

Hi @brunomed,

The orb is designed to take workspace as a parameter rather than have it set via an env var.

Does it work as expected using this method?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant