@@ -453,6 +453,46 @@ func TestAccQuickSightDataSet_tags(t *testing.T) {
453
453
})
454
454
}
455
455
456
+ func TestAccQuickSightDataSet_noPhysicalTableMap (t * testing.T ) {
457
+ ctx := acctest .Context (t )
458
+ var dataSet quicksight.DataSet
459
+ resourceName := "aws_quicksight_data_set.test"
460
+ rName := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
461
+ rId := sdkacctest .RandomWithPrefix (acctest .ResourcePrefix )
462
+
463
+ resource .ParallelTest (t , resource.TestCase {
464
+ PreCheck : func () { acctest .PreCheck (ctx , t ) },
465
+ ErrorCheck : acctest .ErrorCheck (t , quicksight .EndpointsID ),
466
+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories ,
467
+ CheckDestroy : testAccCheckDataSetDestroy (ctx ),
468
+ Steps : []resource.TestStep {
469
+ {
470
+ Config : testAccDataSetConfigNoPhysicalTableMap (rId , rName ),
471
+ Check : resource .ComposeTestCheckFunc (
472
+ testAccCheckDataSetExists (ctx , resourceName , & dataSet ),
473
+ resource .TestCheckResourceAttr (resourceName , "data_set_id" , rId ),
474
+ acctest .CheckResourceAttrRegionalARN (resourceName , "arn" , "quicksight" , fmt .Sprintf ("dataset/%s" , rId )),
475
+ resource .TestCheckResourceAttr (resourceName , "name" , rName ),
476
+ resource .TestCheckResourceAttr (resourceName , "import_mode" , "SPICE" ),
477
+ resource .TestCheckResourceAttr (resourceName , "physical_table_map.#" , "0" ),
478
+ resource .TestCheckResourceAttr (resourceName , "logical_table_map.#" , "3" ),
479
+ resource .TestCheckResourceAttr (resourceName , "logical_table_map.0.logical_table_map_id" , "joined" ),
480
+ resource .TestCheckResourceAttr (resourceName , "logical_table_map.0.alias" , "j" ),
481
+ resource .TestCheckResourceAttr (resourceName , "logical_table_map.0.source.0.join_instruction.0.right_operand" , "right" ),
482
+ resource .TestCheckResourceAttr (resourceName , "logical_table_map.0.source.0.join_instruction.0.left_operand" , "left" ),
483
+ resource .TestCheckResourceAttr (resourceName , "logical_table_map.0.source.0.join_instruction.0.type" , "INNER" ),
484
+ resource .TestCheckResourceAttr (resourceName , "logical_table_map.0.source.0.join_instruction.0.on_clause" , "Column1 = Column2" ),
485
+ ),
486
+ },
487
+ {
488
+ ResourceName : resourceName ,
489
+ ImportState : true ,
490
+ ImportStateVerify : true ,
491
+ },
492
+ },
493
+ })
494
+ }
495
+
456
496
func testAccCheckDataSetExists (ctx context.Context , resourceName string , dataSet * quicksight.DataSet ) resource.TestCheckFunc {
457
497
return func (s * terraform.State ) error {
458
498
rs , ok := s .RootModule ().Resources [resourceName ]
@@ -1034,3 +1074,84 @@ resource "aws_quicksight_data_set" "test" {
1034
1074
}
1035
1075
` , rId , rName , key1 , value1 , key2 , value2 ))
1036
1076
}
1077
+
1078
+ func testAccDataSetConfigNoPhysicalTableMap (rId , rName string ) string {
1079
+ return acctest .ConfigCompose (
1080
+ testAccDataSetConfigBase (rId , rName ),
1081
+ fmt .Sprintf (`
1082
+ resource "aws_quicksight_data_set" "left" {
1083
+ data_set_id = "%[1]s-left"
1084
+ name = "%[2]s-left"
1085
+ import_mode = "SPICE"
1086
+
1087
+ physical_table_map {
1088
+ physical_table_map_id = "%[1]s-left"
1089
+ s3_source {
1090
+ data_source_arn = aws_quicksight_data_source.test.arn
1091
+ input_columns {
1092
+ name = "Column1"
1093
+ type = "STRING"
1094
+ }
1095
+ upload_settings {
1096
+ format = "JSON"
1097
+ }
1098
+ }
1099
+ }
1100
+ }
1101
+
1102
+ resource "aws_quicksight_data_set" "right" {
1103
+ data_set_id = "%[1]s-right"
1104
+ name = "%[2]s-right"
1105
+ import_mode = "SPICE"
1106
+
1107
+ physical_table_map {
1108
+ physical_table_map_id = "%[1]s-right"
1109
+ s3_source {
1110
+ data_source_arn = aws_quicksight_data_source.test.arn
1111
+ input_columns {
1112
+ name = "Column2"
1113
+ type = "STRING"
1114
+ }
1115
+ upload_settings {
1116
+ format = "JSON"
1117
+ }
1118
+ }
1119
+ }
1120
+ }
1121
+
1122
+ resource "aws_quicksight_data_set" "test" {
1123
+ data_set_id = %[1]q
1124
+ name = %[2]q
1125
+ import_mode = "SPICE"
1126
+
1127
+ logical_table_map {
1128
+ logical_table_map_id = "right"
1129
+ alias = "r"
1130
+ source {
1131
+ data_set_arn = aws_quicksight_data_set.right.arn
1132
+ }
1133
+ }
1134
+
1135
+ logical_table_map {
1136
+ logical_table_map_id = "left"
1137
+ alias = "l"
1138
+ source {
1139
+ data_set_arn = aws_quicksight_data_set.left.arn
1140
+ }
1141
+ }
1142
+
1143
+ logical_table_map {
1144
+ logical_table_map_id = "joined"
1145
+ alias = "j"
1146
+ source {
1147
+ join_instruction {
1148
+ left_operand = "left"
1149
+ right_operand = "right"
1150
+ type = "INNER"
1151
+ on_clause = "Column1 = Column2"
1152
+ }
1153
+ }
1154
+ }
1155
+ }
1156
+ ` , rId , rName ))
1157
+ }
0 commit comments