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

Add support for .terraformrc #262

Closed
Paulius0112 opened this issue Feb 27, 2023 · 4 comments
Closed

Add support for .terraformrc #262

Paulius0112 opened this issue Feb 27, 2023 · 4 comments
Labels
enhancement New feature or request Stale waiting-on-response Waiting for a response from the user

Comments

@Paulius0112
Copy link

Trying to initialise private terraform modules in gitlab fails with all currently available secrets in the chart. However, manually providing a .terraformrc file with content

  token = "<TOKEN>"
}```

works successfully. Could you please add support for the above described file?
@jseiser
Copy link
Contributor

jseiser commented Mar 20, 2023

@Paulius0112

Can you please elaborate on this?

Where does this file need to be?

https://developer.hashicorp.com/terraform/cli/config/config-file

This reads like its only for Terraform Cloud/Enterprise?

@DanielRis
Copy link

DanielRis commented Aug 10, 2023

We as an example, host our Terraform Modules on the Terraform Enterprise Module Registry. This registry requires to authenticate with a valid token to be able pull modules during the terraform init stage.

Another use case is provider mirroring. We have a internal artifact location where we use the .terraformrc file to configure a mirror location to ensure that Terraform downloads providers from this artifact location instead of the public internet, e.g.:

disable_checkpoint = true

provider_installation {
    network_mirror {
        url = "https://example.internal/some-application/api/terraform/hashicorp/providers/"
    }
}

@Paulius0112 in newer versions of Terraform (>= 1.2.0), you can set an environment variable which is then used by TF TF_TOKEN_your_internal_module_registry_org. I have this in the secret I mount for my GitLab credentials.
https://developer.hashicorp.com/terraform/cli/config/config-file#environment-variable-credentials

@GMartinez-Sisti
Copy link
Member

Environment variables can be configured using the environment key:

environment: {}
# environment:
# ATLANTIS_DEFAULT_TF_VERSION: v1.2.9
.

Does this solves this issue?

@GMartinez-Sisti GMartinez-Sisti added enhancement New feature or request waiting-on-response Waiting for a response from the user labels Mar 24, 2024
Copy link

This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.'

@github-actions github-actions bot added the Stale label Apr 25, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Stale waiting-on-response Waiting for a response from the user
Projects
None yet
Development

No branches or pull requests

4 participants