Skip to content

Commit f7e5b92

Browse files
Add support for Third Party Identity (#12604) (#9236)
[upstream:ca5a16cfc7771f028230d4b1f071aebdbada278f] Signed-off-by: Modular Magician <[email protected]>
1 parent 7c16650 commit f7e5b92

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

.changelog/12604.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
workbench: added `enable_third_party_identity` field to `google_workbench_instance` resource.
3+
```

google-beta/services/workbench/resource_workbench_instance.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,12 @@ func ResourceWorkbenchInstance() *schema.Resource {
334334
ForceNew: true,
335335
Description: `Optional. If true, the workbench instance will not register with the proxy.`,
336336
},
337+
"enable_third_party_identity": {
338+
Type: schema.TypeBool,
339+
Optional: true,
340+
Description: `Flag that specifies that a notebook can be accessed with third party
341+
identity provider.`,
342+
},
337343
"gce_setup": {
338344
Type: schema.TypeList,
339345
Computed: true,
@@ -860,6 +866,12 @@ func resourceWorkbenchInstanceCreate(d *schema.ResourceData, meta interface{}) e
860866
} else if v, ok := d.GetOkExists("disable_proxy_access"); !tpgresource.IsEmptyValue(reflect.ValueOf(disableProxyAccessProp)) && (ok || !reflect.DeepEqual(v, disableProxyAccessProp)) {
861867
obj["disableProxyAccess"] = disableProxyAccessProp
862868
}
869+
enableThirdPartyIdentityProp, err := expandWorkbenchInstanceEnableThirdPartyIdentity(d.Get("enable_third_party_identity"), d, config)
870+
if err != nil {
871+
return err
872+
} else if v, ok := d.GetOkExists("enable_third_party_identity"); !tpgresource.IsEmptyValue(reflect.ValueOf(enableThirdPartyIdentityProp)) && (ok || !reflect.DeepEqual(v, enableThirdPartyIdentityProp)) {
873+
obj["enableThirdPartyIdentity"] = enableThirdPartyIdentityProp
874+
}
863875
labelsProp, err := expandWorkbenchInstanceEffectiveLabels(d.Get("effective_labels"), d, config)
864876
if err != nil {
865877
return err
@@ -1028,6 +1040,9 @@ func resourceWorkbenchInstanceRead(d *schema.ResourceData, meta interface{}) err
10281040
if err := d.Set("labels", flattenWorkbenchInstanceLabels(res["labels"], d, config)); err != nil {
10291041
return fmt.Errorf("Error reading Instance: %s", err)
10301042
}
1043+
if err := d.Set("enable_third_party_identity", flattenWorkbenchInstanceEnableThirdPartyIdentity(res["enableThirdPartyIdentity"], d, config)); err != nil {
1044+
return fmt.Errorf("Error reading Instance: %s", err)
1045+
}
10311046
if err := d.Set("terraform_labels", flattenWorkbenchInstanceTerraformLabels(res["labels"], d, config)); err != nil {
10321047
return fmt.Errorf("Error reading Instance: %s", err)
10331048
}
@@ -1060,6 +1075,12 @@ func resourceWorkbenchInstanceUpdate(d *schema.ResourceData, meta interface{}) e
10601075
} else if v, ok := d.GetOkExists("gce_setup"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, gceSetupProp)) {
10611076
obj["gceSetup"] = gceSetupProp
10621077
}
1078+
enableThirdPartyIdentityProp, err := expandWorkbenchInstanceEnableThirdPartyIdentity(d.Get("enable_third_party_identity"), d, config)
1079+
if err != nil {
1080+
return err
1081+
} else if v, ok := d.GetOkExists("enable_third_party_identity"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, enableThirdPartyIdentityProp)) {
1082+
obj["enableThirdPartyIdentity"] = enableThirdPartyIdentityProp
1083+
}
10631084
labelsProp, err := expandWorkbenchInstanceEffectiveLabels(d.Get("effective_labels"), d, config)
10641085
if err != nil {
10651086
return err
@@ -1080,6 +1101,10 @@ func resourceWorkbenchInstanceUpdate(d *schema.ResourceData, meta interface{}) e
10801101
updateMask = append(updateMask, "gceSetup")
10811102
}
10821103

1104+
if d.HasChange("enable_third_party_identity") {
1105+
updateMask = append(updateMask, "enableThirdPartyIdentity")
1106+
}
1107+
10831108
if d.HasChange("effective_labels") {
10841109
updateMask = append(updateMask, "labels")
10851110
}
@@ -1732,6 +1757,10 @@ func flattenWorkbenchInstanceLabels(v interface{}, d *schema.ResourceData, confi
17321757
return transformed
17331758
}
17341759

1760+
func flattenWorkbenchInstanceEnableThirdPartyIdentity(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
1761+
return v
1762+
}
1763+
17351764
func flattenWorkbenchInstanceTerraformLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
17361765
if v == nil {
17371766
return v
@@ -2288,6 +2317,10 @@ func expandWorkbenchInstanceDisableProxyAccess(v interface{}, d tpgresource.Terr
22882317
return v, nil
22892318
}
22902319

2320+
func expandWorkbenchInstanceEnableThirdPartyIdentity(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
2321+
return v, nil
2322+
}
2323+
22912324
func expandWorkbenchInstanceEffectiveLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
22922325
if v == nil {
22932326
return map[string]string{}, nil

google-beta/services/workbench/resource_workbench_instance_generated_meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ fields:
1212
- field: 'disable_proxy_access'
1313
- field: 'effective_labels'
1414
provider_only: true
15+
- field: 'enable_third_party_identity'
1516
- field: 'gce_setup.accelerator_configs.core_count'
1617
- field: 'gce_setup.accelerator_configs.type'
1718
- field: 'gce_setup.boot_disk.disk_encryption'

google-beta/services/workbench/resource_workbench_instance_generated_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,8 @@ resource "google_workbench_instance" "instance" {
332332
333333
desired_state = "ACTIVE"
334334
335+
enable_third_party_identity = "true"
336+
335337
}
336338
`, context)
337339
}

website/docs/r/workbench_instance.html.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ resource "google_workbench_instance" "instance" {
217217
218218
desired_state = "ACTIVE"
219219
220+
enable_third_party_identity = "true"
221+
220222
}
221223
```
222224

@@ -262,6 +264,11 @@ The following arguments are supported:
262264
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
263265
Please refer to the field `effective_labels` for all of the labels present on the resource.
264266

267+
* `enable_third_party_identity` -
268+
(Optional)
269+
Flag that specifies that a notebook can be accessed with third party
270+
identity provider.
271+
265272
* `instance_id` -
266273
(Optional)
267274
Required. User-defined unique ID of this instance.

0 commit comments

Comments
 (0)