generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [CCM-14715] Support for fixed schedule in Harness AutoStopping (#…
…714) * Resource structure added for static schedule resource of AutoStopping * Added provision for specifying AutoStopping rule ID in schedules of AutoStopping rules * Parsing logic for AutoStopping static schedule * Introduced read context for schedule * Wired read context for read of static schedule of AutoStopping * Wired create context for static schedules of AutoStopping rules * Wired delete context for fixed schedules of AutoStopping rules * Update context wired for fixed schedules of AutoStopping rules * Added resource data file for fixed schedule of AutoStopping: * Wired resource provider and data source for schedule of Harness AutoStopping rule * Corrections on computed attribute in schedules of AutoStopping * Corrections - Schedules of AutoStopping * First tested version of schedule of AutoStopping rules * Final working version of Fixed schedule of AutoStopping rule * Test file for resource of fixed schedule of AutoStopping feature * made period end time to be optional in fixed schedule of AutoStopping * Correction - simplified structure of schedule of AutoStopping rule * Added example resource file for schedule of AutoStopping * Partial day downtime example - schedule of AutoStopping * Periodic schedule example - schedule of AutoStopping * Example of periodic schedule with starting date - schedule of AutoStopping * Example of periodic schedule with bounding date - schedule of AutoStopping * Example of implicit end time - schedule of AutoStopping * Example of whole day schedule - schedule of AutoStopping * Example of one time trigger schedule- schedule of AutoStopping * Example of overnight schedule- schedule of AutoStopping * Modified example name for clarity * Data source example file for schedule of AutoStopping rule * Docs for fixed schedules * Changelog for fixed schedule support of AutoStopping * GoSDK version upgraded to latest release of 0.3.56 Source : https://harness.slack.com/archives/C0413DEHL1M/p1698216446558869?thread_ts=1698215288.389389&cid=C0413DEHL1M * Subcategory correction * Upgraded go sdk version to latest of v0.3.57 source https://harness.slack.com/archives/C0413DEHL1M/p1698222960525819 * Extracted value of time.DateTime to variable as the value is not supported in old Go version. This was causing build failure in pipeline
- Loading branch information
Showing
11 changed files
with
1,044 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:new-resource | ||
Fixed schedule support for AutoStopping | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "harness_autostopping_schedule Data Source - terraform-provider-harness" | ||
subcategory: "Next Gen" | ||
description: |- | ||
Data source for retrieving a fixed schedule for Harness AutoStopping rule | ||
--- | ||
|
||
# harness_autostopping_schedule (Data Source) | ||
|
||
Data source for retrieving a fixed schedule for Harness AutoStopping rule | ||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `schedule_type` (String) Type of the schedule. Valid values are `uptime` and `downtime` | ||
|
||
### Read-Only | ||
|
||
- `ending_on` (String) Time until which schedule will be active. Need to be in YYYY-MM-DD HH:mm:SS format. Eg 2006-01-02 15:04:05 | ||
- `id` (String) The ID of this resource. | ||
- `identifier` (Number) Unique identifier of the schedule | ||
- `name` (String) Name of the schedule | ||
- `repeats` (List of Object) For defining periodic schedule. Periodic nature will be applicable from the time of creation of schedule, unless specific 'time_period' is specified (see [below for nested schema](#nestedatt--repeats)) | ||
- `rules` (List of Number) ID of AutoStopping rules on which the schedule applies | ||
- `starting_from` (String) Time from which schedule will be active. Schedule will take immediate effect if starting_from is not specified. Need to be in YYYY-MM-DD HH:mm:SS format. Eg 2006-01-02 15:04:05 | ||
- `time_zone` (String) Time zone in which schedule needs to be executed | ||
|
||
<a id="nestedatt--repeats"></a> | ||
### Nested Schema for `repeats` | ||
|
||
Read-Only: | ||
|
||
- `days` (String) | ||
- `end_time` (String) | ||
- `start_time` (String) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "harness_autostopping_schedule Resource - terraform-provider-harness" | ||
subcategory: "Next Gen" | ||
description: |- | ||
Resource for creating a fixed schedule for Harness AutoStopping rule | ||
--- | ||
|
||
# harness_autostopping_schedule (Resource) | ||
|
||
Resource for creating a fixed schedule for Harness AutoStopping rule | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "harness_autostopping_schedule" "MondayWholeDayUp" { | ||
name = "MondayWholeDayUp" | ||
schedule_type = "uptime" | ||
time_zone = "UTC" | ||
repeats { | ||
days = "MON" | ||
} | ||
rules = [123] | ||
} | ||
resource "harness_autostopping_schedule" "MondayUpTill4:30pm" { | ||
name = "MondayUpTill4:30pm" | ||
schedule_type = "uptime" | ||
time_zone = "UTC" | ||
repeats { | ||
days = "MON" | ||
end_time = "16:30" | ||
} | ||
rules = [123] | ||
} | ||
resource "harness_autostopping_schedule" "MondayThroughFridayUptimeFrom9amTo6pm" { | ||
name = "MondayThroughFridayUptimeFrom9amTo6pm" | ||
schedule_type = "uptime" | ||
time_zone = "UTC" | ||
repeats { | ||
days = "MON, TUE, WED, THU, FRI" | ||
start_time = "09:00" | ||
end_time = "18:00" | ||
} | ||
rules = [123] | ||
} | ||
resource "harness_autostopping_schedule" "MondayThroughFridayUptimeFrom9amTo6pmStartingFromDate" { | ||
name = "MondayThroughFridayUptimeFrom9amTo6pmStartingFrom" | ||
schedule_type = "uptime" | ||
time_zone = "UTC" | ||
starting_from = "2023-01-02 15:04:05" | ||
repeats { | ||
days = "MON, TUE, WED, THU, FRI" | ||
start_time = "09:00" | ||
end_time = "18:00" | ||
} | ||
rules = [123] | ||
} | ||
resource "harness_autostopping_schedule" "DownTimeForISTLuchOnEveryFridayInBetweenDate" { | ||
name = "DownTimeForISTLuchOnEveryFridayInBetweenDate" | ||
schedule_type = "downtime" | ||
time_zone = "Asia/Calcutta" | ||
starting_from = "2023-01-02 15:04:05" | ||
ending_on = "2023-02-02 15:04:05" | ||
repeats { | ||
days = "FRI" | ||
start_time = "12:30" | ||
end_time = "14:30" | ||
} | ||
rules = [123] | ||
} | ||
resource "harness_autostopping_schedule" "DowntimeEveryFridayAfterNoonTillEOD" { | ||
name = "DowntimeEveryFridayAfterNoonTillEOD" | ||
schedule_type = "downtime" | ||
time_zone = "Asia/Calcutta" | ||
repeats { | ||
days = "FRI" | ||
start_time = "17:30" | ||
} | ||
rules = [123] | ||
} | ||
resource "harness_autostopping_schedule" "CompleteDownTimeOnWeekEnd" { | ||
name = "CompleteDownTimeOnWeekEnd" | ||
schedule_type = "downtime" | ||
time_zone = "UTC" | ||
repeats { | ||
days = "SUN, SAT" | ||
} | ||
rules = [123] | ||
} | ||
resource "harness_autostopping_schedule" "TriggerDowntimeOnceOnDate" { | ||
name = "TriggerDowntimeOnceOnDate" | ||
schedule_type = "downtime" | ||
time_zone = "UTC" | ||
starting_from = "2023-01-02 15:04:05" | ||
rules = [123] | ||
} | ||
resource "harness_autostopping_schedule" "OverNightDowntimeOnWeekDays" { | ||
name = "OverNightDowntimeOnWeekDays" | ||
schedule_type = "downtime" | ||
time_zone = "Asia/Calcutta" | ||
repeats { | ||
days = "MON, TUE, WED, THU, FRI" | ||
start_time = "18:00" | ||
end_time = "07:00" | ||
} | ||
rules = [123] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `name` (String) Name of the schedule | ||
- `rules` (List of Number) ID of AutoStopping rules on which the schedule applies | ||
- `schedule_type` (String) Type of the schedule. Valid values are `uptime` and `downtime` | ||
- `time_zone` (String) Time zone in which schedule needs to be executed | ||
|
||
### Optional | ||
|
||
- `ending_on` (String) Time until which schedule will be active. Need to be in YYYY-MM-DD HH:mm:SS format. Eg 2006-01-02 15:04:05 | ||
- `repeats` (Block List) For defining periodic schedule. Periodic nature will be applicable from the time of creation of schedule, unless specific 'time_period' is specified (see [below for nested schema](#nestedblock--repeats)) | ||
- `starting_from` (String) Time from which schedule will be active. Schedule will take immediate effect if starting_from is not specified. Need to be in YYYY-MM-DD HH:mm:SS format. Eg 2006-01-02 15:04:05 | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
- `identifier` (Number) Unique identifier of the schedule | ||
|
||
<a id="nestedblock--repeats"></a> | ||
### Nested Schema for `repeats` | ||
|
||
Required: | ||
|
||
- `days` (String) Days on which schedule need to be active. Comma separated values of `SUN`, `MON`, `TUE`, `WED`, `THU`, `FRI` and `SAT`. Eg : `MON,TUE,WED,THU,FRI` for Mon through Friday | ||
|
||
Optional: | ||
|
||
- `end_time` (String) Ending time of schedule action on the day. Defaults to 24:00Hrs unless specified. Accepted format is HH:MM. Eg : 20:00 for 8pm | ||
- `start_time` (String) Starting time of schedule action on the day. Defaults to 00:00Hrs unless specified. Accepted format is HH:MM. Eg : 13:15 for 01:15pm |
3 changes: 3 additions & 0 deletions
3
examples/data-sources/harness_autostopping_schedule/data_source.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "harness_autostopping_schedule" "example" { | ||
identifier = "identifier" | ||
} |
120 changes: 120 additions & 0 deletions
120
examples/resources/harness_autostopping_schedule/resource.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
resource "harness_autostopping_schedule" "MondayWholeDayUp" { | ||
name = "MondayWholeDayUp" | ||
schedule_type = "uptime" | ||
time_zone = "UTC" | ||
|
||
repeats { | ||
days = "MON" | ||
} | ||
|
||
rules = [123] | ||
} | ||
|
||
resource "harness_autostopping_schedule" "MondayUpTill4:30pm" { | ||
name = "MondayUpTill4:30pm" | ||
schedule_type = "uptime" | ||
time_zone = "UTC" | ||
|
||
repeats { | ||
days = "MON" | ||
end_time = "16:30" | ||
} | ||
|
||
rules = [123] | ||
} | ||
|
||
resource "harness_autostopping_schedule" "MondayThroughFridayUptimeFrom9amTo6pm" { | ||
name = "MondayThroughFridayUptimeFrom9amTo6pm" | ||
schedule_type = "uptime" | ||
time_zone = "UTC" | ||
|
||
repeats { | ||
days = "MON, TUE, WED, THU, FRI" | ||
start_time = "09:00" | ||
end_time = "18:00" | ||
} | ||
|
||
rules = [123] | ||
} | ||
|
||
resource "harness_autostopping_schedule" "MondayThroughFridayUptimeFrom9amTo6pmStartingFromDate" { | ||
name = "MondayThroughFridayUptimeFrom9amTo6pmStartingFrom" | ||
schedule_type = "uptime" | ||
time_zone = "UTC" | ||
|
||
starting_from = "2023-01-02 15:04:05" | ||
|
||
repeats { | ||
days = "MON, TUE, WED, THU, FRI" | ||
start_time = "09:00" | ||
end_time = "18:00" | ||
} | ||
|
||
rules = [123] | ||
} | ||
|
||
resource "harness_autostopping_schedule" "DownTimeForISTLuchOnEveryFridayInBetweenDate" { | ||
name = "DownTimeForISTLuchOnEveryFridayInBetweenDate" | ||
schedule_type = "downtime" | ||
time_zone = "Asia/Calcutta" | ||
|
||
starting_from = "2023-01-02 15:04:05" | ||
ending_on = "2023-02-02 15:04:05" | ||
|
||
repeats { | ||
days = "FRI" | ||
start_time = "12:30" | ||
end_time = "14:30" | ||
} | ||
|
||
rules = [123] | ||
} | ||
|
||
resource "harness_autostopping_schedule" "DowntimeEveryFridayAfterNoonTillEOD" { | ||
name = "DowntimeEveryFridayAfterNoonTillEOD" | ||
schedule_type = "downtime" | ||
time_zone = "Asia/Calcutta" | ||
|
||
repeats { | ||
days = "FRI" | ||
start_time = "17:30" | ||
} | ||
|
||
rules = [123] | ||
} | ||
|
||
resource "harness_autostopping_schedule" "CompleteDownTimeOnWeekEnd" { | ||
name = "CompleteDownTimeOnWeekEnd" | ||
schedule_type = "downtime" | ||
time_zone = "UTC" | ||
|
||
repeats { | ||
days = "SUN, SAT" | ||
} | ||
|
||
rules = [123] | ||
} | ||
|
||
resource "harness_autostopping_schedule" "TriggerDowntimeOnceOnDate" { | ||
name = "TriggerDowntimeOnceOnDate" | ||
schedule_type = "downtime" | ||
time_zone = "UTC" | ||
|
||
starting_from = "2023-01-02 15:04:05" | ||
|
||
rules = [123] | ||
} | ||
|
||
resource "harness_autostopping_schedule" "OverNightDowntimeOnWeekDays" { | ||
name = "OverNightDowntimeOnWeekDays" | ||
schedule_type = "downtime" | ||
time_zone = "Asia/Calcutta" | ||
|
||
repeats { | ||
days = "MON, TUE, WED, THU, FRI" | ||
start_time = "18:00" | ||
end_time = "07:00" | ||
} | ||
|
||
rules = [123] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.