Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move DiskType to a resourceref so you can successfully create ssd disks. #337

Merged
merged 4 commits into from
Jul 10, 2018

Conversation

nat-henderson
Copy link
Contributor

Right now, if you try to create an SSD with the following example:

gauth_credential { 'mycred':
  path     => $cred_path, 
  provider => serviceaccount,
  scopes   => [
    'https://www.googleapis.com/auth/compute',
  ],
}

gcompute_zone { 'us-central1-a':
  project    => $project,
  credential => 'mycred',
}

gcompute_disk_type { 'pd-ssd':
  default_disk_size_gb => 100,
  project              => $project,
  zone                 => 'us-central1-a',
  credential           => 'mycred',
}

gcompute_disk { 'data-disk-1':
  ensure              => present,
  size_gb             => 50,
  type                => 'pd-ssd',
  disk_encryption_key => {
    raw_key => 'SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=',
  },
  zone                => 'us-central1-a',
  project             => $project, # e.g. 'my-test-project'
  credential          => 'mycred',
}

You'll get a disk which is just a regular non-ssd. This is because type was never set up to be a DiskType ResourceRef, so it's trying to use the literal string 'pd-ssd', which won't work.

This adds that.


[all]

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

[terraform]

[puppet]

[puppet-compute]

[puppet-sql]

[puppet-storage]

[chef]

[chef-compute]

[chef-sql]

[chef-storage]

[ansible]

The function called for virtual resourceref selflinks was different here
and at the declaration point.  Here it was
'underscored(prop.name)_selflink', but in the other place it's
underscored(referenced_resource.name)_selflink'.  This works sometimes,
but in case of 'DiskType' vs Disk's field 'Type', it doesn't.
@modular-magician
Copy link
Collaborator

I am a robot that works on MagicModules PRs!

I built this PR into one or more PRs on other repositories, and when those are closed, this PR will also be merged and closed.
depends: hashicorp/terraform-provider-google#1748
depends: modular-magician/ansible#48
depends: GoogleCloudPlatform/puppet-google-compute#67
depends: GoogleCloudPlatform/chef-google-compute#29

Tracked submodules are build/puppet/compute build/puppet/sql build/puppet/storage build/chef/compute build/chef/sql build/chef/storage build/terraform build/ansible.
@modular-magician modular-magician merged commit 4b0efbd into master Jul 10, 2018
@modular-magician
Copy link
Collaborator

I am (still) a robot that works on MagicModules PRs!

I just wanted to let you know that your changes (as of commit 5ed7bd0) have been included in your existing downstream PRs.

@modular-magician
Copy link
Collaborator

I am (still) a robot that works on MagicModules PRs!

I just wanted to let you know that your changes (as of commit 063d758) have been included in your existing downstream PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants