@@ -35,10 +35,12 @@ type Disk struct {
3535 Name * string
3636 Lifecycle fi.Lifecycle
3737
38- VolumeType * string
39- SizeGB * int64
40- Zone * string
41- Labels map [string ]string
38+ VolumeType * string
39+ SizeGB * int64
40+ VolumeIops * int64
41+ VolumeThroughput * int64
42+ Zone * string
43+ Labels map [string ]string
4244}
4345
4446var _ fi.CompareWithID = & Disk {}
@@ -63,6 +65,8 @@ func (e *Disk) Find(c *fi.CloudupContext) (*Disk, error) {
6365 actual .VolumeType = fi .PtrTo (gce .LastComponent (r .Type ))
6466 actual .Zone = fi .PtrTo (gce .LastComponent (r .Zone ))
6567 actual .SizeGB = & r .SizeGb
68+ actual .VolumeIops = & r .ProvisionedIops
69+ actual .VolumeThroughput = & r .ProvisionedThroughput
6670
6771 actual .Labels = r .Labels
6872
@@ -86,7 +90,7 @@ func (e *Disk) Run(c *fi.CloudupContext) error {
8690 return fi .CloudupDefaultDeltaRunMethod (e , c )
8791}
8892
89- func (_ * Disk ) CheckChanges (a , e , changes * Disk ) error {
93+ func (* Disk ) CheckChanges (a , e , changes * Disk ) error {
9094 if a != nil {
9195 if changes .SizeGB != nil {
9296 return fi .CannotChangeField ("SizeGB" )
@@ -105,17 +109,19 @@ func (_ *Disk) CheckChanges(a, e, changes *Disk) error {
105109 return nil
106110}
107111
108- func (_ * Disk ) RenderGCE (t * gce.GCEAPITarget , a , e , changes * Disk ) error {
112+ func (* Disk ) RenderGCE (t * gce.GCEAPITarget , a , e , changes * Disk ) error {
109113 cloud := t .Cloud
110114 typeURL := fmt .Sprintf ("https://www.googleapis.com/compute/v1/projects/%s/zones/%s/diskTypes/%s" ,
111115 cloud .Project (),
112116 * e .Zone ,
113117 * e .VolumeType )
114118
115119 disk := & compute.Disk {
116- Name : * e .Name ,
117- SizeGb : * e .SizeGB ,
118- Type : typeURL ,
120+ Name : * e .Name ,
121+ SizeGb : * e .SizeGB ,
122+ Type : typeURL ,
123+ ProvisionedIops : * e .VolumeIops ,
124+ ProvisionedThroughput : * e .VolumeThroughput ,
119125 }
120126
121127 if a == nil {
@@ -164,26 +170,30 @@ func (_ *Disk) RenderGCE(t *gce.GCEAPITarget, a, e, changes *Disk) error {
164170}
165171
166172type terraformDisk struct {
167- Name * string `cty:"name"`
168- VolumeType * string `cty:"type"`
169- SizeGB * int64 `cty:"size"`
170- Zone * string `cty:"zone"`
171- Labels map [string ]string `cty:"labels"`
173+ Name * string `cty:"name"`
174+ VolumeType * string `cty:"type"`
175+ SizeGB * int64 `cty:"size"`
176+ ProvisionedIops * int64 `cty:"provisioned_iops"`
177+ ProvisionedThroughput * int64 `cty:"provisioned_throughput"`
178+ Zone * string `cty:"zone"`
179+ Labels map [string ]string `cty:"labels"`
172180}
173181
174- func (_ * Disk ) RenderTerraform (t * terraform.TerraformTarget , a , e , changes * Disk ) error {
182+ func (* Disk ) RenderTerraform (t * terraform.TerraformTarget , a , e , changes * Disk ) error {
175183 cloud := t .Cloud .(gce.GCECloud )
176184
177185 labels := make (map [string ]string )
178186 maps .Copy (labels , cloud .Labels ())
179187 maps .Copy (labels , e .Labels )
180188
181189 tf := & terraformDisk {
182- Name : e .Name ,
183- VolumeType : e .VolumeType ,
184- SizeGB : e .SizeGB ,
185- Zone : e .Zone ,
186- Labels : labels ,
190+ Name : e .Name ,
191+ VolumeType : e .VolumeType ,
192+ SizeGB : e .SizeGB ,
193+ ProvisionedIops : e .VolumeIops ,
194+ ProvisionedThroughput : e .VolumeThroughput ,
195+ Zone : e .Zone ,
196+ Labels : labels ,
187197 }
188198 return t .RenderResource ("google_compute_disk" , * e .Name , tf )
189199}
0 commit comments