func enableASGSuspendedProcesses(d *schema.ResourceData, conn *autoscaling.AutoScaling) error { props := &autoscaling.ScalingProcessQuery{ AutoScalingGroupName: aws.String(d.Id()), ScalingProcesses: expandStringList(d.Get("suspended_processes").(*schema.Set).List()), } _, err := conn.SuspendProcesses(props) if err != nil { return err } return nil }
func updateASGSuspendedProcesses(d *schema.ResourceData, conn *autoscaling.AutoScaling) error { o, n := d.GetChange("suspended_processes") if o == nil { o = new(schema.Set) } if n == nil { n = new(schema.Set) } os := o.(*schema.Set) ns := n.(*schema.Set) resumeProcesses := os.Difference(ns) if resumeProcesses.Len() != 0 { props := &autoscaling.ScalingProcessQuery{ AutoScalingGroupName: aws.String(d.Id()), ScalingProcesses: expandStringList(resumeProcesses.List()), } _, err := conn.ResumeProcesses(props) if err != nil { return fmt.Errorf("Error Resuming Processes for ASG %q: %s", d.Id(), err) } } suspendedProcesses := ns.Difference(os) if suspendedProcesses.Len() != 0 { props := &autoscaling.ScalingProcessQuery{ AutoScalingGroupName: aws.String(d.Id()), ScalingProcesses: expandStringList(suspendedProcesses.List()), } _, err := conn.SuspendProcesses(props) if err != nil { return fmt.Errorf("Error Suspending Processes for ASG %q: %s", d.Id(), err) } } return nil }