Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/meltwater/terraform-credentials-env
Terraform credentials helper for supplying credentials in environment variables
https://github.com/meltwater/terraform-credentials-env
automation-drone clientdata-no coe-universal-solutions department-460 lifecycle-maintenance purpose-library team-a-team terraform usage-public
Last synced: 1 day ago
JSON representation
Terraform credentials helper for supplying credentials in environment variables
- Host: GitHub
- URL: https://github.com/meltwater/terraform-credentials-env
- Owner: meltwater
- License: mpl-2.0
- Created: 2022-03-28T17:43:54.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-23T21:58:04.000Z (about 1 year ago)
- Last Synced: 2024-06-15T00:12:58.035Z (5 months ago)
- Topics: automation-drone, clientdata-no, coe-universal-solutions, department-460, lifecycle-maintenance, purpose-library, team-a-team, terraform, usage-public
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform Credentials from the Environment
## Maintainers
This repository is owned and maintained by Foundation Missions A-Team. Should you encounter issues or require changes to code maintained in this repository, please reachout in `#foundation-mission` or one of our service channels in slack.
* [#foundation-mission](https://meltwater.slack.com/archives/CATUVU820)
* [[email protected]](mailto:[email protected])
* @meltwater/a-team`terraform-credentials-env` is a Terraform "credentials helper" plugin that
allows providing credentials for
[Terraform-native services](https://www.terraform.io/docs/internals/remote-service-discovery.html)
(private module registries, Terraform Cloud, etc) via environment variables.To use it,
[download a release archive](https://github.com/apparentlymart/terraform-credentials-env/releases)
and extract it into the `~/.terraform.d/plugins` directory where Terraform
looks for credentials helper plugins. (The filename of the file inside the
archive is important for Terraform to discover it correctly, so don't rename
it.)Terraform will take the newest version of the plugin it finds in the plugin
search directory, so if you are switching between versions you may prefer to
remove existing installed versions in order to ensure Terraform selects the
desired version.Once you've installed the plugin, enable it by adding the following block
to your
[Terraform CLI configuration](https://www.terraform.io/docs/commands/cli-config.html):```hcl
credentials_helper "env" {}
```This credentials helper plugin does not take any additional arguments, so the
block must be left empty as shown above.With this helper installed and enabled, you can set credentials for specific
hostnames in the environment for your shell so that they will be inherited
by `terraform` and then in turn by `terraform-credentials-env`.The environment variables must be named `TF_TOKEN_` followed by the hostname
the token is for with periods replaced by underscores. For example, to set
a token for `app.terraform.io` (Terraform Cloud) in bash:```
export TF_TOKEN_app_terraform_io=example_token
```Terraform will execute the configured credentials helper plugin whenever it
needs to make a request to a Terraform-native service whose credentials aren't
directly configured in the CLI configuration using `credentials` blocks.
`credentials` blocks override credentials helpers though, so if you have any
existing `credentials` block for the hostname you wish to configure you will
need to remove that block first.