From 22392a75f6185cefb6160d9ccc3c1ce60a0b7671 Mon Sep 17 00:00:00 2001 From: Sivaanand Murugesan Date: Thu, 21 Nov 2024 14:25:28 +0530 Subject: [PATCH 1/3] doc fix --- docs/resources/role.md | 2 +- examples/resources/spectrocloud_role/resource.tf | 7 ++++--- spectrocloud/resource_role.go | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/resources/role.md b/docs/resources/role.md index e84df7ac..829b93b8 100644 --- a/docs/resources/role.md +++ b/docs/resources/role.md @@ -60,7 +60,7 @@ resource "spectrocloud_role" "custom_role" { ### Optional - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) -- `type` (String) The role type. Allowed values are `project` or `tenant` or `project` +- `type` (String) The role type. Allowed values are `project` or `tenant` or `resource` ### Read-Only diff --git a/examples/resources/spectrocloud_role/resource.tf b/examples/resources/spectrocloud_role/resource.tf index 7c6b8bd5..b8e060b5 100644 --- a/examples/resources/spectrocloud_role/resource.tf +++ b/examples/resources/spectrocloud_role/resource.tf @@ -20,16 +20,17 @@ resource "spectrocloud_role" "custom_role" { variable "perms" { type = list(string) - default = ["App Profile", "App Deployment"] + default = ["API Key", "Audit", "Filter"] } data "spectrocloud_permission" "app_permissions" { for_each = toset(var.perms) name = each.key + scope = "tenant" } resource "spectrocloud_role" "custom_role_permission" { - name = "Test Cluster Role" - type = "project" + name = "Test Cluster Role With Custom Permission" + type = "tenant" permissions = flatten([for p in data.spectrocloud_permission.app_permissions : p.permissions]) } \ No newline at end of file diff --git a/spectrocloud/resource_role.go b/spectrocloud/resource_role.go index 21bd31e7..f15b0c65 100644 --- a/spectrocloud/resource_role.go +++ b/spectrocloud/resource_role.go @@ -39,7 +39,7 @@ func resourceRole() *schema.Resource { Optional: true, Default: "project", ValidateFunc: validation.StringInSlice([]string{"project", "tenant", "resource"}, false), - Description: "The role type. Allowed values are `project` or `tenant` or `project`", + Description: "The role type. Allowed values are `project` or `tenant` or `resource`", }, "permissions": { Type: schema.TypeSet, From f49633d33bf40c025ecdb0b2165eb82710dbc730 Mon Sep 17 00:00:00 2001 From: Sivaanand Murugesan Date: Thu, 21 Nov 2024 14:39:27 +0530 Subject: [PATCH 2/3] fix example --- examples/resources/spectrocloud_role/resource.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/resources/spectrocloud_role/resource.tf b/examples/resources/spectrocloud_role/resource.tf index b8e060b5..893f1082 100644 --- a/examples/resources/spectrocloud_role/resource.tf +++ b/examples/resources/spectrocloud_role/resource.tf @@ -17,10 +17,9 @@ resource "spectrocloud_role" "custom_role" { } // set permission with data source permission - variable "perms" { type = list(string) - default = ["API Key", "Audit", "Filter"] + default = ["User", "Team", "Role"] } data "spectrocloud_permission" "app_permissions" { From 345dc54a2f9a1db7510f29c22e5065d164cdb9c6 Mon Sep 17 00:00:00 2001 From: Sivaanand Murugesan Date: Tue, 26 Nov 2024 12:44:07 +0530 Subject: [PATCH 3/3] doc fix --- examples/resources/spectrocloud_role/resource.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/resources/spectrocloud_role/resource.tf b/examples/resources/spectrocloud_role/resource.tf index 893f1082..846bd92f 100644 --- a/examples/resources/spectrocloud_role/resource.tf +++ b/examples/resources/spectrocloud_role/resource.tf @@ -25,7 +25,7 @@ variable "perms" { data "spectrocloud_permission" "app_permissions" { for_each = toset(var.perms) name = each.key - scope = "tenant" + scope = "tenant" } resource "spectrocloud_role" "custom_role_permission" {