From 9ee6f822f61621b7e57237d9dffcea4787c63c5c Mon Sep 17 00:00:00 2001 From: clint shryock Date: Thu, 21 Jan 2016 16:02:46 -0600 Subject: [PATCH] provider/aws: Default Autoscaling Schedule min/max/desired to zero --- .../aws/resource_aws_autoscaling_schedule.go | 14 +++----------- .../aws/resource_aws_autoscaling_schedule_test.go | 4 ++-- .../aws/r/autoscaling_schedule.html.markdown | 10 ++++++---- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/builtin/providers/aws/resource_aws_autoscaling_schedule.go b/builtin/providers/aws/resource_aws_autoscaling_schedule.go index b58f46599..200b0ee37 100644 --- a/builtin/providers/aws/resource_aws_autoscaling_schedule.go +++ b/builtin/providers/aws/resource_aws_autoscaling_schedule.go @@ -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) diff --git a/builtin/providers/aws/resource_aws_autoscaling_schedule_test.go b/builtin/providers/aws/resource_aws_autoscaling_schedule_test.go index 6053307b0..c332e1400 100644 --- a/builtin/providers/aws/resource_aws_autoscaling_schedule_test.go +++ b/builtin/providers/aws/resource_aws_autoscaling_schedule_test.go @@ -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}" } `) diff --git a/website/source/docs/providers/aws/r/autoscaling_schedule.html.markdown b/website/source/docs/providers/aws/r/autoscaling_schedule.html.markdown index 4ad947293..de8c24ce6 100644 --- a/website/source/docs/providers/aws/r/autoscaling_schedule.html.markdown +++ b/website/source/docs/providers/aws/r/autoscaling_schedule.html.markdown @@ -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. \ No newline at end of file +* `arn` - The ARN assigned by AWS to the autoscaling schedule.