From 938e668841354f019a4ba62c54a0adae3cb7b3d7 Mon Sep 17 00:00:00 2001 From: Roberto Jung Drebes Date: Sat, 29 Jun 2019 21:41:06 +0000 Subject: [PATCH] Pub/Sub Topic CMEK/KMS support Signed-off-by: Modular Magician --- google/pubsub_topic.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/google/pubsub_topic.go b/google/pubsub_topic.go index 87bfd5b18..665df294e 100644 --- a/google/pubsub_topic.go +++ b/google/pubsub_topic.go @@ -45,6 +45,12 @@ func GetPubsubTopicApiObject(d TerraformResourceData, config *Config) (map[strin } else if v, ok := d.GetOkExists("name"); !isEmptyValue(reflect.ValueOf(nameProp)) && (ok || !reflect.DeepEqual(v, nameProp)) { obj["name"] = nameProp } + kmsKeyNameProp, err := expandPubsubTopicKmsKeyName(d.Get("kms_key_name"), d, config) + if err != nil { + return nil, err + } else if v, ok := d.GetOkExists("kms_key_name"); !isEmptyValue(reflect.ValueOf(kmsKeyNameProp)) && (ok || !reflect.DeepEqual(v, kmsKeyNameProp)) { + obj["kmsKeyName"] = kmsKeyNameProp + } labelsProp, err := expandPubsubTopicLabels(d.Get("labels"), d, config) if err != nil { return nil, err @@ -64,6 +70,10 @@ func expandPubsubTopicName(v interface{}, d TerraformResourceData, config *Confi return GetResourceNameFromSelfLink(v.(string)), nil } +func expandPubsubTopicKmsKeyName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { + return v, nil +} + func expandPubsubTopicLabels(v interface{}, d TerraformResourceData, config *Config) (map[string]string, error) { if v == nil { return map[string]string{}, nil