Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Switch compute/disk type to be a resource reference instead of string. #67

Merged
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: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ gcompute_disk { 'id-of-resource':
sha256 => string,
},
source_snapshot_id => string,
type => string,
type => reference to gcompute_disk_type,
users => [
string,
...
Expand Down
4 changes: 3 additions & 1 deletion lib/puppet/provider/gcompute_disk/google.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
require 'google/compute/property/disk_disk_encryption_key'
require 'google/compute/property/disk_source_image_encryption_key'
require 'google/compute/property/disk_source_snapshot_encryption_key'
require 'google/compute/property/disktype_selflink'
require 'google/compute/property/integer'
require 'google/compute/property/namevalues'
require 'google/compute/property/string'
Expand Down Expand Up @@ -89,7 +90,8 @@ def self.fetch_to_hash(fetch, resource)
licenses:
Google::Compute::Property::StringArray.api_munge(fetch['licenses']),
size_gb: Google::Compute::Property::Integer.api_munge(fetch['sizeGb']),
type: Google::Compute::Property::String.api_munge(fetch['type']),
type:
Google::Compute::Property::DiskTypeSelfLinkRef.api_munge(fetch['type']),
users: Google::Compute::Property::StringArray.api_munge(fetch['users']),
name: resource[:name],
source_image: resource[:source_image]
Expand Down
3 changes: 2 additions & 1 deletion lib/puppet/type/gcompute_disk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
require 'google/compute/property/disk_disk_encryption_key'
require 'google/compute/property/disk_source_image_encryption_key'
require 'google/compute/property/disk_source_snapshot_encryption_key'
require 'google/compute/property/disktype_selflink'
require 'google/compute/property/integer'
require 'google/compute/property/namevalues'
require 'google/compute/property/string'
Expand Down Expand Up @@ -221,7 +222,7 @@
DOC
end

newproperty(:type, parent: Google::Compute::Property::String) do
newproperty(:type, parent: Google::Compute::Property::DiskTypeSelfLinkRef) do
desc <<-DOC
URL of the disk type resource describing which disk type to use to create
the disk. Provide this when creating the disk.
Expand Down
2 changes: 1 addition & 1 deletion spec/data/network/gcompute_disk/success1~name.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sourceSnapshotEncryptionKey:
rawKey: test raw_key#0 data
sha256: test sha256#0 data
sourceSnapshotId: test source_snapshot_id#0 data
type: test type#0 data
type: selflink(resource(disk_type,0))
users:
- ww
- xx
Expand Down
2 changes: 1 addition & 1 deletion spec/data/network/gcompute_disk/success1~title.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ sourceSnapshotEncryptionKey:
rawKey: test raw_key#0 data
sha256: test sha256#0 data
sourceSnapshotId: test source_snapshot_id#0 data
type: test type#0 data
type: selflink(resource(disk_type,0))
users:
- ww
- xx
Expand Down
2 changes: 1 addition & 1 deletion spec/data/network/gcompute_disk/success2~name.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ sourceSnapshotEncryptionKey:
rawKey: test raw_key#1 data
sha256: test sha256#1 data
sourceSnapshotId: test source_snapshot_id#1 data
type: test type#1 data
type: selflink(resource(disk_type,1))
users:
- uu
- vv
Expand Down
2 changes: 1 addition & 1 deletion spec/data/network/gcompute_disk/success2~title.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ sourceSnapshotEncryptionKey:
rawKey: test raw_key#1 data
sha256: test sha256#1 data
sourceSnapshotId: test source_snapshot_id#1 data
type: test type#1 data
type: selflink(resource(disk_type,1))
users:
- uu
- vv
Expand Down
2 changes: 1 addition & 1 deletion spec/data/network/gcompute_disk/success3~name.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ sourceSnapshotEncryptionKey:
rawKey: test raw_key#2 data
sha256: test sha256#2 data
sourceSnapshotId: test source_snapshot_id#2 data
type: test type#2 data
type: selflink(resource(disk_type,2))
users:
- ss
- tt
Expand Down
2 changes: 1 addition & 1 deletion spec/data/network/gcompute_disk/success3~title.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ sourceSnapshotEncryptionKey:
rawKey: test raw_key#2 data
sha256: test sha256#2 data
sourceSnapshotId: test source_snapshot_id#2 data
type: test type#2 data
type: selflink(resource(disk_type,2))
users:
- ss
- tt
Expand Down
Loading