Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SUP 1301/deprecation warning #342

Merged
merged 4 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions docs/resources/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ resource "buildkite_pipeline" "test_new" {

Currently, the `default_timeout_in_minutes` and `maximum_timeout_in_minutes` will be retained in state even if removed from the configuration. In order to remove them, you must set them to `0` in either the configuration or the web UI.

## Example Usage with Deletion Protection
## Example Usage with Lifecycles

```hcl
resource "buildkite_pipeline" "test_new" {
Expand All @@ -49,11 +49,16 @@ resource "buildkite_pipeline" "test_new" {

steps = file("./deploy-steps.yml")

deletion_protection = true
lifecycle {
prevent_destroy = true
}
}
```

`deletion_protection` will block `destroy` actions on the **pipeline**. Attached resources, such as `schedules` will still be destroyed.
[Lifecycles](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle) allow you to set general rules
for resources, including the prevention of destruction of a resource. In the above example, the `destroy` command on the `Testing TImeouts` pipeline will fail.

Lifecycles will replace the deprecated `deletion_protection` in `v1` of the provider in favour of `lifecycle` rules.

## Example Usage with Archive on Delete

Expand Down Expand Up @@ -118,7 +123,7 @@ resource "buildkite_pipeline" "repo2-release" {
- `team` - (Optional) Set team access for the pipeline. Can be specified multiple times for each team. See [Teams Configuration](#team) below for details.
- `tags` - (Optional) A set of tags to be set to the pipeline. For example `["terraform", "provider"]`.
- `provider_settings` - (Optional) Source control provider settings for the pipeline. See [Provider Settings Configuration](#provider-settings-configuration) below for details.
- `deletion_protection` - (Optional) Set to either `true` or `false`. When set to `true`, `destroy` actions on a pipeline will be blocked and fail with a message "Deletion protection is enabled for pipeline: <pipeline name>"
- `deletion_protection` - **DEPRECATED** (Optional) Set to either `true` or `false`. When set to `true`, `destroy` actions on a pipeline will be blocked and fail with a message "Deletion protection is enabled for pipeline: <pipeline name>"

### Teams Configuration

Expand Down
4 changes: 3 additions & 1 deletion examples/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ resource "buildkite_pipeline" "repo2" {
access_level = "READ_ONLY"
}

deletion_protection = true
lifecycle {
prevent_destroy = true
}
}

resource "buildkite_pipeline_schedule" "weekly" {
Expand Down