Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit d3d42eb

Browse files
committed
Update validation and schema to new recurring_schedule model
1 parent b71b2af commit d3d42eb

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

docs/resources/deployment_freeze.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ resource "octopusdeploy_deployment_freeze_tenant" "tenant_freeze" {
9595
Required:
9696

9797
- `end_type` (String) When the recurring schedule should end (Never, OnDate, AfterOccurrences)
98-
- `type` (String) Type of recurring schedule (OnceDaily, DaysPerWeek, DaysPerMonth, Annually)
98+
- `type` (String) Type of recurring schedule (Daily, Weekly, Monthly, Annually)
9999
- `unit` (Number) The unit value for the schedule
100100

101101
Optional:

octopusdeploy_framework/datasource_deployment_freeze_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ resource "octopusdeploy_deployment_freeze" "test_freeze" {
9898
end = "%s"
9999
100100
recurring_schedule = {
101-
type = "DaysPerWeek"
101+
type = "Weekly"
102102
unit = 24
103103
end_type = "AfterOccurrences"
104104
end_after_occurrences = 5

octopusdeploy_framework/resource_deployment_freeze_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestNewDeploymentFreezeResource(t *testing.T) {
6060
resource.TestCheckResourceAttr(resourceName, "name", name+"1"),
6161
resource.TestCheckResourceAttr(resourceName, "start", start),
6262
resource.TestCheckResourceAttr(resourceName, "end", updatedEnd),
63-
resource.TestCheckResourceAttr(resourceName, "recurring_schedule.type", "DaysPerWeek"),
63+
resource.TestCheckResourceAttr(resourceName, "recurring_schedule.type", "Weekly"),
6464
resource.TestCheckResourceAttr(resourceName, "recurring_schedule.unit", "24"),
6565
resource.TestCheckResourceAttr(resourceName, "recurring_schedule.end_type", "AfterOccurrences"),
6666
resource.TestCheckResourceAttr(resourceName, "recurring_schedule.end_after_occurrences", "5"),
@@ -99,7 +99,7 @@ func testDeploymentFreezeBasic(localName string, freezeName string, start string
9999
if includeRecurringSchedule {
100100
freezeConfig += `
101101
recurring_schedule = {
102-
type = "DaysPerWeek"
102+
type = "Weekly"
103103
unit = 24
104104
end_type = "AfterOccurrences"
105105
end_after_occurrences = 5

octopusdeploy_framework/schemas/deployment_freeze.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ func (d DeploymentFreezeSchema) GetResourceSchema() resourceSchema.Schema {
2424
},
2525
Attributes: map[string]resourceSchema.Attribute{
2626
"type": resourceSchema.StringAttribute{
27-
Description: "Type of recurring schedule (OnceDaily, DaysPerWeek, DaysPerMonth, Annually)",
27+
Description: "Type of recurring schedule (Daily, Weekly, Monthly, Annually)",
2828
Required: true,
2929
Validators: []validator.String{
30-
stringvalidator.OneOf("OnceDaily", "DaysPerWeek", "DaysPerMonth", "Annually"),
30+
stringvalidator.OneOf("Daily", "Weekly", "Monthly", "Annually"),
3131
},
3232
},
3333
"unit": resourceSchema.Int64Attribute{

octopusdeploy_framework/schemas/deployment_freeze_validation.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ func (v recurringScheduleValidator) ValidateObject(ctx context.Context, req vali
115115
scheduleType := schedule.Type.ValueString()
116116

117117
switch scheduleType {
118-
case "OnceDaily":
119-
// OnceDaily only requires type and unit which are already marked as required
118+
case "Daily":
119+
// Daily only requires type and unit which are already marked as required
120120

121-
case "DaysPerWeek":
121+
case "Weekly":
122122
if schedule.DaysOfWeek.IsNull() {
123123
resp.Diagnostics.AddAttributeError(
124124
path.Root("days_of_week"),
@@ -127,7 +127,7 @@ func (v recurringScheduleValidator) ValidateObject(ctx context.Context, req vali
127127
)
128128
}
129129

130-
case "DaysPerMonth":
130+
case "Monthly":
131131
if schedule.MonthlyScheduleType.IsNull() {
132132
resp.Diagnostics.AddAttributeError(
133133
path.Root("monthly_schedule_type"),
@@ -195,7 +195,7 @@ func (v recurringScheduleValidator) ValidateObject(ctx context.Context, req vali
195195
resp.Diagnostics.AddAttributeError(
196196
path.Root("type"),
197197
"Invalid Schedule Type",
198-
fmt.Sprintf("type must be one of: OnceDaily, DaysPerWeek, DaysPerMonth, Annually, got: %s", scheduleType),
198+
fmt.Sprintf("type must be one of: Daily, Weekly, Monthly, Annually, got: %s", scheduleType),
199199
)
200200
}
201201
}

0 commit comments

Comments
 (0)