Skip to content

Commit 53956a9

Browse files
Shani ErmanShani Erman
authored andcommitted
d
1 parent 814fe34 commit 53956a9

File tree

7 files changed

+43
-47
lines changed

7 files changed

+43
-47
lines changed

aquasec/data_permissions_sets_saas.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ func dataSourcePermissionsSetsSaas() *schema.Resource {
3838
Type: schema.TypeString,
3939
},
4040
},
41-
"ui_access": {
42-
Type: schema.TypeBool,
43-
Description: "Whether UI access is allowed",
44-
Computed: true,
45-
},
46-
"is_super": {
47-
Type: schema.TypeBool,
48-
Description: "Whether this is a super admin permission set",
49-
Computed: true,
50-
},
5141
},
5242
},
5343
},
@@ -71,8 +61,6 @@ func dataPermissionsSetsSaasRead(ctx context.Context, d *schema.ResourceData, m
7161
p["name"] = permissionsSet.Name
7262
p["description"] = permissionsSet.Description
7363
p["actions"] = permissionsSet.Actions
74-
p["ui_access"] = permissionsSet.UiAccess
75-
p["is_super"] = permissionsSet.IsSuper
7664
ps[i] = p
7765
}
7866

aquasec/resource_permission_set_saas.go

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,6 @@ func resourcePermissionSetSaas() *schema.Resource {
3131
Description: "Description of the permission set",
3232
Optional: true,
3333
},
34-
"ui_access": {
35-
Type: schema.TypeBool,
36-
Description: "Whether to allow UI access for users with this permission set",
37-
Optional: true,
38-
Default: true,
39-
},
40-
"is_super": {
41-
Type: schema.TypeBool,
42-
Description: "Give the permission set full access",
43-
Optional: true,
44-
Default: false,
45-
},
4634
"actions": {
4735
Type: schema.TypeList,
4836
Description: "List of allowed actions for the permission set",
@@ -56,8 +44,6 @@ func resourcePermissionSetSaas() *schema.Resource {
5644
}
5745

5846
func resourcePermissionSetSaasCreate(d *schema.ResourceData, m interface{}) error {
59-
result := isSaasEnv()
60-
log.Printf("SHANI-OUTPUT %v", result)
6147
ac := m.(*client.Client)
6248
name := d.Get("name").(string)
6349

@@ -74,7 +60,7 @@ func resourcePermissionSetSaasCreate(d *schema.ResourceData, m interface{}) erro
7460
func resourcePermissionSetSaasUpdate(d *schema.ResourceData, m interface{}) error {
7561
ac := m.(*client.Client)
7662

77-
if d.HasChanges("description", "ui_access", "is_super", "actions") {
63+
if d.HasChanges("description", "actions") {
7864
permSet := expandPermissionSetSaas(d)
7965
err := ac.UpdatePermissionSetSaas(permSet)
8066
if err != nil {
@@ -99,8 +85,6 @@ func resourcePermissionSetSaasRead(d *schema.ResourceData, m interface{}) error
9985

10086
d.Set("name", permSet.Name)
10187
d.Set("description", permSet.Description)
102-
d.Set("ui_access", permSet.UiAccess)
103-
d.Set("is_super", permSet.IsSuper)
10488
d.Set("actions", permSet.Actions)
10589

10690
return nil
@@ -123,8 +107,6 @@ func expandPermissionSetSaas(d *schema.ResourceData) *client.PermissionSetSaas {
123107
permSet := client.PermissionSetSaas{
124108
Name: d.Get("name").(string),
125109
Description: d.Get("description").(string),
126-
UiAccess: d.Get("ui_access").(bool),
127-
IsSuper: d.Get("is_super").(bool),
128110
}
129111

130112
if v, ok := d.GetOk("actions"); ok {
@@ -137,4 +119,4 @@ func expandPermissionSetSaas(d *schema.ResourceData) *client.PermissionSetSaas {
137119
}
138120

139121
return &permSet
140-
}
122+
}

aquasec/resource_permission_set_saas_test.go

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ var extendedTestActions = []string{
3030
"cnapp.dashboards.read",
3131
}
3232

33-
3433
var invalidConfigTestCases = []struct {
3534
name string
3635
config string
@@ -70,8 +69,6 @@ func testAccCheckAquasecPermissionSetSaas(name, description string, actions []st
7069
resource "aquasec_permission_set_saas" "new" {
7170
name = "%s"
7271
description = "%s"
73-
ui_access = false
74-
is_super = false
7572
actions = [%s]
7673
}`, name, description, actionsStr)
7774
}
@@ -232,7 +229,6 @@ func TestAquasecPermissionSetSaasWithExternalChanges(t *testing.T) {
232229
})
233230
}
234231

235-
236232
func TestAquasecPermissionSetSaasReadErrorHandling(t *testing.T) {
237233
if !isSaasEnv() {
238234
t.Skip("Skipping permission set test - not a SaaS environment")
@@ -283,3 +279,43 @@ func TestAquasecPermissionSetSaasUpdateErrorHandling(t *testing.T) {
283279
},
284280
})
285281
}
282+
283+
284+
func TestAquasecPermissionSetSaasValues(t *testing.T) {
285+
if !isSaasEnv() {
286+
t.Skip("Skipping permission set test - not a SaaS environment")
287+
}
288+
289+
name := acctest.RandomWithPrefix("tf-test")[:maxNameLength]
290+
description := "Created using Terraform"
291+
resourceName := "aquasec_permission_set_saas.new"
292+
293+
resource.Test(t, resource.TestCase{
294+
PreCheck: func() { testAccPreCheck(t) },
295+
Providers: testAccProviders,
296+
CheckDestroy: testAccPermissionSetSaasDestroy,
297+
Steps: []resource.TestStep{
298+
{
299+
Config: testAccCheckAquasecPermissionSetSaas(name, description, extendedTestActions),
300+
Check: resource.ComposeTestCheckFunc(
301+
testAccCheckAquasecPermissionSetSaasExists(resourceName),
302+
// Verify all attributes match exactly what was set
303+
resource.TestCheckResourceAttr(resourceName, "name", name),
304+
resource.TestCheckResourceAttr(resourceName, "description", description),
305+
// Verify each action in the actions list
306+
resource.TestCheckResourceAttr(resourceName, "actions.#", fmt.Sprintf("%d", len(extendedTestActions))),
307+
resource.TestCheckResourceAttr(resourceName, "actions.0", extendedTestActions[0]),
308+
resource.TestCheckResourceAttr(resourceName, "actions.1", extendedTestActions[1]),
309+
resource.TestCheckResourceAttr(resourceName, "actions.2", extendedTestActions[2]),
310+
resource.TestCheckResourceAttr(resourceName, "actions.3", extendedTestActions[3]),
311+
resource.TestCheckResourceAttr(resourceName, "actions.4", extendedTestActions[4]),
312+
),
313+
},
314+
{
315+
ResourceName: resourceName,
316+
ImportState: true,
317+
ImportStateVerify: true,
318+
},
319+
},
320+
})
321+
}

client/permission_sets_saas.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ type PermissionSetSaas struct {
3636
Name string `json:"name"`
3737
Description string `json:"description,omitempty"`
3838
Actions []string `json:"actions,omitempty"`
39-
UiAccess bool `json:"ui_access"`
40-
IsSuper bool `json:"is_super"`
4139
}
4240

4341
func unmarshalResponse(body string, target interface{}) error {

docs/data-sources/permissions_sets_saas.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,4 @@ Read-Only:
3737

3838
- `actions` (List of String)
3939
- `description` (String)
40-
- `is_super` (Boolean)
41-
- `name` (String)
42-
- `ui_access` (Boolean)
40+
- `name` (String)

docs/resources/permissions_sets_saas.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ The `aquasec_permission_set_saas` resource manages your Permission Set within Aq
1515
resource "aquasec_permission_set_saas" "example" {
1616
name = "my_saas_perm_set"
1717
description = "Test Permissions Sets for SaaS"
18-
ui_access = false
19-
is_super = false
2018
actions = [
2119
"account_mgmt.groups.read",
2220
"cspm.cloud_accounts.read",
@@ -36,8 +34,6 @@ resource "aquasec_permission_set_saas" "example" {
3634
## Optional
3735

3836
- `description` (String) Description of the permission set
39-
- `ui_access` (Boolean) Whether UI access is allowed
40-
- `is_super` (Boolean) Whether this is a super admin permission set
4137

4238
## Read-Only
4339

examples/resources/aquasec_permission_set_saas/resource.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
resource "aquasec_permission_set_saas" "example" {
22
name = "saas_permission_set"
33
description = "SaaS Permission Set created by Terraform"
4-
ui_access = false
5-
is_super = false
64
actions = [
75
###################
86
# Account Management

0 commit comments

Comments
 (0)