@@ -75,7 +75,7 @@ func resourceNotebooksRuntime() *schema.Resource {
75
75
Type : schema .TypeString ,
76
76
Required : true ,
77
77
ForceNew : true ,
78
- Description : `The name specified for the Notebook instance .` ,
78
+ Description : `The name specified for the Notebook runtime .` ,
79
79
},
80
80
"access_config" : {
81
81
Type : schema .TypeList ,
@@ -357,6 +357,7 @@ rest/v1/projects.locations.runtimes#AcceleratorType'`,
357
357
Type : schema .TypeList ,
358
358
Computed : true ,
359
359
Optional : true ,
360
+ ForceNew : true ,
360
361
Description : `Use a list of container images to start the notebook instance.` ,
361
362
Elem : & schema.Resource {
362
363
Schema : map [string ]* schema.Schema {
@@ -377,6 +378,7 @@ For example: gcr.io/{project_id}/{imageName}`,
377
378
"encryption_config" : {
378
379
Type : schema .TypeList ,
379
380
Optional : true ,
381
+ ForceNew : true ,
380
382
Description : `Encryption settings for virtual machine data disk.` ,
381
383
MaxItems : 1 ,
382
384
Elem : & schema.Resource {
@@ -396,6 +398,7 @@ It has the following format:
396
398
"internal_ip_only" : {
397
399
Type : schema .TypeBool ,
398
400
Optional : true ,
401
+ ForceNew : true ,
399
402
Description : `If true, runtime will only have internal IP addresses. By default,
400
403
runtimes are not restricted to internal IP addresses, and will
401
404
have ephemeral external IP addresses assigned to each vm. This
@@ -429,6 +432,7 @@ _metadata)).`,
429
432
"network" : {
430
433
Type : schema .TypeString ,
431
434
Optional : true ,
435
+ ForceNew : true ,
432
436
Description : `The Compute Engine network to be used for machine communications.
433
437
Cannot be specified with subnetwork. If neither 'network' nor
434
438
'subnet' is specified, the "default" network of the project is
@@ -447,13 +451,22 @@ Runtimes support the following network configurations:
447
451
"nic_type" : {
448
452
Type : schema .TypeString ,
449
453
Optional : true ,
454
+ ForceNew : true ,
450
455
ValidateFunc : validateEnum ([]string {"UNSPECIFIED_NIC_TYPE" , "VIRTIO_NET" , "GVNIC" , "" }),
451
456
Description : `The type of vNIC to be used on this interface. This may be gVNIC
452
457
or VirtioNet. Possible values: ["UNSPECIFIED_NIC_TYPE", "VIRTIO_NET", "GVNIC"]` ,
458
+ },
459
+ "reserved_ip_range" : {
460
+ Type : schema .TypeString ,
461
+ Optional : true ,
462
+ ForceNew : true ,
463
+ Description : `Reserved IP Range name is used for VPC Peering. The
464
+ subnetwork allocation will use the range *name* if it's assigned.` ,
453
465
},
454
466
"shielded_instance_config" : {
455
467
Type : schema .TypeList ,
456
468
Optional : true ,
469
+ ForceNew : true ,
457
470
Description : `Shielded VM Instance configuration settings.` ,
458
471
MaxItems : 1 ,
459
472
Elem : & schema.Resource {
@@ -489,6 +502,7 @@ default.`,
489
502
"subnet" : {
490
503
Type : schema .TypeString ,
491
504
Optional : true ,
505
+ ForceNew : true ,
492
506
Description : `The Compute Engine subnetwork to be used for machine
493
507
communications. Cannot be specified with network. A full URL or
494
508
partial URI are valid. Examples:
@@ -756,13 +770,35 @@ func resourceNotebooksRuntimeUpdate(d *schema.ResourceData, meta interface{}) er
756
770
}
757
771
758
772
log .Printf ("[DEBUG] Updating Runtime %q: %#v" , d .Id (), obj )
773
+ updateMask := []string {}
774
+
775
+ if d .HasChange ("virtual_machine" ) {
776
+ updateMask = append (updateMask , "virtualMachine" )
777
+ }
778
+
779
+ if d .HasChange ("access_config" ) {
780
+ updateMask = append (updateMask , "accessConfig" )
781
+ }
782
+
783
+ if d .HasChange ("software_config" ) {
784
+ updateMask = append (updateMask , "softwareConfig.idleShutdown" ,
785
+ "softwareConfig.idleShutdownTimeout" ,
786
+ "softwareConfig.customGpuDriverPath" ,
787
+ "softwareConfig.postStartupScript" )
788
+ }
789
+ // updateMask is a URL parameter but not present in the schema, so replaceVars
790
+ // won't set it
791
+ url , err = addQueryParams (url , map [string ]string {"updateMask" : strings .Join (updateMask , "," )})
792
+ if err != nil {
793
+ return err
794
+ }
759
795
760
796
// err == nil indicates that the billing_project value was found
761
797
if bp , err := getBillingProject (d , config ); err == nil {
762
798
billingProject = bp
763
799
}
764
800
765
- res , err := sendRequestWithTimeout (config , "PUT " , billingProject , url , userAgent , obj , d .Timeout (schema .TimeoutUpdate ))
801
+ res , err := sendRequestWithTimeout (config , "PATCH " , billingProject , url , userAgent , obj , d .Timeout (schema .TimeoutUpdate ))
766
802
767
803
if err != nil {
768
804
return fmt .Errorf ("Error updating Runtime %q: %s" , d .Id (), err )
@@ -910,6 +946,8 @@ func flattenNotebooksRuntimeVirtualMachineVirtualMachineConfig(v interface{}, d
910
946
flattenNotebooksRuntimeVirtualMachineVirtualMachineConfigLabels (original ["labels" ], d , config )
911
947
transformed ["nic_type" ] =
912
948
flattenNotebooksRuntimeVirtualMachineVirtualMachineConfigNicType (original ["nicType" ], d , config )
949
+ transformed ["reserved_ip_range" ] =
950
+ flattenNotebooksRuntimeVirtualMachineVirtualMachineConfigReservedIpRange (original ["reservedIpRange" ], d , config )
913
951
return []interface {}{transformed }
914
952
}
915
953
func flattenNotebooksRuntimeVirtualMachineVirtualMachineConfigZone (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
@@ -1207,6 +1245,10 @@ func flattenNotebooksRuntimeVirtualMachineVirtualMachineConfigNicType(v interfac
1207
1245
return v
1208
1246
}
1209
1247
1248
+ func flattenNotebooksRuntimeVirtualMachineVirtualMachineConfigReservedIpRange (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1249
+ return v
1250
+ }
1251
+
1210
1252
func flattenNotebooksRuntimeState (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
1211
1253
return v
1212
1254
}
@@ -1482,6 +1524,13 @@ func expandNotebooksRuntimeVirtualMachineVirtualMachineConfig(v interface{}, d T
1482
1524
transformed ["nicType" ] = transformedNicType
1483
1525
}
1484
1526
1527
+ transformedReservedIpRange , err := expandNotebooksRuntimeVirtualMachineVirtualMachineConfigReservedIpRange (original ["reserved_ip_range" ], d , config )
1528
+ if err != nil {
1529
+ return nil , err
1530
+ } else if val := reflect .ValueOf (transformedReservedIpRange ); val .IsValid () && ! isEmptyValue (val ) {
1531
+ transformed ["reservedIpRange" ] = transformedReservedIpRange
1532
+ }
1533
+
1485
1534
return transformed , nil
1486
1535
}
1487
1536
@@ -1899,6 +1948,10 @@ func expandNotebooksRuntimeVirtualMachineVirtualMachineConfigNicType(v interface
1899
1948
return v , nil
1900
1949
}
1901
1950
1951
+ func expandNotebooksRuntimeVirtualMachineVirtualMachineConfigReservedIpRange (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1952
+ return v , nil
1953
+ }
1954
+
1902
1955
func expandNotebooksRuntimeAccessConfig (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
1903
1956
l := v .([]interface {})
1904
1957
if len (l ) == 0 || l [0 ] == nil {
0 commit comments