Additional Controls
Disclaimer
Additional Controls are features that aren’t available through the user interface, but can be used by setting the appropriate environment variables, at the Organization, Template, Project, or Environment level.
Terraform Partial Apply
Using the environment variable ENV0_TERRAFORM_TARGET
, you can specify specific resources that will be targeted for apply. The value of the variable will be passed to Terraform -target
flag.
Read more here.
Specify Terraform/Terragrunt Versions
Using the environment variable ENV0_TF_VERSION
, you can specify the Terraform version you would like your environment to use. You can read more here.
You can also use the ENV0_TERRAGRUNT_VERSION
to specify the Terragrunt version for your applicable Terragrunt deployments.
Another way for determining the version for both Terraform and Terragrunt is a version file. When a file with a name .{type}-version
(type being either "terraform" or "terragrunt") exists in the project's root directory the version is resolved based on the content of the file. The sole content of the file should be the version you wish to use.
The order of precedence whenever the version is specified using more than one option is as follows: env0 environment variable, version file, selected version when creating/updating the template.
Specifying version in Terraform code
You can also set the version in your Terraform code and we will automatically install the correct version for using tfenv
Custom Terraform Variables File
Using the environment variable ENV0_TERRAFORM_CONFIG_FILE_PATH
, you can select multiple Terraform variable files to pass on to Terraform. The list of filenames should be comma delimited.
Terraform Backend Config
Using the environment variable ENV0_TERRAFORM_BACKEND_CONFIG
, you can pick a custom backend config to be used in terraform init
. The value of the variable will be passed to the -backend-config
flag.
If you would like to have multiple -backend-config
declarations, then you can pass the multiple values in the ENV0_TERRAFORM_BACKEND_CONFIG
environment variable as a comma-delimited string. For example, a value of /path/to/config/file,key=value
will result in the flags -backend-config="/path/to/config/file" -backend-config="key=value"
.
Read more here.
Enable Cost Tagging Per Environment
Cost tagging works on the project level and once enabled, env0 will tag every environment under that project. It can happen that sometimes (mainly for debugging purposes) you'd wish to turn on cost tagging only for a specific environment and not for the whole project.
Using the environment variable ENV0_ENABLE_COST_TAG
, you can enable it per your environment.
Adding Custom Resource Tagging
When cost tagging is enabled for an environment, using the environment variable ENV0_TERRATAG_CUSTOM_TAGS
will enable custom resource tags to be applied using terratag.
The variable value should be supplied in the form of: {"aTagName": "aTagValue", ...}
.
This would apply the tags to all taggable resources in the environment.
You can use another environment variables in the tags, for example {"created_by": "$ENV0_ENVIRONMENT_CREATOR_NAME"}
. See this list for the environment variables that env0 exposes.
Skip Workspace Commands
For each environment, we are creating a new terraform workspace if it doesn't exist, or selecting it if it exists. In addition, we delete the workspace when destroying the environment.
If you wish not to execute those commands you can skip them by using the environment variable ENV0_SKIP_WORKSPACE
and set its value to be true
. Please remove the environment variable all together or set its value to be empty to run the workspace commands.
Skip Git Submodules
By default if you have git submodules configured in your repository env0 clone them with depth of 1.
If you do not wish to clone your git submodules you can by using the ENV0_SKIP_SUBMODULE_GIT_CLONE
environment variable and set its value to be true
.
If you remove the environment variable all together or set its value to be empty we will clone your git submodules.
Updated 6 months ago