Commit 879eb7c5 authored by Russell Dickenson's avatar Russell Dickenson

Merge branch 'docs-terraform-state-list' into 'master'

Added documentation for new terraform list actions

See merge request gitlab-org/gitlab!50660
parents 6ef18a28 21ede6d1
......@@ -347,14 +347,62 @@ location. You can then go back to running it from within GitLab CI.
NOTE:
We are currently working on [providing a graphical interface for managing state files](https://gitlab.com/groups/gitlab-org/-/epics/4563).
![Terraform state list](img/terraform_list_view_v13_5.png)
![Terraform state list](img/terraform_list_view_v13_8.png)
The state files attached to a project can be found under Operations / Terraform.
To list the state files attached to a project go to **Operations > Terraform**.
## Removing a State file
![Terraform state list](img/terraform_list_view_actions_v13_8.png)
You can only remove a state file by making a request to the API, like the following example:
The list also includes an **Actions** column where you can download, lock or unlock, or remove each state file.
## Remove a state file
You can use the following options to remove a state file:
1. GitLab REST API
1. GitLab GraphQL API
1. GitLab UI
### Remove a state file with the GitLab REST API
You can remove a state file by making a request to the REST API, for example:
```shell
curl --header "Private-Token: <your_access_token>" --request DELETE "https://gitlab.example.com/api/v4/projects/<your_project_id>/terraform/state/<your_state_name>"
```
### Remove a state file with the GitLab GraphQL API
You can remove a state file by making a GraphQL API request, for example:
```shell
mutation deleteState {
terraformStateDelete(input: { id: "<global_id_for_the_state>" }) {
errors
}
}
```
You can obtain the <global_id_for_the_state> by querying the list of states. For example:
```shell
query ProjectTerraformStates {
project(fullPath: "<your_project_path>") {
terraformStates {
nodes {
id
name
}
}
}
}
```
For those new to the GitLab GraphQL API, see [Getting started with GitLab GraphQL API](../../api/graphql/getting_started.md).
### Remove a state file with the GitLab UI
To delete a state file:
- From your project, go to **Operations > Terraform**.
- In the **Actions** column, click on the vertical ellipsis (**{ellipsis_v}**) button and select **Remove state file and versions**.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment