From 45e9406ee5ad3b5e195c8b988392077887f18bd4 Mon Sep 17 00:00:00 2001 From: Marcel Meulemans Date: Thu, 17 Oct 2024 19:35:06 +0200 Subject: [PATCH 1/3] Fix #33114, issue with quicksight data sets using format version 2 rls permission --- internal/service/quicksight/schema/data_set.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/service/quicksight/schema/data_set.go b/internal/service/quicksight/schema/data_set.go index b89922ba0db6..ec58fcc14946 100644 --- a/internal/service/quicksight/schema/data_set.go +++ b/internal/service/quicksight/schema/data_set.go @@ -1361,8 +1361,10 @@ func ExpandRowLevelPermissionDataSet(tfList []interface{}) *awstypes.RowLevelPer if v, ok := tfMap["format_version"].(string); ok { apiObject.FormatVersion = awstypes.RowLevelPermissionFormatVersion(v) } - if v, ok := tfMap[names.AttrNamespace].(string); ok { - apiObject.Namespace = aws.String(v) + if apiObject.FormatVersion == awstypes.RowLevelPermissionFormatVersionVersion1 { + if v, ok := tfMap[names.AttrNamespace].(string); ok { + apiObject.Namespace = aws.String(v) + } } if v, ok := tfMap[names.AttrStatus].(string); ok { apiObject.Status = awstypes.Status(v) From 79bdd1769fd8cb4212176ad6521fda73d786128e Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 17 Oct 2024 15:22:39 -0400 Subject: [PATCH 2/3] Add CHANGELOG entry. --- .changelog/39778.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/39778.txt diff --git a/.changelog/39778.txt b/.changelog/39778.txt new file mode 100644 index 000000000000..5f8fada3fd06 --- /dev/null +++ b/.changelog/39778.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_quicksight_data_set: Fix `InvalidParameterValueException: Invalid RowLevelPermissionDataSet. Namespace parameter should not be specified for Version 2` errors on Create and Update +``` \ No newline at end of file From da3ee3db24ebad1b3afb9b23a4fe2e911c12a7c9 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 18 Oct 2024 09:00:18 -0400 Subject: [PATCH 3/3] r/aws_quicksight_data_set: Don't send empty 'row_level_permission_data_set.*' attributes to AWS API. --- internal/service/quicksight/schema/data_set.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/internal/service/quicksight/schema/data_set.go b/internal/service/quicksight/schema/data_set.go index ec58fcc14946..e08b350ba56f 100644 --- a/internal/service/quicksight/schema/data_set.go +++ b/internal/service/quicksight/schema/data_set.go @@ -1352,21 +1352,19 @@ func ExpandRowLevelPermissionDataSet(tfList []interface{}) *awstypes.RowLevelPer apiObject := &awstypes.RowLevelPermissionDataSet{} - if v, ok := tfMap[names.AttrARN].(string); ok { + if v, ok := tfMap[names.AttrARN].(string); ok && v != "" { apiObject.Arn = aws.String(v) } - if v, ok := tfMap["permission_policy"].(string); ok { - apiObject.PermissionPolicy = awstypes.RowLevelPermissionPolicy(v) - } - if v, ok := tfMap["format_version"].(string); ok { + if v, ok := tfMap["format_version"].(string); ok && v != "" { apiObject.FormatVersion = awstypes.RowLevelPermissionFormatVersion(v) } - if apiObject.FormatVersion == awstypes.RowLevelPermissionFormatVersionVersion1 { - if v, ok := tfMap[names.AttrNamespace].(string); ok { - apiObject.Namespace = aws.String(v) - } + if v, ok := tfMap[names.AttrNamespace].(string); ok && v != "" { + apiObject.Namespace = aws.String(v) } - if v, ok := tfMap[names.AttrStatus].(string); ok { + if v, ok := tfMap["permission_policy"].(string); ok && v != "" { + apiObject.PermissionPolicy = awstypes.RowLevelPermissionPolicy(v) + } + if v, ok := tfMap[names.AttrStatus].(string); ok && v != "" { apiObject.Status = awstypes.Status(v) }