Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Pub/Sub Topic CMEK/KMS support
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
drebes authored and modular-magician committed Jun 29, 2019
1 parent 53fafdb commit af365d1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/resources/google_pubsub_topic.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`

* `labels`: A set of key/value label pairs to assign to this Topic.


Expand Down
1 change: 1 addition & 0 deletions docs/resources/google_pubsub_topics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_pubsub_topic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Topic < GcpResourceBase

attr_reader :params
attr_reader :name
attr_reader :kms_key_name
attr_reader :labels

def initialize(params)
Expand All @@ -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

Expand Down
2 changes: 2 additions & 0 deletions libraries/google_pubsub_topics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit af365d1

Please sign in to comment.