diff --git a/aws/resource_aws_ssm_maintenance_window.go b/aws/resource_aws_ssm_maintenance_window.go index 5ce56677867..e895b532355 100644 --- a/aws/resource_aws_ssm_maintenance_window.go +++ b/aws/resource_aws_ssm_maintenance_window.go @@ -68,7 +68,7 @@ func resourceAwsSsmMaintenanceWindowCreate(d *schema.ResourceData, meta interfac } d.SetId(*resp.WindowId) - return resourceAwsSsmMaintenanceWindowRead(d, meta) + return resourceAwsSsmMaintenanceWindowUpdate(d, meta) } func resourceAwsSsmMaintenanceWindowUpdate(d *schema.ResourceData, meta interface{}) error { @@ -98,9 +98,7 @@ func resourceAwsSsmMaintenanceWindowUpdate(d *schema.ResourceData, meta interfac params.AllowUnassociatedTargets = aws.Bool(d.Get("allow_unassociated_targets").(bool)) } - if d.HasChange("enabled") { - params.Enabled = aws.Bool(d.Get("enabled").(bool)) - } + params.Enabled = aws.Bool(d.Get("enabled").(bool)) _, err := ssmconn.UpdateMaintenanceWindow(params) if err != nil { diff --git a/aws/resource_aws_ssm_maintenance_window_test.go b/aws/resource_aws_ssm_maintenance_window_test.go index d316e6bdd7d..2fca94f3739 100644 --- a/aws/resource_aws_ssm_maintenance_window_test.go +++ b/aws/resource_aws_ssm_maintenance_window_test.go @@ -30,6 +30,8 @@ func TestAccAWSSSMMaintenanceWindow_basic(t *testing.T) { "aws_ssm_maintenance_window.foo", "cutoff", "1"), resource.TestCheckResourceAttr( "aws_ssm_maintenance_window.foo", "name", fmt.Sprintf("maintenance-window-%s", name)), + resource.TestCheckResourceAttr( + "aws_ssm_maintenance_window.foo", "enabled", "false"), ), }, { @@ -44,6 +46,8 @@ func TestAccAWSSSMMaintenanceWindow_basic(t *testing.T) { "aws_ssm_maintenance_window.foo", "cutoff", "8"), resource.TestCheckResourceAttr( "aws_ssm_maintenance_window.foo", "name", fmt.Sprintf("updated-maintenance-window-%s", name)), + resource.TestCheckResourceAttr( + "aws_ssm_maintenance_window.foo", "enabled", "true"), ), }, }, @@ -123,6 +127,7 @@ resource "aws_ssm_maintenance_window" "foo" { schedule = "cron(0 16 ? * TUE *)" duration = 3 cutoff = 1 + enabled = false } `, rName) @@ -135,6 +140,7 @@ resource "aws_ssm_maintenance_window" "foo" { schedule = "cron(0 16 ? * WED *)" duration = 10 cutoff = 8 + enabled = true } `, rName)