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

Feature: Allow provider config to be set from environment variables. #238

Open
cdsre opened this issue Nov 6, 2024 · 0 comments · May be fixed by #239
Open

Feature: Allow provider config to be set from environment variables. #238

cdsre opened this issue Nov 6, 2024 · 0 comments · May be fixed by #239

Comments

@cdsre
Copy link

cdsre commented Nov 6, 2024

Most terraform providers allow setting of provider configuration attributes via environment variables. So notable providers are

Vault - uses VAULT_TOKEN , VAULT_ADDR, etc....
AWS - uses AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, etc....
Auth0 - uses AUTH0_DOMAIN, AUTH0_CLIENT_ID, etc...

This allows much easier use of the providers especially in CI/CD pipelines. Where these values may come from pipeline secrets, container injections or remotely looked up from external locations.

While the provider currently provides a work around to this by setting variable definitions for these and then allowing them to be passed in via TF_VAR environment variables or from terraform.tfvars files. This clutters up the terraform root modules variables and still needs the user to configure them in the provider configuration block.

There is a likely chance that an engineer might accidently commit the terraform.tfvars file with API keys or set default keys in the variables or provider config and these being committed to git history forever.

Looking in the provider.go there is a reference in an error message about setting the token using an environment variable called CAPELLA_AUTHORISATION_TOKEN. However there is nothing in the provider that supports this.

This is a feature request to be able to support setting of the providers host and authorisation_token via environment variables prefixed with CAPELLA_. This will allow much easier use of the provider in CI/CD pipelines and declutter terraform code and the examples in this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant