From 0c2691b81a175958c80dd2918fbbff02eb3dba60 Mon Sep 17 00:00:00 2001 From: taktakpeops <54535041+taktakpeops@users.noreply.github.com> Date: Thu, 27 Jul 2023 11:22:43 +0200 Subject: [PATCH 1/2] fix: allow setting offpeakwindow at 00:00 --- internal/service/opensearch/domain_structure.go | 4 ++-- internal/service/opensearch/domain_test.go | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/internal/service/opensearch/domain_structure.go b/internal/service/opensearch/domain_structure.go index b5a24fedb12..42a97311082 100644 --- a/internal/service/opensearch/domain_structure.go +++ b/internal/service/opensearch/domain_structure.go @@ -212,11 +212,11 @@ func expandWindowStartTime(tfMap map[string]interface{}) *opensearchservice.Wind apiObject := &opensearchservice.WindowStartTime{} - if v, ok := tfMap["hours"].(int); ok && v != 0 { + if v, ok := tfMap["hours"].(int); ok { apiObject.Hours = aws.Int64(int64(v)) } - if v, ok := tfMap["minutes"].(int); ok && v != 0 { + if v, ok := tfMap["minutes"].(int); ok { apiObject.Minutes = aws.Int64(int64(v)) } diff --git a/internal/service/opensearch/domain_test.go b/internal/service/opensearch/domain_test.go index e829e9ccb4f..3639fbe945e 100644 --- a/internal/service/opensearch/domain_test.go +++ b/internal/service/opensearch/domain_test.go @@ -1529,6 +1529,18 @@ func TestAccOpenSearchDomain_offPeakWindowOptions(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "off_peak_window_options.0.off_peak_window.0.window_start_time.0.minutes", "15"), ), }, + { + Config: testAccDomainConfig_offPeakWindowOptions(rName, 0, 0), + Check: resource.ComposeTestCheckFunc( + testAccCheckDomainExists(ctx, resourceName, &domain), + resource.TestCheckResourceAttr(resourceName, "off_peak_window_options.#", "1"), + resource.TestCheckResourceAttr(resourceName, "off_peak_window_options.0.enabled", "true"), + resource.TestCheckResourceAttr(resourceName, "off_peak_window_options.0.off_peak_window.#", "1"), + resource.TestCheckResourceAttr(resourceName, "off_peak_window_options.0.off_peak_window.0.window_start_time.#", "1"), + resource.TestCheckResourceAttr(resourceName, "off_peak_window_options.0.off_peak_window.0.window_start_time.0.hours", "0"), + resource.TestCheckResourceAttr(resourceName, "off_peak_window_options.0.off_peak_window.0.window_start_time.0.minutes", "0"), + ), + }, }, }) } From c888d0c726829ec6cde6884b033877fc7a097684 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 27 Jul 2023 09:42:27 -0400 Subject: [PATCH 2/2] Add CHANGELOG entry. --- .changelog/32716.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/32716.txt diff --git a/.changelog/32716.txt b/.changelog/32716.txt new file mode 100644 index 00000000000..ad36d9f986c --- /dev/null +++ b/.changelog/32716.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_opensearch_domain: Correctly handle `off_peak_window_options.off_peak_window.window_start_time` value of `00:00` +``` \ No newline at end of file