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

68 lines
1.5 KiB
Markdown
Raw Normal View History

---
2017-04-03 19:53:38 +02:00
layout: "enterprise"
2017-04-07 05:59:58 +02:00
page_title: "State - API - Terraform Enterprise"
2017-03-21 22:50:17 +01:00
sidebar_current: "docs-enterprise-api-states"
description: |-
State represents the status of your infrastructure at the last time Terraform was run.
---
# State API
2017-04-07 05:59:58 +02:00
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.
2017-04-07 05:59:58 +02:00
## List of States
2017-04-07 05:59:58 +02:00
This endpoint gets a list of states accessible to the user corresponding to the
provided token.
2017-04-07 05:59:58 +02:00
| Method | Path |
| :----- | :------------- |
| `GET` | `/terraform/state` |
2017-04-07 05:59:58 +02:00
### Parameters
2017-04-07 05:59:58 +02:00
- `?username` `(string: "")` - Specifies the organization/username to filter
states
2017-04-07 05:59:58 +02:00
- `?page` `(int: 1)` - Specifies the pagination, which defaults to page 1.
2017-04-07 05:59:58 +02:00
### Sample Requests
2017-04-07 05:59:58 +02:00
```text
$ curl \
--header "X-Atlas-Token: ..." \
https://atlas.hashicorp.com/api/v1/terraform/state
```
2017-04-07 05:59:58 +02:00
```text
$ curl \
--header "X-Atlas-Token: ..." \
https://atlas.hashicorp.com/api/v1/terraform/state?username=acme
```
2017-04-07 05:59:58 +02:00
### Sample Response
2017-04-07 05:59:58 +02:00
```json
{
"states": [
{
"updated_at": "2017-02-03T19:52:37.693Z",
"environment": {
"username": "my-organization",
"name": "docs-demo-one"
}
},
{
"updated_at": "2017-04-06T15:48:49.677Z",
"environment": {
"username": "my-organization",
"name": "docs-demo-two"
}
}
]
}
```