From a49d29115316c46edde655b2cfa491b272c106bd Mon Sep 17 00:00:00 2001 From: Murad Biashimov Date: Thu, 12 Dec 2024 22:53:56 +0100 Subject: [PATCH] fix(userconfig): plan doesn't show zero values for new resources --- CHANGELOG.md | 1 + internal/sdkprovider/userconfig/diff/diff.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50018cda8..0b730cda0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ nav_order: 1 - Add `alloydbomni` BETA resource and datasource - Add `aiven_alloydbomni_user` BETA resource and datasource - Add `aiven_alloydbomni_database` BETA resource and datasource +- Fix `terraform plan`: new resources don't display zero values for user configuration options ## [4.30.0] - 2024-12-05 diff --git a/internal/sdkprovider/userconfig/diff/diff.go b/internal/sdkprovider/userconfig/diff/diff.go index 132ef6bd3..4a059ec0e 100644 --- a/internal/sdkprovider/userconfig/diff/diff.go +++ b/internal/sdkprovider/userconfig/diff/diff.go @@ -16,6 +16,11 @@ var ( // SuppressUnchanged suppresses diff for unchanged fields. // Applied for all nested values: both for objects and arrays. func SuppressUnchanged(k, oldValue, newValue string, d *schema.ResourceData) bool { + if d.Id() == "" { + // Do not suppress diff for new resources. + return false + } + // schema.TypeMap if strings.HasSuffix(k, ".%") { return oldValue == newValue