From 8c7aaf77dfb624f4c1d4a92b17dc6c65ea448037 Mon Sep 17 00:00:00 2001 From: xiaxuantan Date: Tue, 14 Nov 2023 12:00:35 -0800 Subject: [PATCH 1/3] longer msk config name --- .../kafka/configuration_data_source.go | 2 +- .../kafka/configuration_data_source_test.go | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/internal/service/kafka/configuration_data_source.go b/internal/service/kafka/configuration_data_source.go index 1107a09bcad..13fb6b8b23a 100644 --- a/internal/service/kafka/configuration_data_source.go +++ b/internal/service/kafka/configuration_data_source.go @@ -43,7 +43,7 @@ func DataSourceConfiguration() *schema.Resource { "name": { Type: schema.TypeString, Required: true, - ValidateFunc: validation.StringLenBetween(1, 64), + ValidateFunc: validation.StringLenBetween(1, 128), }, "server_properties": { Type: schema.TypeString, diff --git a/internal/service/kafka/configuration_data_source_test.go b/internal/service/kafka/configuration_data_source_test.go index 53cdf439047..7ad98e816ba 100644 --- a/internal/service/kafka/configuration_data_source_test.go +++ b/internal/service/kafka/configuration_data_source_test.go @@ -5,6 +5,7 @@ package kafka_test import ( "fmt" + "strings" "testing" "github.com/aws/aws-sdk-go/service/kafka" @@ -40,6 +41,34 @@ func TestAccKafkaConfigurationDataSource_name(t *testing.T) { }) } +func TestAccKafkaConfigurationDataSource_longestName(t *testing.T) { + ctx := acctest.Context(t) + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + rName = rName + strings.Repeat("a", 128-len(rName)) // make configuration name 128 characters + dataSourceName := "data.aws_msk_configuration.test" + resourceName := "aws_msk_configuration.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, kafka.EndpointsID), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckConfigurationDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccConfigurationDataSourceConfig_name(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(resourceName, "arn", dataSourceName, "arn"), + resource.TestCheckResourceAttrPair(resourceName, "description", dataSourceName, "description"), + resource.TestCheckResourceAttrPair(resourceName, "kafka_versions.#", dataSourceName, "kafka_versions.#"), + resource.TestCheckResourceAttrPair(resourceName, "latest_revision", dataSourceName, "latest_revision"), + resource.TestCheckResourceAttrPair(resourceName, "name", dataSourceName, "name"), + resource.TestCheckResourceAttrPair(resourceName, "server_properties", dataSourceName, "server_properties"), + ), + }, + }, + }) +} + func testAccConfigurationDataSourceConfig_name(rName string) string { return fmt.Sprintf(` resource "aws_msk_configuration" "test" { From 848ff76b5a5363d0513a4d2321c1a879f70957c7 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 8 Jan 2024 16:38:35 -0500 Subject: [PATCH 2/3] Add CHANGELOG entry. --- .changelog/34399.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/34399.txt diff --git a/.changelog/34399.txt b/.changelog/34399.txt new file mode 100644 index 00000000000..d95bb7adf95 --- /dev/null +++ b/.changelog/34399.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +data-source/aws_msk_configuration: Remove `name` length validation +``` \ No newline at end of file From e13e797e296a3805e9a3eade8dbd7989180c6334 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 8 Jan 2024 16:39:03 -0500 Subject: [PATCH 3/3] d/aws_msk_configuration: Remove `name` length validation. --- .../kafka/configuration_data_source.go | 6 ++-- .../kafka/configuration_data_source_test.go | 29 ------------------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/internal/service/kafka/configuration_data_source.go b/internal/service/kafka/configuration_data_source.go index 13fb6b8b23a..e034d5cb389 100644 --- a/internal/service/kafka/configuration_data_source.go +++ b/internal/service/kafka/configuration_data_source.go @@ -10,7 +10,6 @@ import ( "github.com/aws/aws-sdk-go/service/kafka" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" ) @@ -41,9 +40,8 @@ func DataSourceConfiguration() *schema.Resource { Computed: true, }, "name": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringLenBetween(1, 128), + Type: schema.TypeString, + Required: true, }, "server_properties": { Type: schema.TypeString, diff --git a/internal/service/kafka/configuration_data_source_test.go b/internal/service/kafka/configuration_data_source_test.go index 7ad98e816ba..53cdf439047 100644 --- a/internal/service/kafka/configuration_data_source_test.go +++ b/internal/service/kafka/configuration_data_source_test.go @@ -5,7 +5,6 @@ package kafka_test import ( "fmt" - "strings" "testing" "github.com/aws/aws-sdk-go/service/kafka" @@ -41,34 +40,6 @@ func TestAccKafkaConfigurationDataSource_name(t *testing.T) { }) } -func TestAccKafkaConfigurationDataSource_longestName(t *testing.T) { - ctx := acctest.Context(t) - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - rName = rName + strings.Repeat("a", 128-len(rName)) // make configuration name 128 characters - dataSourceName := "data.aws_msk_configuration.test" - resourceName := "aws_msk_configuration.test" - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(ctx, t) }, - ErrorCheck: acctest.ErrorCheck(t, kafka.EndpointsID), - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckConfigurationDestroy(ctx), - Steps: []resource.TestStep{ - { - Config: testAccConfigurationDataSourceConfig_name(rName), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(resourceName, "arn", dataSourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "description", dataSourceName, "description"), - resource.TestCheckResourceAttrPair(resourceName, "kafka_versions.#", dataSourceName, "kafka_versions.#"), - resource.TestCheckResourceAttrPair(resourceName, "latest_revision", dataSourceName, "latest_revision"), - resource.TestCheckResourceAttrPair(resourceName, "name", dataSourceName, "name"), - resource.TestCheckResourceAttrPair(resourceName, "server_properties", dataSourceName, "server_properties"), - ), - }, - }, - }) -} - func testAccConfigurationDataSourceConfig_name(rName string) string { return fmt.Sprintf(` resource "aws_msk_configuration" "test" {