From e83a38f4d00bd516573693cb7ffe7b2ef3b9d7da Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Tue, 27 Oct 2020 21:51:16 +0000 Subject: [PATCH] Add skip_initial_version_creation to kms crypto key (#3907) Signed-off-by: Modular Magician --- docs/resources/google_kms_crypto_key.md | 2 ++ docs/resources/google_kms_crypto_keys.md | 1 + libraries/google_kms_crypto_key.rb | 2 ++ libraries/google_kms_crypto_keys.rb | 2 ++ 4 files changed, 7 insertions(+) diff --git a/docs/resources/google_kms_crypto_key.md b/docs/resources/google_kms_crypto_key.md index 8662af306..05d35c77f 100644 --- a/docs/resources/google_kms_crypto_key.md +++ b/docs/resources/google_kms_crypto_key.md @@ -77,6 +77,8 @@ Properties that can be accessed from the `google_kms_crypto_key` resource: * `key_ring`: The KeyRing that this key belongs to. Format: `'projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}'`. + * `skip_initial_version_creation`: 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. + ## GCP Permissions diff --git a/docs/resources/google_kms_crypto_keys.md b/docs/resources/google_kms_crypto_keys.md index 164dde1fa..aa6a5299e 100644 --- a/docs/resources/google_kms_crypto_keys.md +++ b/docs/resources/google_kms_crypto_keys.md @@ -38,6 +38,7 @@ See [google_kms_crypto_key.md](google_kms_crypto_key.md) for more detailed infor * `version_templates`: an array of `google_kms_crypto_key` version_template * `next_rotation_times`: an array of `google_kms_crypto_key` next_rotation_time * `key_rings`: an array of `google_kms_crypto_key` key_ring + * `skip_initial_version_creations`: an array of `google_kms_crypto_key` skip_initial_version_creation ## Filter Criteria This resource supports all of the above properties as filter criteria, which can be used diff --git a/libraries/google_kms_crypto_key.rb b/libraries/google_kms_crypto_key.rb index 5d4a6062e..d3c3096e6 100644 --- a/libraries/google_kms_crypto_key.rb +++ b/libraries/google_kms_crypto_key.rb @@ -31,6 +31,7 @@ class KMSCryptoKey < GcpResourceBase attr_reader :version_template attr_reader :next_rotation_time attr_reader :key_ring + attr_reader :skip_initial_version_creation def initialize(params) super(params.merge({ use_http_transport: true })) @@ -48,6 +49,7 @@ def parse @version_template = GoogleInSpec::KMS::Property::CryptoKeyVersionTemplate.new(@fetched['versionTemplate'], to_s) @next_rotation_time = parse_time_string(@fetched['nextRotationTime']) @key_ring = @fetched['keyRing'] + @skip_initial_version_creation = @fetched['skipInitialVersionCreation'] end # Handles parsing RFC3339 time string diff --git a/libraries/google_kms_crypto_keys.rb b/libraries/google_kms_crypto_keys.rb index cb80f6c3b..947429abf 100644 --- a/libraries/google_kms_crypto_keys.rb +++ b/libraries/google_kms_crypto_keys.rb @@ -31,6 +31,7 @@ class KMSCryptoKeys < GcpResourceBase filter_table_config.add(:version_templates, field: :version_template) filter_table_config.add(:next_rotation_times, field: :next_rotation_time) filter_table_config.add(:key_rings, field: :key_ring) + filter_table_config.add(:skip_initial_version_creations, field: :skip_initial_version_creation) filter_table_config.connect(self, :table) @@ -78,6 +79,7 @@ def transformers 'versionTemplate' => ->(obj) { return :version_template, GoogleInSpec::KMS::Property::CryptoKeyVersionTemplate.new(obj['versionTemplate'], to_s) }, 'nextRotationTime' => ->(obj) { return :next_rotation_time, parse_time_string(obj['nextRotationTime']) }, 'keyRing' => ->(obj) { return :key_ring, obj['keyRing'] }, + 'skipInitialVersionCreation' => ->(obj) { return :skip_initial_version_creation, obj['skipInitialVersionCreation'] }, } end