From 075f68519c0c69bb5b909eb55e148d9b8aef6fc1 Mon Sep 17 00:00:00 2001 From: Moritz Reinhardt Date: Thu, 19 Dec 2024 19:46:11 +0100 Subject: [PATCH] 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.