-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example and docs template for change request policies
- Loading branch information
1 parent
b73be50
commit 42fc41b
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
data "doppler_user" "nic" { | ||
email = "[email protected]" | ||
} | ||
|
||
data "doppler_user" "emily" { | ||
email = "[email protected]" | ||
} | ||
|
||
resource "doppler_project" "test_proj" { | ||
name = "my-test-project" | ||
description = "This is a test project" | ||
} | ||
|
||
resource "doppler_environment" "prd" { | ||
project = doppler_project.test_proj.name | ||
slug = "prd" | ||
name = "prd" | ||
} | ||
|
||
resource "doppler_environment" "ci" { | ||
project = doppler_project.test_proj.name | ||
slug = "ci" | ||
name = "CI-CD" | ||
} | ||
|
||
resource "doppler_config" "ci_github" { | ||
project = doppler_project.test_proj.name | ||
environment = doppler_environment.ci.slug | ||
name = "ci_github" | ||
} | ||
|
||
resource "doppler_group" "prod_reviewers" { | ||
name = "Prod Reviewers" | ||
} | ||
|
||
resource "doppler_group_member" "prod_reviewers" { | ||
for_each = toset([data.doppler_user.nic.slug]) | ||
group_slug = doppler_group.prod_reviewers.slug | ||
user_slug = each.value | ||
} | ||
|
||
resource "doppler_change_request_policy" "prd_review" { | ||
name = "Prod Review" | ||
description = <<EOT | ||
A change request policy which requires 2 total approvals, and 1 approval from emily or any member of the prod_reviewers group. | ||
Reviews from the author of the change request are not counted. | ||
This policy is enforced in all configs of the prd environment of test_proj, as well as the ci_github branch config. | ||
EOT | ||
rules { | ||
disallow_self_review = true | ||
|
||
required_reviewers { | ||
count = 2 | ||
} | ||
|
||
required_reviewers { | ||
count = 1 | ||
group_slugs = [doppler_group.prod_reviewers.slug] | ||
user_slugs = [data.doppler_user.emily.slug] | ||
} | ||
} | ||
targets { | ||
project { | ||
project_name = doppler_project.test_proj.name | ||
environment_slugs = [doppler_environment.prd.slug] | ||
config_names = [doppler_config.ci_github.name] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
page_title: "doppler_change_request_policy Resource - terraform-provider-doppler" | ||
subcategory: "" | ||
description: |- | ||
Manage a Doppler change request policy. | ||
--- | ||
|
||
# doppler_change_request_policy (Resource) | ||
|
||
Manage a Doppler change request policy. | ||
|
||
## Example Usage | ||
|
||
{{tffile "examples/resources/change_request_policy.tf"}} | ||
|
||
{{ .SchemaMarkdown | trimspace }} | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
terraform import doppler_change_request_policy.<name> <change-request-policy-id> | ||
``` |