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

1.7 KiB
Executable File

layout page_title sidebar_current description
api Environments API docs-enterprise-api-environments Environments represent running infrastructure managed by Terraform.

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. Variables 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 performed on this resource.

Update variables
PUT /api/v1/environments/: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"