Skip to content

Commit 4601f5e

Browse files
tgc-revival: add kms resources to tgc (#15167) (#10741)
[upstream:6f6457dbc22ae228414303cd26be95eca47060cc] Signed-off-by: Modular Magician <[email protected]>
1 parent bcc3910 commit 4601f5e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

google-beta/services/kms/resource_kms_crypto_key.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,10 @@ func resourceKMSCryptoKeyDecoder(d *schema.ResourceData, meta interface{}, res m
835835
// We can't just ignore_read on `name` as the linter will
836836
// complain that the returned `res` is never used afterwards.
837837
// Some field needs to be actually set, and we chose `name`.
838-
res["name"] = d.Get("name").(string)
838+
v := d.Get("name")
839+
if v != nil {
840+
res["name"] = v.(string)
841+
}
839842
return res, nil
840843
}
841844

google-beta/services/kms/resource_kms_key_handle.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ func resourceKMSKeyHandleDecoder(d *schema.ResourceData, meta interface{}, res m
289289
// We can't just ignore_read on `name` as the linter will
290290
// complain that the returned `res` is never used afterwards.
291291
// Some field needs to be actually set, and we chose `name`.
292-
res["name"] = d.Get("name").(string)
292+
v := d.Get("name")
293+
if v != nil {
294+
res["name"] = v.(string)
295+
}
293296
return res, nil
294297
}

google-beta/services/kms/resource_kms_key_ring.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,9 @@ func resourceKMSKeyRingDecoder(d *schema.ResourceData, meta interface{}, res map
260260
// We can't just ignore_read on `name` as the linter will
261261
// complain that the returned `res` is never used afterwards.
262262
// Some field needs to be actually set, and we chose `name`.
263-
res["name"] = d.Get("name").(string)
263+
v := d.Get("name")
264+
if v != nil {
265+
res["name"] = v.(string)
266+
}
264267
return res, nil
265268
}

0 commit comments

Comments
 (0)