diff --git a/docs/resources/google_pubsub_topic.md b/docs/resources/google_pubsub_topic.md index 78a75b37c..b8a97d5a1 100644 --- a/docs/resources/google_pubsub_topic.md +++ b/docs/resources/google_pubsub_topic.md @@ -22,6 +22,8 @@ Properties that can be accessed from the `google_pubsub_topic` resource: * `name`: Name of the topic. + * `kms_key_name`: The resource name of the Cloud KMS CryptoKey to be used to protect access to messsages published on this topic. Your project's PubSub service account (`service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com`) must have `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature. The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*` + * `labels`: A set of key/value label pairs to assign to this Topic. diff --git a/docs/resources/google_pubsub_topics.md b/docs/resources/google_pubsub_topics.md index f33976610..ea8bae966 100644 --- a/docs/resources/google_pubsub_topics.md +++ b/docs/resources/google_pubsub_topics.md @@ -28,6 +28,7 @@ Properties that can be accessed from the `google_pubsub_topics` resource: See [google_pubsub_topic.md](google_pubsub_topic.md) for more detailed information * `names`: an array of `google_pubsub_topic` name + * `kms_key_names`: an array of `google_pubsub_topic` kms_key_name * `labels`: an array of `google_pubsub_topic` labels ## Filter Criteria diff --git a/libraries/google_pubsub_topic.rb b/libraries/google_pubsub_topic.rb index 0e16f890a..118b86be1 100644 --- a/libraries/google_pubsub_topic.rb +++ b/libraries/google_pubsub_topic.rb @@ -23,6 +23,7 @@ class Topic < GcpResourceBase attr_reader :params attr_reader :name + attr_reader :kms_key_name attr_reader :labels def initialize(params) @@ -34,6 +35,7 @@ def initialize(params) def parse @name = name_from_self_link(@fetched['name']) + @kms_key_name = @fetched['kmsKeyName'] @labels = @fetched['labels'] end diff --git a/libraries/google_pubsub_topics.rb b/libraries/google_pubsub_topics.rb index 9a79c67af..068c6e94d 100644 --- a/libraries/google_pubsub_topics.rb +++ b/libraries/google_pubsub_topics.rb @@ -24,6 +24,7 @@ class Topics < GcpResourceBase filter_table_config = FilterTable.create filter_table_config.add(:names, field: :name) + filter_table_config.add(:kms_key_names, field: :kms_key_name) filter_table_config.add(:labels, field: :labels) filter_table_config.connect(self, :table) @@ -65,6 +66,7 @@ def transform(key, value) def transformers { 'name' => ->(obj) { return :name, name_from_self_link(obj['name']) }, + 'kmsKeyName' => ->(obj) { return :kms_key_name, obj['kmsKeyName'] }, 'labels' => ->(obj) { return :labels, obj['labels'] }, } end