The environment
provider reads shell environment variables and makes them available as a terraform data source.
Documentation
The documentation for this provider is available on the Terraform Registry.
Example
terraform {
required_providers {
environment = {
source = "registry.terraform.io/morganpeat/environment"
}
}
}
provider "environment" {}
data "environment_variable" "path" {
name = "PATH"
}
output "path" {
value = data.environment_variable.path.value
}
terraform init && terraform plan
Requirements
Building the Provider
To build the provider, you'll need to clone the repository and execute the Go
install
command from inside the repository's directory.
go install
Using the provider
The provider can be used by adding it to the provider
requirements.
terraform {
required_providers {
environment = {
source = "registry.terraform.io/morganpeat/environment"
}
}
}
If you wish to use a local provider binary instead, it will need to added to the
development overrides.
provider_installation {
dev_overrides {
"morganpeat/environment" = "/home/developer/go/bin/terraform-provider-environment"
}
direct {}
}
Developing the Provider
If you wish to work on the provider, you'll first need
Go installed on your machine (see
Requirements above).
To compile the provider, run go install
. This will build the provider and put
the provider binary in the $GOPATH/bin
directory.
To generate or update documentation, run go generate
.
LICENSE
This project is under MPL-2.0 license.