terraform/website/source/docs/enterprise/api/configuration-versions.html.md

2.3 KiB
Executable File

layout page_title sidebar_current description
api Configuration Versions API docs-enterprise-api-configversions A configuration version represents versions of Terraform configuration.

Configuration Versions API

A configuration version represents versions of Terraform configuration. Each set of changes to Terraform HCL files or the scripts used in the files should have an associated configuration version.

When creating versions via the API, the variables attribute can be sent to include the necessary variables for the Terraform configuration.

Configuration Version Attributes

Attribute Description Required
variables A key/value map of Terraform variables to be associated with the configuration version. No
metadata A hash of key value metadata pairs. No

Actions

The following actions can be performed on this resource.

Create
POST /api/v1/terraform/configurations/:username/:name/versions
Upload progress
GET /api/v1/terraform/configurations/:username/:name/versions/progress/:token

Examples

Creating a configuration version

Creates a configuration with the provided attributes.

$ cat version.json
{
  "version": {
    "metadata": {
      "git_branch": "master",
      "remote_type": "atlas",
      "remote_slug": "hashicorp/atlas"
    },
    "variables": {
      "ami_id": "ami-123456",
      "target_region": "us-east-1",
      "consul_count": "5",
      "consul_ami": "ami-123456"
    }
  }
}

$ curl %{ATLAS_URL}/api/v1/terraform/configurations/%{DEFAULT_USERNAME}/test/versions \
    -X POST \
    -H "X-Atlas-Token: $ATLAS_TOKEN" \
    -H "Content-Type: application/json" \
    -d @version.json

Retrieving the progress of an upload for a configuration version

Returns upload progress for the version.

$ curl %{ATLAS_URL}/api/v1/terraform/configurations/%{DEFAULT_USERNAME}/test/versions/progress/63fc7e18-3911-4853-8b17-7fdc28f158f2 \
    -H "X-Atlas-Token: $ATLAS_TOKEN"