terraform/website/source/docs/enterprise/api/environments.html.md

1.5 KiB
Executable File

title
Environments API

Environments API

Environments represent running infrastructure managed by Terraform.

Environments can also be connected to Consul clusters. This documentation covers the environment interactions with Terraform.

Environment Attributes

Attribute Description Required
variables A key/value map of Terraform variables to be updated. Existing variables will only be removed when their value is empty. Varaibles of the same key will be overwritten. Yes
Note: Only string variables can be updated via the API currently. Creating or updating HCL variables is not yet supported.

Actions

The following actions can be perfomed on this resource.

Update variables
PUT /api/v1/enviromments/:username/:name/variables

Examples

Updating Terraform variables

Updates the Terraform variables for an environment. Due to the sensitive nature of variables, they will not returned on success.

$ cat variables.json
{
  "variables": {
      "desired_capacity": "15",
      "foo": "bar"
  }
}
$ curl %{ATLAS_URL}/api/v1/environments/%{DEFAULT_USERNAME}/test/variables \
    -X PUT \
    -H 'Content-Type: application/json' \
    -d @variables.json \
    -H "X-Atlas-Token: $ATLAS_TOKEN"