@@ -117,8 +117,8 @@ If not specified, this defaults to 100.`,
117
117
Type : schema .TypeString ,
118
118
Optional : true ,
119
119
ForceNew : true ,
120
- ValidateFunc : validateEnum ([]string {"DISK_TYPE_UNSPECIFIED" , "PD_STANDARD" , "PD_SSD" , "PD_BALANCED" , "" }),
121
- Description : `Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED"]` ,
120
+ ValidateFunc : validateEnum ([]string {"DISK_TYPE_UNSPECIFIED" , "PD_STANDARD" , "PD_SSD" , "PD_BALANCED" , "PD_EXTREME" , " " }),
121
+ Description : `Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME" ]` ,
122
122
},
123
123
"container_image" : {
124
124
Type : schema .TypeList ,
@@ -165,9 +165,9 @@ If not specified, this defaults to 100.`,
165
165
Type : schema .TypeString ,
166
166
Optional : true ,
167
167
ForceNew : true ,
168
- ValidateFunc : validateEnum ([]string {"DISK_TYPE_UNSPECIFIED" , "PD_STANDARD" , "PD_SSD" , "PD_BALANCED" , "" }),
168
+ ValidateFunc : validateEnum ([]string {"DISK_TYPE_UNSPECIFIED" , "PD_STANDARD" , "PD_SSD" , "PD_BALANCED" , "PD_EXTREME" , " " }),
169
169
DiffSuppressFunc : emptyOrDefaultStringSuppress ("DISK_TYPE_UNSPECIFIED" ),
170
- Description : `Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED"]` ,
170
+ Description : `Possible disk types for notebook instances. Possible values: ["DISK_TYPE_UNSPECIFIED", "PD_STANDARD", "PD_SSD", "PD_BALANCED", "PD_EXTREME" ]` ,
171
171
},
172
172
"disk_encryption" : {
173
173
Type : schema .TypeString ,
@@ -231,6 +231,13 @@ An object containing a list of "key": value pairs. Example: { "name": "wrench",
231
231
Description : `The name of the VPC that this instance is in.
232
232
Format: projects/{project_id}/global/networks/{network_id}` ,
233
233
},
234
+ "nic_type" : {
235
+ Type : schema .TypeString ,
236
+ Optional : true ,
237
+ ForceNew : true ,
238
+ ValidateFunc : validateEnum ([]string {"UNSPECIFIED_NIC_TYPE" , "VIRTIO_NET" , "GVNIC" , "" }),
239
+ Description : `The type of vNIC driver. Possible values: ["UNSPECIFIED_NIC_TYPE", "VIRTIO_NET", "GVNIC"]` ,
240
+ },
234
241
"no_proxy_access" : {
235
242
Type : schema .TypeBool ,
236
243
Optional : true ,
@@ -257,6 +264,39 @@ Format: projects/{project_id}/global/networks/{network_id}`,
257
264
notebook instance fully boots up. The path must be a URL
258
265
or Cloud Storage path (gs://path-to-file/file-name).` ,
259
266
},
267
+ "reservation_affinity" : {
268
+ Type : schema .TypeList ,
269
+ Optional : true ,
270
+ ForceNew : true ,
271
+ Description : `Reservation Affinity for consuming Zonal reservation.` ,
272
+ MaxItems : 1 ,
273
+ Elem : & schema.Resource {
274
+ Schema : map [string ]* schema.Schema {
275
+ "consume_reservation_type" : {
276
+ Type : schema .TypeString ,
277
+ Required : true ,
278
+ ForceNew : true ,
279
+ ValidateFunc : validateEnum ([]string {"NO_RESERVATION" , "ANY_RESERVATION" , "SPECIFIC_RESERVATION" }),
280
+ Description : `The type of Compute Reservation. Possible values: ["NO_RESERVATION", "ANY_RESERVATION", "SPECIFIC_RESERVATION"]` ,
281
+ },
282
+ "key" : {
283
+ Type : schema .TypeString ,
284
+ Optional : true ,
285
+ ForceNew : true ,
286
+ Description : `Corresponds to the label key of reservation resource.` ,
287
+ },
288
+ "values" : {
289
+ Type : schema .TypeList ,
290
+ Optional : true ,
291
+ ForceNew : true ,
292
+ Description : `Corresponds to the label values of reservation resource.` ,
293
+ Elem : & schema.Schema {
294
+ Type : schema .TypeString ,
295
+ },
296
+ },
297
+ },
298
+ },
299
+ },
260
300
"service_account" : {
261
301
Type : schema .TypeString ,
262
302
Computed : true ,
@@ -452,6 +492,18 @@ func resourceNotebooksInstanceCreate(d *schema.ResourceData, meta interface{}) e
452
492
} else if v , ok := d .GetOkExists ("shielded_instance_config" ); ! isEmptyValue (reflect .ValueOf (shieldedInstanceConfigProp )) && (ok || ! reflect .DeepEqual (v , shieldedInstanceConfigProp )) {
453
493
obj ["shieldedInstanceConfig" ] = shieldedInstanceConfigProp
454
494
}
495
+ nicTypeProp , err := expandNotebooksInstanceNicType (d .Get ("nic_type" ), d , config )
496
+ if err != nil {
497
+ return err
498
+ } else if v , ok := d .GetOkExists ("nic_type" ); ! isEmptyValue (reflect .ValueOf (nicTypeProp )) && (ok || ! reflect .DeepEqual (v , nicTypeProp )) {
499
+ obj ["nicType" ] = nicTypeProp
500
+ }
501
+ reservationAffinityProp , err := expandNotebooksInstanceReservationAffinity (d .Get ("reservation_affinity" ), d , config )
502
+ if err != nil {
503
+ return err
504
+ } else if v , ok := d .GetOkExists ("reservation_affinity" ); ! isEmptyValue (reflect .ValueOf (reservationAffinityProp )) && (ok || ! reflect .DeepEqual (v , reservationAffinityProp )) {
505
+ obj ["reservationAffinity" ] = reservationAffinityProp
506
+ }
455
507
installGpuDriverProp , err := expandNotebooksInstanceInstallGpuDriver (d .Get ("install_gpu_driver" ), d , config )
456
508
if err != nil {
457
509
return err
@@ -671,6 +723,12 @@ func resourceNotebooksInstanceRead(d *schema.ResourceData, meta interface{}) err
671
723
if err := d .Set ("shielded_instance_config" , flattenNotebooksInstanceShieldedInstanceConfig (res ["shieldedInstanceConfig" ], d , config )); err != nil {
672
724
return fmt .Errorf ("Error reading Instance: %s" , err )
673
725
}
726
+ if err := d .Set ("nic_type" , flattenNotebooksInstanceNicType (res ["nicType" ], d , config )); err != nil {
727
+ return fmt .Errorf ("Error reading Instance: %s" , err )
728
+ }
729
+ if err := d .Set ("reservation_affinity" , flattenNotebooksInstanceReservationAffinity (res ["reservationAffinity" ], d , config )); err != nil {
730
+ return fmt .Errorf ("Error reading Instance: %s" , err )
731
+ }
674
732
if err := d .Set ("state" , flattenNotebooksInstanceState (res ["state" ], d , config )); err != nil {
675
733
return fmt .Errorf ("Error reading Instance: %s" , err )
676
734
}
@@ -927,6 +985,39 @@ func flattenNotebooksInstanceShieldedInstanceConfigEnableVtpm(v interface{}, d *
927
985
return v
928
986
}
929
987
988
+ func flattenNotebooksInstanceNicType (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
989
+ return v
990
+ }
991
+
992
+ func flattenNotebooksInstanceReservationAffinity (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
993
+ if v == nil {
994
+ return nil
995
+ }
996
+ original := v .(map [string ]interface {})
997
+ if len (original ) == 0 {
998
+ return nil
999
+ }
1000
+ transformed := make (map [string ]interface {})
1001
+ transformed ["consume_reservation_type" ] =
1002
+ flattenNotebooksInstanceReservationAffinityConsumeReservationType (original ["consumeReservationType" ], d , config )
1003
+ transformed ["key" ] =
1004
+ flattenNotebooksInstanceReservationAffinityKey (original ["key" ], d , config )
1005
+ transformed ["values" ] =
1006
+ flattenNotebooksInstanceReservationAffinityValues (original ["values" ], d , config )
1007
+ return []interface {}{transformed }
1008
+ }
1009
+ func flattenNotebooksInstanceReservationAffinityConsumeReservationType (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1010
+ return v
1011
+ }
1012
+
1013
+ func flattenNotebooksInstanceReservationAffinityKey (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1014
+ return v
1015
+ }
1016
+
1017
+ func flattenNotebooksInstanceReservationAffinityValues (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1018
+ return v
1019
+ }
1020
+
930
1021
func flattenNotebooksInstanceState (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
931
1022
return v
932
1023
}
@@ -1082,6 +1173,55 @@ func expandNotebooksInstanceShieldedInstanceConfigEnableVtpm(v interface{}, d Te
1082
1173
return v , nil
1083
1174
}
1084
1175
1176
+ func expandNotebooksInstanceNicType (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1177
+ return v , nil
1178
+ }
1179
+
1180
+ func expandNotebooksInstanceReservationAffinity (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1181
+ l := v .([]interface {})
1182
+ if len (l ) == 0 || l [0 ] == nil {
1183
+ return nil , nil
1184
+ }
1185
+ raw := l [0 ]
1186
+ original := raw .(map [string ]interface {})
1187
+ transformed := make (map [string ]interface {})
1188
+
1189
+ transformedConsumeReservationType , err := expandNotebooksInstanceReservationAffinityConsumeReservationType (original ["consume_reservation_type" ], d , config )
1190
+ if err != nil {
1191
+ return nil , err
1192
+ } else if val := reflect .ValueOf (transformedConsumeReservationType ); val .IsValid () && ! isEmptyValue (val ) {
1193
+ transformed ["consumeReservationType" ] = transformedConsumeReservationType
1194
+ }
1195
+
1196
+ transformedKey , err := expandNotebooksInstanceReservationAffinityKey (original ["key" ], d , config )
1197
+ if err != nil {
1198
+ return nil , err
1199
+ } else if val := reflect .ValueOf (transformedKey ); val .IsValid () && ! isEmptyValue (val ) {
1200
+ transformed ["key" ] = transformedKey
1201
+ }
1202
+
1203
+ transformedValues , err := expandNotebooksInstanceReservationAffinityValues (original ["values" ], d , config )
1204
+ if err != nil {
1205
+ return nil , err
1206
+ } else if val := reflect .ValueOf (transformedValues ); val .IsValid () && ! isEmptyValue (val ) {
1207
+ transformed ["values" ] = transformedValues
1208
+ }
1209
+
1210
+ return transformed , nil
1211
+ }
1212
+
1213
+ func expandNotebooksInstanceReservationAffinityConsumeReservationType (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1214
+ return v , nil
1215
+ }
1216
+
1217
+ func expandNotebooksInstanceReservationAffinityKey (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1218
+ return v , nil
1219
+ }
1220
+
1221
+ func expandNotebooksInstanceReservationAffinityValues (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1222
+ return v , nil
1223
+ }
1224
+
1085
1225
func expandNotebooksInstanceInstallGpuDriver (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1086
1226
return v , nil
1087
1227
}
0 commit comments