generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug: [OPA-1381]: Improve terraform documentation for policy and polic…
…yset (#569)
- Loading branch information
1 parent
8521317
commit 38e07e9
Showing
7 changed files
with
56 additions
and
10 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,4 @@ | ||
```release-note:enhancement | ||
resource/harness_platform_policyset: correct description for 'severity' for policy. | ||
resource/harness_platform_policy: Enhance example to showcase how to add policy with Rego spanning over multiple lines. | ||
``` |
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
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
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
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 |
---|---|---|
@@ -1,5 +1,26 @@ | ||
resource "harness_platform_policy" "test" { | ||
identifier = harness_platform_policy.test.identifier | ||
name = harness_platform_policy.test.name | ||
rego = "package test" | ||
identifier = harness_platform_policy.test.identifier | ||
name = harness_platform_policy.test.name | ||
description = harness_platform_policy.test.description | ||
rego = <<-REGO | ||
package pipeline | ||
# Deny pipelines that don't have an approval step | ||
# NOTE: Try removing the HarnessApproval step from your input to see the policy fail | ||
deny[msg] { | ||
# Find all stages that are Deployments ... | ||
input.pipeline.stages[i].stage.type == "Approval" | ||
# ... that are not in the set of stages with HarnessApproval steps | ||
not stages_with_approval[i] | ||
# Show a human-friendly error message | ||
msg := sprintf("Approval stage '%s' does not have a HarnessApproval step", [input.pipeline.stages[i].stage.name]) | ||
} | ||
# Find the set of stages that contain a HarnessApproval step | ||
stages_with_approval[i] { | ||
input.pipeline.stages[i].stage.spec.execution.steps[_].step.type == "HarnessApproval" | ||
} | ||
REGO | ||
} |
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
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