mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-03 01:01:06 +00:00
69c09c1cb7
Supports configuring the disk type for Google Compute Engine disk resources. Both `google_compute_disk` and `google_compute_instance` disk types are supported. Resolves #351.
16 lines
429 B
Go
16 lines
429 B
Go
package google
|
|
|
|
import (
|
|
"code.google.com/p/google-api-go-client/compute/v1"
|
|
)
|
|
|
|
// readDiskType finds the disk type with the given name.
|
|
func readDiskType(c *Config, zone *compute.Zone, name string) (*compute.DiskType, error) {
|
|
diskType, err := c.clientCompute.DiskTypes.Get(c.Project, zone.Name, name).Do()
|
|
if err == nil && diskType != nil && diskType.SelfLink != "" {
|
|
return diskType, nil
|
|
} else {
|
|
return nil, err
|
|
}
|
|
}
|