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

Use of TF_TOKEN_ Environment Variable for External Module Registry Access #631

Closed
alfespa17 opened this issue Dec 7, 2023 Discussed in #626 · 0 comments · Fixed by #632
Closed

Use of TF_TOKEN_ Environment Variable for External Module Registry Access #631

alfespa17 opened this issue Dec 7, 2023 Discussed in #626 · 0 comments · Fixed by #632
Assignees
Labels
bug Something isn't working

Comments

@alfespa17
Copy link
Member

Discussed in https://github.com/orgs/AzBuilder/discussions/626

Originally posted by ben-balk-oc December 6, 2023
According to Terraform CLI documentation, version v1.2.0 and later support use of environment variable credentials to make requests to specific hostnames (https://developer.hashicorp.com/terraform/cli/config/config-file#environment-variable-credentials). We're hoping to migrate all of our workspaces from Terraform Cloud into Terrakube and it would be significantly easier if we had a way to pull modules from our current Terraform Cloud module registry while we convert to either a Terrakube registry or update our modules to use Github repo sources.

Should this work by simply setting an environment variable named TF_TOKEN_app_terraform_io in the workspace(s)? I can't seem to get that to work using a VCS workflow workspace regardless of which version I specify.
Example error from terraform plan:

Failed to retrieve available versions for module "core" (core.tf:1) from
app.terraform.io: error looking up module versions: 401 Unauthorized.

I have used a modified template to print the environment variables in my Terrakube shell environment and can see the appropriate variable for TF_TOKEN_app_terraform_io.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant