-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Allow per-command Environment selection (eg, with an environment variable) #14447
Comments
Hi @glasser! In principle this sounds like it would work, and seems like a reasonable idea. If you're willing to work on it and share what you learn, that'd be great! Some things to think about:
Given that it's easy to set environment variables in your shell and forget about them, I think it'll be important to add some new output to
Should probably also add a helpful error message to
|
Hmm, my understanding is that you don't even need to run Good point re modules. We only use local (relative path) modules and basically try to pretend that the thing where Terraform sets up symlinks in hidden places instead of just interpreting the paths directly doesn't exist. (Our current shell scripts run Those suggestions for By the way, do you agree with me that |
Also, one other question: if doing this, is it OK to skip running |
This allows you to run multiple concurrent terraform operations against different environments from the same source directory. Fixes hashicorp#14447. Also removes some dead code which appears to do the same thing as the function I modified.
Opened PR #14602. |
This allows you to run multiple concurrent terraform operations against different environments from the same source directory. Fixes hashicorp#14447. Also removes some dead code which appears to do the same thing as the function I modified.
This allows you to run multiple concurrent terraform operations against different environments from the same source directory. Fixes #14447. Also removes some dead code which appears to do the same thing as the function I modified.
This allows you to run multiple concurrent terraform operations against different environments from the same source directory. Fixes #14447. Also removes some dead code which appears to do the same thing as the function I modified.
This allows you to run multiple concurrent terraform operations against different environments from the same source directory. Fixes #14447. Also removes some dead code which appears to do the same thing as the function I modified.
This allows you to run multiple concurrent terraform operations against different environments from the same source directory. Fixes hashicorp#14447. Also removes some dead code which appears to do the same thing as the function I modified.
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. |
We currently use Terraform 0.7.3 and are looking to upgrade to 0.9. One thing we do is run a set of slow end-to-end tests that you run against your Terraform configuration that builds a whole test environment based on the same configuration, runs some tests against the servers, and tears it down.
It's important that we can continue working on our development environment in the same directory simultaneously with running these tests.
Right now we do this by always running TF with a wrapper script that uses my PR #8720 to separate these setups into different
.terraform
directories.However, we would love to move away from wrapper scripts and use the new Environment feature, which is designed exactly for this purpose. Developers would each create an environment with their name using
terraform env new $USER
, and when they run the end-to-end tests, the test suite would generate an environment name and runterraform
using that environment.The problem is that there's no non-racy way to run
terraform
in multiple environments on the same data directory using the environment feature, because the only way to specify which environment to use is via the filesystem. Having the test suite runterraform env select
before and after every command isn't good enough, because the main command it runs may be runs slow and I may want to concurrently run on my development environment while the command runs.I'm pretty sure I can get exactly what I want by adding a
TF_ENVIRONMENT
environment variable, which is checked before the.terraform/environment
file. I intend to do that for my company's use and file a PR. I am curious if any Terraform developer believes that this would be sufficient to achieve my goals or if there are other uses of the.terraform
directory that are not separated by environment.The text was updated successfully, but these errors were encountered: