@@ -194,6 +194,14 @@ Please refer to the field 'effective_labels' for all of the labels present on th
194
194
Optional : true ,
195
195
Description : `The number of CPU's in the VM instance.` ,
196
196
},
197
+ "machine_type" : {
198
+ Type : schema .TypeString ,
199
+ Computed : true ,
200
+ Optional : true ,
201
+ Description : `Machine type of the VM instance.
202
+ E.g. "n2-highmem-4", "n2-highmem-8", "c4a-highmem-4-lssd".
203
+ 'cpu_count' must match the number of vCPUs in the machine type.` ,
204
+ },
197
205
},
198
206
},
199
207
},
@@ -1180,6 +1188,8 @@ func flattenAlloydbInstanceMachineConfig(v interface{}, d *schema.ResourceData,
1180
1188
transformed := make (map [string ]interface {})
1181
1189
transformed ["cpu_count" ] =
1182
1190
flattenAlloydbInstanceMachineConfigCpuCount (original ["cpuCount" ], d , config )
1191
+ transformed ["machine_type" ] =
1192
+ flattenAlloydbInstanceMachineConfigMachineType (original ["machineType" ], d , config )
1183
1193
return []interface {}{transformed }
1184
1194
}
1185
1195
func flattenAlloydbInstanceMachineConfigCpuCount (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
@@ -1199,6 +1209,10 @@ func flattenAlloydbInstanceMachineConfigCpuCount(v interface{}, d *schema.Resour
1199
1209
return v // let terraform core handle it otherwise
1200
1210
}
1201
1211
1212
+ func flattenAlloydbInstanceMachineConfigMachineType (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1213
+ return v
1214
+ }
1215
+
1202
1216
func flattenAlloydbInstanceClientConnectionConfig (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
1203
1217
if v == nil {
1204
1218
return nil
@@ -1542,13 +1556,24 @@ func expandAlloydbInstanceMachineConfig(v interface{}, d tpgresource.TerraformRe
1542
1556
transformed ["cpuCount" ] = transformedCpuCount
1543
1557
}
1544
1558
1559
+ transformedMachineType , err := expandAlloydbInstanceMachineConfigMachineType (original ["machine_type" ], d , config )
1560
+ if err != nil {
1561
+ return nil , err
1562
+ } else if val := reflect .ValueOf (transformedMachineType ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
1563
+ transformed ["machineType" ] = transformedMachineType
1564
+ }
1565
+
1545
1566
return transformed , nil
1546
1567
}
1547
1568
1548
1569
func expandAlloydbInstanceMachineConfigCpuCount (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1549
1570
return v , nil
1550
1571
}
1551
1572
1573
+ func expandAlloydbInstanceMachineConfigMachineType (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1574
+ return v , nil
1575
+ }
1576
+
1552
1577
func expandAlloydbInstanceClientConnectionConfig (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
1553
1578
l := v .([]interface {})
1554
1579
if len (l ) == 0 || l [0 ] == nil {
0 commit comments