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

1.4 KiB
Executable File

layout page_title sidebar_current description
api State API docs-enterprise-api-states State represents the status of your infrastructure at the last time Terraform was run.

State API

State represents the status of your infrastructure at the last time Terraform was run. States can be pushed to Terraform Enterprise from Terraform's CLI after an apply is done locally, or state is automatically stored if the apply is done in Terraform Enterprise.

State Attributes

Attribute Description Required
username If supplied, only return states belonging to the organization with this username. No

Actions

The following actions can be perfomed on this resource.

Get a list of states accessible to a user
GET /api/v1/terraform/state

Examples

Getting a list of Terraform states

$ curl %{ATLAS_URL}/api/v1/terraform/state \
    -H "X-Atlas-Token: $ATLAS_TOKEN"

Getting a list of Terraform states for an organization

$ curl %{ATLAS_URL}/api/v1/terraform/state?username=acme_inc \
    -H "X-Atlas-Token: $ATLAS_TOKEN"

Getting second page of list of Terraform states

$ curl %{ATLAS_URL}/api/v1/terraform/state?page=2 \
    -H "X-Atlas-Token: $ATLAS_TOKEN"