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

Add skip_initial_version_creation to kms crypto key #466

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/resources/google_kms_crypto_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions docs/resources/google_kms_crypto_keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_kms_crypto_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_kms_crypto_keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand Down