Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set skip_initial_version_creation a default #8988

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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