Closed PePoDev closed 2 years ago
@PePoDev Did you find a workaround since then ?
@PePoDev Did you find a workaround since then ?
No 😢
The question is, why should I pass the AWS_PROFILE? JetBrains IDE works without it. My case not about apply. I see these errors in the extension output. I think, VS Code extension should not require this env var. Maybe it tries to run init
? In this case, it's already done from the terminal.
I want to run Terraform inside VSCode with another AWS account.
Maybe my question is "How can I specific AWS account to run Terraform with this extension?"
Hello everyone,
The AWS Terraform provider has a section in the documentation on how to provide credentials and other sensitive information to Terraform when it runs. You'll have to check which method you're using in order to use it with VS Code.
For example, if you're using an Environment variable, you'll have to start VS Code from within a terminal that has that environment variable already populated. VS Code will then inherit all the environment variables of the parent process and any processes VS Code states (in this the case Terraform binary) will also have those environment variables. For example:
$ export AWS_ACCESS_KEY_ID="anaccesskey"
$ export AWS_SECRET_ACCESS_KEY="asecretkey"
$ export AWS_DEFAULT_REGION="us-west-2"
$ code .
We see a common issue where people start VS Code from the dock in macOS or from the Start menu in Windows and it does not have the same set of environment variables as launching from the command line, so be sure that the place you're starting from has the data you need to execute Terraform.
If you have any further questions about usage, please reach out on our Discuss board and ask over there. I'm going to close this out for now, but please let us know if things do not work.
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.
I run
Terraform: apply
from vscode and got this errorHow can I pass env AWS_PROFILE into Terraform extension?