terraform-provider-environment

command module
v0.0.0-...-956fb35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

README

Environment Provider

The Environment provider is a utility provider for including local environment variables as part of a Terraform configuration. The provider itself requires no configuration.

environment_variable Data Source

The environment_variable data source provides a mechanism for a Terraform configuration to read values of local environment variables and incorporate them into a Terraform configuration. This helps make it easier to make the Terraform script machine independent. For example, when configuring a managed Kubernetes cluster on AWS, the Kubernetes config file needs to be modified to allow Kubernetes commands to successfully connect and authenticate to the Kubernetes API server. The config file is typically written to ~/.kube/ directory, but this path does not work on Windows. By providing access to the HOME environment variable, it is possible to compute the path based on the user's home directory without assuming an operating system.

provider "environment" {}

data "environment_variable" "HOME" {
 name = "HOME"
 failIfEmpty = true
 normalize_file_path = true
}

provider "kubernetes" {
 config_file = "${data.environment_variable.HOME.value}/.kube/my-cluster-config"
}
Argument Reference

The following arguments are supported:

  • name - (Required) The name of the environment variable whose value should be used.
  • default - (Optional) The default value to use should the environment variable not be set or set to an empty string.
  • fail_if_empty - (Optional) Whether or not the data source read should fail if the final value of the environment variable (after applying the default, if specified), if empty. The default value is false.
  • normalize_file_path - (Optional) Whether or not to treat the final value as a file path, which means making sure to quote any backslashes in the path when running on the Windows platform. The default value is false.
Attributes

  • value - The final value of the environment variable (after applying the default, if specified.

Documentation

Overview

* Copyright 2018 Robert Patrick <rhpatrick@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.

Directories

Path Synopsis
* Copyright 2018 Robert Patrick <rhpatrick@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.
* Copyright 2018 Robert Patrick <rhpatrick@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL