From 9fa5b395e26c0103face74a339a1697e89e1937f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1si=20G=C3=A1bor?= Date: Wed, 16 Jun 2021 13:47:29 +0200 Subject: [PATCH 1/4] Add time_zone parameter to aws_autoscaling_schedule --- aws/resource_aws_autoscaling_schedule.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/aws/resource_aws_autoscaling_schedule.go b/aws/resource_aws_autoscaling_schedule.go index 0131045e3b4..fcfc6a03636 100644 --- a/aws/resource_aws_autoscaling_schedule.go +++ b/aws/resource_aws_autoscaling_schedule.go @@ -51,6 +51,11 @@ func resourceAwsAutoscalingSchedule() *schema.Resource { Computed: true, ValidateFunc: validateASGScheduleTimestamp, }, + "time_zone": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, "recurrence": { Type: schema.TypeString, Optional: true, @@ -119,6 +124,10 @@ func resourceAwsAutoscalingScheduleCreate(d *schema.ResourceData, meta interface params.EndTime = aws.Time(t) } + if attr, ok := d.GetOk("time_zone"); ok { + params.TimeZone = aws.String(attr.(string)) + } + if attr, ok := d.GetOk("recurrence"); ok { params.Recurrence = aws.String(attr.(string)) } @@ -194,6 +203,10 @@ func resourceAwsAutoscalingScheduleRead(d *schema.ResourceData, meta interface{} d.Set("end_time", sa.EndTime.Format(awsAutoscalingScheduleTimeLayout)) } + if sa.TimeZone != nil { + d.Set("time_zone", sa.TimeZone) + } + return nil } From 7c05398aac28bc23793d8f72e29ca08dc16a9693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1si=20G=C3=A1bor?= Date: Wed, 16 Jun 2021 13:54:57 +0200 Subject: [PATCH 2/4] Add time_zone parameter to the docs --- website/docs/r/autoscaling_schedule.html.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/r/autoscaling_schedule.html.markdown b/website/docs/r/autoscaling_schedule.html.markdown index fef7b6656f0..deb3b6772a6 100644 --- a/website/docs/r/autoscaling_schedule.html.markdown +++ b/website/docs/r/autoscaling_schedule.html.markdown @@ -46,6 +46,7 @@ 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 message. * `recurrence` - (Optional) The time when recurring future actions will start. Start time is specified by the user following the Unix cron syntax format. +* `time_zone` - (Optional) The timezone for the cron expression. Valid values are the canonical names of the IANA time zones (such as Etc/GMT+9 or Pacific/Tahiti). * `min_size` - (Optional) The minimum size for the Auto Scaling group. Default 0. Set to -1 if you don't want to change the minimum size at the scheduled time. * `max_size` - (Optional) The maximum size for the Auto Scaling group. Default 0. From f7b4117a5eca8d410566f579c54e145610c75986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1si=20G=C3=A1bor?= Date: Wed, 16 Jun 2021 14:13:39 +0200 Subject: [PATCH 3/4] Update acceptance test --- aws/resource_aws_autoscaling_schedule_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/aws/resource_aws_autoscaling_schedule_test.go b/aws/resource_aws_autoscaling_schedule_test.go index 7bf5d59c890..d0172ba519e 100644 --- a/aws/resource_aws_autoscaling_schedule_test.go +++ b/aws/resource_aws_autoscaling_schedule_test.go @@ -359,6 +359,7 @@ resource "aws_autoscaling_schedule" "foobar" { max_size = 1 desired_capacity = 0 recurrence = "0 8 * * *" + time_zone = "Pacific/Tahiti" autoscaling_group_name = aws_autoscaling_group.foobar.name } `, r, r) From 608857d371c75aebcd90cef415d89a514e205725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1si=20G=C3=A1bor?= Date: Wed, 16 Jun 2021 14:14:07 +0200 Subject: [PATCH 4/4] Add changelog entry --- .changelog/19829.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/19829.txt diff --git a/.changelog/19829.txt b/.changelog/19829.txt new file mode 100644 index 00000000000..3cfbbc737f0 --- /dev/null +++ b/.changelog/19829.txt @@ -0,0 +1,3 @@ +```release-notes:enhancement +resource/aws_autoscaling_schedule: Add time_zone argument +```