From 5a75aca0c26e82562d0bcdfc0fdf5a45514a588f Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Fri, 23 Apr 2021 19:21:43 +0000 Subject: [PATCH] set skip_initial_version_creation a default (#4729) Signed-off-by: Modular Magician --- .changelog/4729.txt | 3 +++ google/resource_kms_crypto_key.go | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .changelog/4729.txt diff --git a/.changelog/4729.txt b/.changelog/4729.txt new file mode 100644 index 00000000000..b8c678ed0f7 --- /dev/null +++ b/.changelog/4729.txt @@ -0,0 +1,3 @@ +```release-note:bug +kms: fixed indirectly force replacement via `skip_initial_version_creation` on `google_kms_crypto_key` +``` diff --git a/google/resource_kms_crypto_key.go b/google/resource_kms_crypto_key.go index b8399fd3a6a..36bc7d11040 100644 --- a/google/resource_kms_crypto_key.go +++ b/google/resource_kms_crypto_key.go @@ -99,7 +99,6 @@ letter 's' (seconds). It must be greater than a day (ie, 86400).`, ForceNew: true, Description: `If set to true, the request will create a CryptoKey without any CryptoKeyVersions. You must use the 'google_kms_key_ring_import_job' resource to import the CryptoKeyVersion.`, - Default: false, }, "version_template": { Type: schema.TypeList, @@ -503,6 +502,13 @@ func resourceKMSCryptoKeyEncoder(d *schema.ResourceData, meta interface{}, obj m obj["nextRotationTime"] = nextRotation } + // set to false if it is not true explicitly + if !(d.Get("skip_initial_version_creation").(bool)) { + if err := d.Set("skip_initial_version_creation", false); err != nil { + return nil, fmt.Errorf("Error setting skip_initial_version_creation: %s", err) + } + } + return obj, nil }