Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time_zone parameter to aws_autoscaling_schedule #19829

Merged
merged 4 commits into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/19829.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-notes:enhancement
resource/aws_autoscaling_schedule: Add time_zone argument
```
13 changes: 13 additions & 0 deletions aws/resource_aws_autoscaling_schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_autoscaling_schedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/autoscaling_schedule.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down