diff --git a/aws/resource_aws_ssm_maintenance_window_task.go b/aws/resource_aws_ssm_maintenance_window_task.go index 34513f900e6..579bad13ee8 100644 --- a/aws/resource_aws_ssm_maintenance_window_task.go +++ b/aws/resource_aws_ssm_maintenance_window_task.go @@ -117,7 +117,7 @@ func resourceAwsSsmMaintenanceWindowTask() *schema.Resource { }, "task_parameters": { - Type: schema.TypeList, + Type: schema.TypeSet, Optional: true, ConflictsWith: []string{"task_invocation_parameters"}, Deprecated: "use 'task_invocation_parameters' argument instead", @@ -671,7 +671,7 @@ func resourceAwsSsmMaintenanceWindowTaskCreate(d *schema.ResourceData, meta inte } if v, ok := d.GetOk("task_parameters"); ok { - params.TaskParameters = expandAwsSsmTaskParameters(v.([]interface{})) + params.TaskParameters = expandAwsSsmTaskParameters(v.(*schema.Set).List()) } if v, ok := d.GetOk("task_invocation_parameters"); ok { @@ -773,7 +773,7 @@ func resourceAwsSsmMaintenanceWindowTaskUpdate(d *schema.ResourceData, meta inte } if v, ok := d.GetOk("task_parameters"); ok { - params.TaskParameters = expandAwsSsmTaskParameters(v.([]interface{})) + params.TaskParameters = expandAwsSsmTaskParameters(v.(*schema.Set).List()) } if v, ok := d.GetOk("task_invocation_parameters"); ok { diff --git a/aws/resource_aws_ssm_maintenance_window_task_test.go b/aws/resource_aws_ssm_maintenance_window_task_test.go index 5def2eda82e..0a721b65771 100644 --- a/aws/resource_aws_ssm_maintenance_window_task_test.go +++ b/aws/resource_aws_ssm_maintenance_window_task_test.go @@ -220,6 +220,32 @@ func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationStepFunctionParameters(t * }) } +func TestAccAWSSSMMaintenanceWindowTask_TaskParameters(t *testing.T) { + var task ssm.MaintenanceWindowTask + resourceName := "aws_ssm_maintenance_window_task.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSSMMaintenanceWindowTaskConfigTaskParametersMultiple(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMMaintenanceWindowTaskExists(resourceName, &task), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSSSMMaintenanceWindowTaskImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + func testAccCheckAwsSsmWindowsTaskNotRecreated(t *testing.T, before, after *ssm.MaintenanceWindowTask) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -710,3 +736,89 @@ EOF `, rName) } + +func testAccAWSSSMMaintenanceWindowTaskConfigTaskParametersMultiple(rName string) string { + return fmt.Sprintf(` +resource "aws_ssm_maintenance_window" "test" { + cutoff = 1 + duration = 3 + name = %[1]q + schedule = "cron(0 16 ? * TUE *)" +} + +resource "aws_ssm_maintenance_window_target" "test" { + name = %[1]q + resource_type = "INSTANCE" + window_id = "${aws_ssm_maintenance_window.test.id}" + + targets { + key = "tag:Name" + values = ["tf-acc-test"] + } +} + +resource "aws_iam_role" "test" { + name = %[1]q + assume_role_policy = <