provider/aws: Default Autoscaling Schedule min/max/desired to zero

This commit is contained in:
clint shryock 2016-01-21 16:02:46 -06:00
parent 318db85623
commit 9ee6f822f6
3 changed files with 11 additions and 17 deletions

View File

@ -97,17 +97,9 @@ func resourceAwsAutoscalingScheduleCreate(d *schema.ResourceData, meta interface
params.Recurrence = aws.String(attr.(string)) params.Recurrence = aws.String(attr.(string))
} }
if attr, ok := d.GetOk("min_size"); ok { params.MinSize = aws.Int64(int64(d.Get("min_size").(int)))
params.MinSize = aws.Int64(int64(attr.(int))) params.MaxSize = aws.Int64(int64(d.Get("max_size").(int)))
} params.DesiredCapacity = aws.Int64(int64(d.Get("desired_capacity").(int)))
if attr, ok := d.GetOk("max_size"); ok {
params.MaxSize = aws.Int64(int64(attr.(int)))
}
if attr, ok := d.GetOk("desired_capacity"); ok {
params.DesiredCapacity = aws.Int64(int64(attr.(int)))
}
log.Printf("[INFO] Creating Autoscaling Scheduled Action: %s", d.Get("scheduled_action_name").(string)) log.Printf("[INFO] Creating Autoscaling Scheduled Action: %s", d.Get("scheduled_action_name").(string))
_, err := autoscalingconn.PutScheduledUpdateGroupAction(params) _, err := autoscalingconn.PutScheduledUpdateGroupAction(params)

View File

@ -216,8 +216,8 @@ resource "aws_autoscaling_schedule" "foobar" {
max_size = 0 max_size = 0
min_size = 0 min_size = 0
desired_capacity = 0 desired_capacity = 0
start_time = "2016-01-16T07:00:00Z" start_time = "2018-01-16T07:00:00Z"
end_time = "2016-01-16T13:00:00Z" end_time = "2018-01-16T13:00:00Z"
autoscaling_group_name = "${aws_autoscaling_group.foobar.name}" autoscaling_group_name = "${aws_autoscaling_group.foobar.name}"
} }
`) `)

View File

@ -45,11 +45,13 @@ The following arguments are supported:
* `end_time` - (Optional) The time for this action to end, in "YYYY-MM-DDThh:mm:ssZ" format in UTC/GMT only (for example, 2014-06-01T00:00:00Z ). * `end_time` - (Optional) The time for this action to end, in "YYYY-MM-DDThh:mm:ssZ" format in UTC/GMT only (for example, 2014-06-01T00:00:00Z ).
If you try to schedule your action in the past, Auto Scaling returns an error messag If you try to schedule your action in the past, Auto Scaling returns an error messag
* `recurrence` - (Optional) The time when recurring future actions will start. Start time is specified by the user following the Unix cron syntax format. * `recurrence` - (Optional) The time when recurring future actions will start. Start time is specified by the user following the Unix cron syntax format.
* `min_size` - (Optional) The minimum size for the Auto Scaling group. * `min_size` - (Optional) The minimum size for the Auto Scaling group. Default
* `max_size` - (Optional) The maximum size for the Auto Scaling group. 0.
* `desired_capacity` - (Optional) The number of EC2 instances that should be running in the group. * `max_size` - (Optional) The maximum size for the Auto Scaling group. Default
0.
* `desired_capacity` - (Optional) The number of EC2 instances that should be running in the group. Default 0.
~> **NOTE:** When `start_time` and `end_time` are specified with `recurrence` , they form the boundaries of when the recurring action will start and stop. ~> **NOTE:** When `start_time` and `end_time` are specified with `recurrence` , they form the boundaries of when the recurring action will start and stop.
## Attribute Reference ## Attribute Reference
* `arn` - The ARN assigned by AWS to the autoscaling schedule. * `arn` - The ARN assigned by AWS to the autoscaling schedule.