Skip to content

Update a Terraform state protection rule for a project

PATCH
/api/v4/projects/{id}/terraform/state_protection_rules/{terraform_state_protection_rule_id}

This feature was introduced in GitLab 19.0.

id
required
One of:
string

The ID or URL-encoded path of the project

terraform_state_protection_rule_id
required
integer

The ID of the Terraform state protection rule

Media type application/json
object
state_name

Terraform state name to protect.

string
nullable
minimum_access_level_for_write

If defined, sets the minimum GitLab access level required to write to the Terraform state.

string
nullable
Allowed values: developer maintainer owner admin
allowed_from

If defined, write requests must be made from the specific source.

string
nullable
Allowed values: anywhere ci_only ci_on_protected_branch_only

OK

Media type application/json
object
id
integer format: int64
project_id
integer format: int64
state_name
string
minimum_access_level_for_write
string
allowed_from
string
Example
{
"id": 1,
"project_id": 1,
"state_name": "production",
"minimum_access_level_for_write": "maintainer",
"allowed_from": "ci_only"
}

Bad Request

Unauthorized

Forbidden

Not Found

Unprocessable Entity