Skip to content

Commit

Permalink
set skip_initial_version_creation a default (#4729) (#8988)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Apr 23, 2021
1 parent 93feb02 commit c39ed06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/4729.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
kms: fixed indirectly force replacement via `skip_initial_version_creation` on `google_kms_crypto_key`
```
8 changes: 7 additions & 1 deletion google/resource_kms_crypto_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit c39ed06

Please sign in to comment.