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

Commit

Permalink
[Compute_Disk] - Add beta multi-writer support (#3911) (#487)
Browse files Browse the repository at this point in the history
* [Compute_Disk] - Add beta multi-writer support:

* set machine type to n2 for testcase... not supported for n1

* migrate test to disk resource

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Dec 30, 2020
1 parent 0813708 commit 64983ec
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_compute_disk.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ Properties that can be accessed from the `google_compute_disk` resource:

* `resource_policies`: (Beta only) Resource policies applied to this disk for automatic snapshot creations.

* `multi_writer`: (Beta only) Indicates whether or not the disk can be read/write attached to more than one instance.

* `zone`: A reference to the zone where the disk resides.

* `source_image_encryption_key`: The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key.
Expand Down
1 change: 1 addition & 0 deletions docs/resources/google_compute_disks.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ See [google_compute_disk.md](google_compute_disk.md) for more detailed informati
* `types`: an array of `google_compute_disk` type
* `source_images`: an array of `google_compute_disk` source_image
* `resource_policies`: (Beta only) an array of `google_compute_disk` resource_policies
* `multi_writers`: (Beta only) an array of `google_compute_disk` multi_writer
* `zones`: an array of `google_compute_disk` zone
* `source_image_encryption_keys`: an array of `google_compute_disk` source_image_encryption_key
* `source_image_ids`: an array of `google_compute_disk` source_image_id
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_compute_disk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ComputeDisk < GcpResourceBase
attr_reader :type
attr_reader :source_image
attr_reader :resource_policies
attr_reader :multi_writer
attr_reader :zone
attr_reader :source_image_encryption_key
attr_reader :source_image_id
Expand Down Expand Up @@ -73,6 +74,7 @@ def parse
@type = @fetched['type']
@source_image = @fetched['sourceImage']
@resource_policies = @fetched['resourcePolicies']
@multi_writer = @fetched['multiWriter']
@zone = @fetched['zone']
@source_image_encryption_key = GoogleInSpec::Compute::Property::DiskSourceImageEncryptionKey.new(@fetched['sourceImageEncryptionKey'], to_s)
@source_image_id = @fetched['sourceImageId']
Expand Down
2 changes: 2 additions & 0 deletions libraries/google_compute_disks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ComputeDisks < GcpResourceBase
filter_table_config.add(:types, field: :type)
filter_table_config.add(:source_images, field: :source_image)
filter_table_config.add(:resource_policies, field: :resource_policies)
filter_table_config.add(:multi_writers, field: :multi_writer)
filter_table_config.add(:zones, field: :zone)
filter_table_config.add(:source_image_encryption_keys, field: :source_image_encryption_key)
filter_table_config.add(:source_image_ids, field: :source_image_id)
Expand Down Expand Up @@ -101,6 +102,7 @@ def transformers
'type' => ->(obj) { return :type, obj['type'] },
'sourceImage' => ->(obj) { return :source_image, obj['sourceImage'] },
'resourcePolicies' => ->(obj) { return :resource_policies, obj['resourcePolicies'] },
'multiWriter' => ->(obj) { return :multi_writer, obj['multiWriter'] },
'zone' => ->(obj) { return :zone, obj['zone'] },
'sourceImageEncryptionKey' => ->(obj) { return :source_image_encryption_key, GoogleInSpec::Compute::Property::DiskSourceImageEncryptionKey.new(obj['sourceImageEncryptionKey'], to_s) },
'sourceImageId' => ->(obj) { return :source_image_id, obj['sourceImageId'] },
Expand Down

0 comments on commit 64983ec

Please sign in to comment.