From ae1162a8b3d91d1b3450711fff81fb0699f8ccb4 Mon Sep 17 00:00:00 2001 From: Wilson de Carvalho <796900+wcmjunior@users.noreply.github.com> Date: Wed, 5 Jun 2024 23:51:08 -0700 Subject: [PATCH] Improve examples for resources policy and policy_rules --- docs/resources/policy.md | 11 ++- docs/resources/policy_rule.md | 70 +++++++------------ examples/resources/cyral_policy/resource.tf | 11 ++- .../resources/cyral_policy_rule/resource.tf | 70 +++++++------------ 4 files changed, 60 insertions(+), 102 deletions(-) diff --git a/docs/resources/policy.md b/docs/resources/policy.md index 793301de..c1d075a5 100644 --- a/docs/resources/policy.md +++ b/docs/resources/policy.md @@ -13,13 +13,12 @@ Manages [policies](https://cyral.com/docs/reference/policy). See also: [Policy R ## Example Usage ```terraform -resource "cyral_policy" "some_resource_name" { - name = "" - description = "" +resource "cyral_policy" "this" { + name = "My first policy" + description = "This is my first policy" enabled = true - data = [""] - data_label_tags = [""] - tags = [""] + data = ["EMAIL"] + metadata_tags = ["Risk Level 1"] } ``` diff --git a/docs/resources/policy_rule.md b/docs/resources/policy_rule.md index 4c53c0fd..ba166362 100644 --- a/docs/resources/policy_rule.md +++ b/docs/resources/policy_rule.md @@ -9,51 +9,31 @@ Manages [policy rules](https://cyral.com/docs/reference/policy/#rules). See also ## Example Usage ```terraform -resource "cyral_policy_rule" "some_resource_name" { - policy_id = "" - hosts = [""] - identities { - db_roles = [""] - groups = [""] - services = [""] - users = [""] - } - deletes { - additional_checks = "" - data = [""] - dataset_rewrites { - dataset = "" - repo = "" - substitution = "" - parameters = [""] - } - rows = 1 - severity = "low" - } - reads { - additional_checks = "" - data = [""] - dataset_rewrites { - dataset = "" - repo = "" - substitution = "" - parameters = [""] - } - rows = 1 - severity = "low" - } - updates { - additional_checks = "" - data = [""] - dataset_rewrites { - dataset = "" - repo = "" - substitution = "" - parameters = [""] - } - rows = 1 - severity = "low" - } +# An example of a policy and a policy rule with a rego policy +# in `additional_checks`. +resource "cyral_policy" "this" { + name = "My first policy" + description = "This is my first policy" + enabled = true + data = ["EMAIL"] + metadata_tags = ["Risk Level 1"] +} + +resource "cyral_policy_rule" "this" { + policy_id = cyral_policy.this.id + deletes { + additional_checks = <