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

14324 - Fix kafka_versions being a required field #17571

Merged
merged 4 commits into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions aws/resource_aws_msk_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func resourceAwsMskConfiguration() *schema.Resource {
},
"kafka_versions": {
Type: schema.TypeSet,
Required: true,
Optional: true,
ForceNew: true,
Elem: &schema.Schema{
Type: schema.TypeString,
Expand All @@ -59,7 +59,6 @@ func resourceAwsMskConfigurationCreate(d *schema.ResourceData, meta interface{})
conn := meta.(*AWSClient).kafkaconn

input := &kafka.CreateConfigurationInput{
KafkaVersions: expandStringSet(d.Get("kafka_versions").(*schema.Set)),
Name: aws.String(d.Get("name").(string)),
ServerProperties: []byte(d.Get("server_properties").(string)),
}
Expand All @@ -68,6 +67,10 @@ func resourceAwsMskConfigurationCreate(d *schema.ResourceData, meta interface{})
input.Description = aws.String(v.(string))
}

if v, ok := d.GetOk("kafka_versions"); ok {
input.KafkaVersions = expandStringSet(v.(*schema.Set))
}

output, err := conn.CreateConfiguration(input)

if err != nil {
Expand Down
4 changes: 0 additions & 4 deletions aws/resource_aws_msk_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ func TestAccAWSMskConfiguration_basic(t *testing.T) {
testAccCheckMskConfigurationExists(resourceName, &configuration1),
testAccMatchResourceAttrRegionalARN(resourceName, "arn", "kafka", regexp.MustCompile(`configuration/.+`)),
resource.TestCheckResourceAttr(resourceName, "description", ""),
resource.TestCheckResourceAttr(resourceName, "kafka_versions.#", "1"),
resource.TestCheckResourceAttr(resourceName, "latest_revision", "1"),
resource.TestCheckResourceAttr(resourceName, "name", rName),
resource.TestMatchResourceAttr(resourceName, "server_properties", regexp.MustCompile(`auto.create.topics.enable = true`)),
Expand Down Expand Up @@ -286,7 +285,6 @@ func testAccCheckMskConfigurationExists(resourceName string, configuration *kafk
func testAccMskConfigurationConfig(rName string) string {
return fmt.Sprintf(`
resource "aws_msk_configuration" "test" {
kafka_versions = ["2.1.0"]
name = %[1]q

server_properties = <<PROPERTIES
Expand All @@ -301,7 +299,6 @@ func testAccMskConfigurationConfigDescription(rName, description string) string
return fmt.Sprintf(`
resource "aws_msk_configuration" "test" {
description = %[2]q
kafka_versions = ["2.1.0"]
name = %[1]q

server_properties = <<PROPERTIES
Expand All @@ -327,7 +324,6 @@ PROPERTIES
func testAccMskConfigurationConfigServerProperties(rName string, serverProperty string) string {
return fmt.Sprintf(`
resource "aws_msk_configuration" "test" {
kafka_versions = ["2.1.0"]
name = %[1]q

server_properties = <<PROPERTIES
Expand Down
2 changes: 2 additions & 0 deletions tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/S
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
github.com/hashicorp/go-getter v1.4.0/go.mod h1:7qxyCd8rBfcShwsvxgIguu4KbS3l8bUCwg2Umn7RjeY=
github.com/hashicorp/go-getter v1.5.0/go.mod h1:a7z7NPPfNQpJWcn4rSWFtdrSldqLdLPEF3d8nFMsSLM=
github.com/hashicorp/go-getter v1.5.1 h1:lM9sM02nvEApQGFgkXxWbhfqtyN+AyhQmi+MaMdBDOI=
github.com/hashicorp/go-getter v1.5.1/go.mod h1:a7z7NPPfNQpJWcn4rSWFtdrSldqLdLPEF3d8nFMsSLM=
github.com/hashicorp/go-getter v1.5.2 h1:XDo8LiAcDisiqZdv0TKgz+HtX3WN7zA2JD1R1tjsabE=
github.com/hashicorp/go-getter v1.5.2/go.mod h1:orNH3BTYLu/fIxGIdLjLoAJHWMDQ/UKQr5O4m3iBuoo=
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI=
Expand Down