From 075f68519c0c69bb5b909eb55e148d9b8aef6fc1 Mon Sep 17 00:00:00 2001 From: Moritz Reinhardt Date: Thu, 19 Dec 2024 19:46:11 +0100 Subject: [PATCH 1/2] database: Add validation to maintenance window and improve docs --- digitalocean/database/resource_database_cluster.go | 5 +++-- docs/resources/database_cluster.md | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/digitalocean/database/resource_database_cluster.go b/digitalocean/database/resource_database_cluster.go index 8331dea22..2ef9c803b 100644 --- a/digitalocean/database/resource_database_cluster.go +++ b/digitalocean/database/resource_database_cluster.go @@ -96,8 +96,9 @@ func ResourceDigitalOceanDatabaseCluster() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "day": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.IsDayOfTheWeek(true), }, "hour": { Type: schema.TypeString, diff --git a/docs/resources/database_cluster.md b/docs/resources/database_cluster.md index e5b7da774..7e89253a8 100644 --- a/docs/resources/database_cluster.md +++ b/docs/resources/database_cluster.md @@ -133,8 +133,8 @@ The following arguments are supported: `maintenance_window` supports the following: -* `day` - (Required) The day of the week on which to apply maintenance updates. -* `hour` - (Required) The hour in UTC at which maintenance updates will be applied in 24 hour format. +* `day` - (Required) The day of the week on which to apply maintenance updates. May be one of `monday` through `sunday`. +* `hour` - (Required) The hour in UTC at which maintenance updates will be applied as a string in 24 hour format, e.g. `13:00`. * `backup_restore` - (Optional) Create a new database cluster based on a backup of an existing cluster. From 7fe851000c1c3971feaf65717437742d59720141 Mon Sep 17 00:00:00 2001 From: Moritz Reinhardt Date: Thu, 19 Dec 2024 19:48:00 +0100 Subject: [PATCH 2/2] kubernetes: Add validation to maintenance_policy --- digitalocean/kubernetes/resource_kubernetes_cluster.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/digitalocean/kubernetes/resource_kubernetes_cluster.go b/digitalocean/kubernetes/resource_kubernetes_cluster.go index 9abb46df8..15b4ab570 100644 --- a/digitalocean/kubernetes/resource_kubernetes_cluster.go +++ b/digitalocean/kubernetes/resource_kubernetes_cluster.go @@ -121,9 +121,10 @@ func ResourceDigitalOceanKubernetesCluster() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "day": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{"any", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"}, true), }, "start_time": { Type: schema.TypeString,