Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_quicksight: convert permissions to type set #33023

Merged
merged 4 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changelog/33023.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```release-note:bug
resource/aws_quicksight_analysis: Covert `permissions` argument to set type, preventing persistent differences
```
```release-note:bug
resource/aws_quicksight_dashboard: Covert `permissions` argument to set type, preventing persistent differences
```
```release-note:bug
resource/aws_quicksight_template: Covert `permissions` argument to set type, preventing persistent differences
```
12 changes: 6 additions & 6 deletions internal/service/quicksight/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func ResourceAnalysis() *schema.Resource {
},
"parameters": quicksightschema.ParametersSchema(),
"permissions": {
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
MinItems: 1,
MaxItems: 64,
Expand Down Expand Up @@ -174,8 +174,8 @@ func resourceAnalysisCreate(ctx context.Context, d *schema.ResourceData, meta in
input.Parameters = quicksightschema.ExpandParameters(d.Get("parameters").([]interface{}))
}

if v, ok := d.GetOk("permissions"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil {
input.Permissions = expandResourcePermissions(v.([]interface{}))
if v, ok := d.Get("permissions").(*schema.Set); ok && v.Len() > 0 {
input.Permissions = expandResourcePermissions(v.List())
}

_, err := conn.CreateAnalysisWithContext(ctx, input)
Expand Down Expand Up @@ -293,10 +293,10 @@ func resourceAnalysisUpdate(ctx context.Context, d *schema.ResourceData, meta in

if d.HasChange("permissions") {
oraw, nraw := d.GetChange("permissions")
o := oraw.([]interface{})
n := nraw.([]interface{})
o := oraw.(*schema.Set)
n := nraw.(*schema.Set)

toGrant, toRevoke := DiffPermissions(o, n)
toGrant, toRevoke := DiffPermissions(o.List(), n.List())

params := &quicksight.UpdateAnalysisPermissionsInput{
AwsAccountId: aws.String(awsAccountId),
Expand Down
12 changes: 6 additions & 6 deletions internal/service/quicksight/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func ResourceDashboard() *schema.Resource {
},
"parameters": quicksightschema.ParametersSchema(),
"permissions": {
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
MinItems: 1,
MaxItems: 64,
Expand Down Expand Up @@ -183,8 +183,8 @@ func resourceDashboardCreate(ctx context.Context, d *schema.ResourceData, meta i
input.Parameters = quicksightschema.ExpandParameters(d.Get("parameters").([]interface{}))
}

if v, ok := d.GetOk("permissions"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil {
input.Permissions = expandResourcePermissions(v.([]interface{}))
if v, ok := d.Get("permissions").(*schema.Set); ok && v.Len() > 0 {
input.Permissions = expandResourcePermissions(v.List())
}

_, err := conn.CreateDashboardWithContext(ctx, input)
Expand Down Expand Up @@ -318,10 +318,10 @@ func resourceDashboardUpdate(ctx context.Context, d *schema.ResourceData, meta i

if d.HasChange("permissions") {
oraw, nraw := d.GetChange("permissions")
o := oraw.([]interface{})
n := nraw.([]interface{})
o := oraw.(*schema.Set)
n := nraw.(*schema.Set)

toGrant, toRevoke := DiffPermissions(o, n)
toGrant, toRevoke := DiffPermissions(o.List(), n.List())

params := &quicksight.UpdateDashboardPermissionsInput{
AwsAccountId: aws.String(awsAccountId),
Expand Down
12 changes: 6 additions & 6 deletions internal/service/quicksight/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func ResourceTemplate() *schema.Resource {
ValidateFunc: validation.StringLenBetween(1, 2048),
},
"permissions": {
Type: schema.TypeList,
Type: schema.TypeSet,
Optional: true,
MinItems: 1,
MaxItems: 64,
Expand Down Expand Up @@ -160,8 +160,8 @@ func resourceTemplateCreate(ctx context.Context, d *schema.ResourceData, meta in
input.Definition = quicksightschema.ExpandTemplateDefinition(d.Get("definition").([]interface{}))
}

if v, ok := d.GetOk("permissions"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil {
input.Permissions = expandResourcePermissions(v.([]interface{}))
if v, ok := d.Get("permissions").(*schema.Set); ok && v.Len() > 0 {
input.Permissions = expandResourcePermissions(v.List())
}

_, err := conn.CreateTemplateWithContext(ctx, input)
Expand Down Expand Up @@ -273,10 +273,10 @@ func resourceTemplateUpdate(ctx context.Context, d *schema.ResourceData, meta in

if d.HasChange("permissions") {
oraw, nraw := d.GetChange("permissions")
o := oraw.([]interface{})
n := nraw.([]interface{})
o := oraw.(*schema.Set)
n := nraw.(*schema.Set)

toGrant, toRevoke := DiffPermissions(o, n)
toGrant, toRevoke := DiffPermissions(o.List(), n.List())

params := &quicksight.UpdateTemplatePermissionsInput{
AwsAccountId: aws.String(awsAccountId),
Expand Down