Skip to content

Commit

Permalink
Merge pull request #1 from catsby/pr-4693
Browse files Browse the repository at this point in the history
provider/aws: Default Autoscaling Schedule min/max/desired to zero
  • Loading branch information
stack72 committed Jan 21, 2016
2 parents 318db85 + 9ee6f82 commit 8f2cbf5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
14 changes: 3 additions & 11 deletions builtin/providers/aws/resource_aws_autoscaling_schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,9 @@ func resourceAwsAutoscalingScheduleCreate(d *schema.ResourceData, meta interface
params.Recurrence = aws.String(attr.(string))
}

if attr, ok := d.GetOk("min_size"); ok {
params.MinSize = aws.Int64(int64(attr.(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)))
}
params.MinSize = aws.Int64(int64(d.Get("min_size").(int)))
params.MaxSize = aws.Int64(int64(d.Get("max_size").(int)))
params.DesiredCapacity = aws.Int64(int64(d.Get("desired_capacity").(int)))

log.Printf("[INFO] Creating Autoscaling Scheduled Action: %s", d.Get("scheduled_action_name").(string))
_, err := autoscalingconn.PutScheduledUpdateGroupAction(params)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ resource "aws_autoscaling_schedule" "foobar" {
max_size = 0
min_size = 0
desired_capacity = 0
start_time = "2016-01-16T07:00:00Z"
end_time = "2016-01-16T13:00:00Z"
start_time = "2018-01-16T07:00:00Z"
end_time = "2018-01-16T13:00:00Z"
autoscaling_group_name = "${aws_autoscaling_group.foobar.name}"
}
`)
Original file line number Diff line number Diff line change
Expand Up @@ -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 ).
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.
* `min_size` - (Optional) The minimum size for the Auto Scaling group.
* `max_size` - (Optional) The maximum size for the Auto Scaling group.
* `desired_capacity` - (Optional) The number of EC2 instances that should be running in the group.
* `min_size` - (Optional) The minimum size for the Auto Scaling group. Default
0.
* `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.

## Attribute Reference
* `arn` - The ARN assigned by AWS to the autoscaling schedule.
* `arn` - The ARN assigned by AWS to the autoscaling schedule.

0 comments on commit 8f2cbf5

Please sign in to comment.