From 5c90eeda526b174d3356b73d8d85625b3dfe3673 Mon Sep 17 00:00:00 2001 From: Gaylord Mazelier Date: Fri, 11 Dec 2020 19:47:55 +0100 Subject: [PATCH 1/2] Ensure not nil, even if no partition keys defined. --- aws/resource_aws_glue_catalog_table.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aws/resource_aws_glue_catalog_table.go b/aws/resource_aws_glue_catalog_table.go index 527f16ba141..122581d4429 100644 --- a/aws/resource_aws_glue_catalog_table.go +++ b/aws/resource_aws_glue_catalog_table.go @@ -450,6 +450,8 @@ func expandGlueTableInput(d *schema.ResourceData) *glue.TableInput { if v, ok := d.GetOk("partition_keys"); ok { tableInput.PartitionKeys = expandGlueColumns(v.([]interface{})) + } else { + tableInput.PartitionKeys = []*glue.Column{} } if v, ok := d.GetOk("view_original_text"); ok { From 159b09f3f80147e10cfac6c95a348888052b4886 Mon Sep 17 00:00:00 2001 From: Gaylord Mazelier Date: Fri, 11 Dec 2020 19:48:39 +0100 Subject: [PATCH 2/2] Check that is empty is base test case --- aws/resource_aws_glue_catalog_table_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/aws/resource_aws_glue_catalog_table_test.go b/aws/resource_aws_glue_catalog_table_test.go index c44144e9f52..8f575fe2b74 100644 --- a/aws/resource_aws_glue_catalog_table_test.go +++ b/aws/resource_aws_glue_catalog_table_test.go @@ -28,6 +28,7 @@ func TestAccAWSGlueCatalogTable_basic(t *testing.T) { testAccCheckResourceAttrRegionalARN(resourceName, "arn", "glue", fmt.Sprintf("table/%s/%s", rName, rName)), resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "database_name", rName), + resource.TestCheckResourceAttr(resourceName, "partition_keys.#", "0"), testAccCheckResourceAttrAccountID(resourceName, "catalog_id"), ), },