Skip to content

Add support for Third Party Identity #9236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/12604.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
workbench: added `enable_third_party_identity` field to `google_workbench_instance` resource.
```
33 changes: 33 additions & 0 deletions google-beta/services/workbench/resource_workbench_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ func ResourceWorkbenchInstance() *schema.Resource {
ForceNew: true,
Description: `Optional. If true, the workbench instance will not register with the proxy.`,
},
"enable_third_party_identity": {
Type: schema.TypeBool,
Optional: true,
Description: `Flag that specifies that a notebook can be accessed with third party
identity provider.`,
},
"gce_setup": {
Type: schema.TypeList,
Computed: true,
Expand Down Expand Up @@ -860,6 +866,12 @@ func resourceWorkbenchInstanceCreate(d *schema.ResourceData, meta interface{}) e
} else if v, ok := d.GetOkExists("disable_proxy_access"); !tpgresource.IsEmptyValue(reflect.ValueOf(disableProxyAccessProp)) && (ok || !reflect.DeepEqual(v, disableProxyAccessProp)) {
obj["disableProxyAccess"] = disableProxyAccessProp
}
enableThirdPartyIdentityProp, err := expandWorkbenchInstanceEnableThirdPartyIdentity(d.Get("enable_third_party_identity"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("enable_third_party_identity"); !tpgresource.IsEmptyValue(reflect.ValueOf(enableThirdPartyIdentityProp)) && (ok || !reflect.DeepEqual(v, enableThirdPartyIdentityProp)) {
obj["enableThirdPartyIdentity"] = enableThirdPartyIdentityProp
}
labelsProp, err := expandWorkbenchInstanceEffectiveLabels(d.Get("effective_labels"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -1028,6 +1040,9 @@ func resourceWorkbenchInstanceRead(d *schema.ResourceData, meta interface{}) err
if err := d.Set("labels", flattenWorkbenchInstanceLabels(res["labels"], d, config)); err != nil {
return fmt.Errorf("Error reading Instance: %s", err)
}
if err := d.Set("enable_third_party_identity", flattenWorkbenchInstanceEnableThirdPartyIdentity(res["enableThirdPartyIdentity"], d, config)); err != nil {
return fmt.Errorf("Error reading Instance: %s", err)
}
if err := d.Set("terraform_labels", flattenWorkbenchInstanceTerraformLabels(res["labels"], d, config)); err != nil {
return fmt.Errorf("Error reading Instance: %s", err)
}
Expand Down Expand Up @@ -1060,6 +1075,12 @@ func resourceWorkbenchInstanceUpdate(d *schema.ResourceData, meta interface{}) e
} else if v, ok := d.GetOkExists("gce_setup"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, gceSetupProp)) {
obj["gceSetup"] = gceSetupProp
}
enableThirdPartyIdentityProp, err := expandWorkbenchInstanceEnableThirdPartyIdentity(d.Get("enable_third_party_identity"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("enable_third_party_identity"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, enableThirdPartyIdentityProp)) {
obj["enableThirdPartyIdentity"] = enableThirdPartyIdentityProp
}
labelsProp, err := expandWorkbenchInstanceEffectiveLabels(d.Get("effective_labels"), d, config)
if err != nil {
return err
Expand All @@ -1080,6 +1101,10 @@ func resourceWorkbenchInstanceUpdate(d *schema.ResourceData, meta interface{}) e
updateMask = append(updateMask, "gceSetup")
}

if d.HasChange("enable_third_party_identity") {
updateMask = append(updateMask, "enableThirdPartyIdentity")
}

if d.HasChange("effective_labels") {
updateMask = append(updateMask, "labels")
}
Expand Down Expand Up @@ -1732,6 +1757,10 @@ func flattenWorkbenchInstanceLabels(v interface{}, d *schema.ResourceData, confi
return transformed
}

func flattenWorkbenchInstanceEnableThirdPartyIdentity(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

func flattenWorkbenchInstanceTerraformLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
if v == nil {
return v
Expand Down Expand Up @@ -2288,6 +2317,10 @@ func expandWorkbenchInstanceDisableProxyAccess(v interface{}, d tpgresource.Terr
return v, nil
}

func expandWorkbenchInstanceEnableThirdPartyIdentity(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandWorkbenchInstanceEffectiveLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
if v == nil {
return map[string]string{}, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fields:
- field: 'disable_proxy_access'
- field: 'effective_labels'
provider_only: true
- field: 'enable_third_party_identity'
- field: 'gce_setup.accelerator_configs.core_count'
- field: 'gce_setup.accelerator_configs.type'
- field: 'gce_setup.boot_disk.disk_encryption'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ resource "google_workbench_instance" "instance" {

desired_state = "ACTIVE"

enable_third_party_identity = "true"

}
`, context)
}
Expand Down
7 changes: 7 additions & 0 deletions website/docs/r/workbench_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ resource "google_workbench_instance" "instance" {

desired_state = "ACTIVE"

enable_third_party_identity = "true"

}
```

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

* `enable_third_party_identity` -
(Optional)
Flag that specifies that a notebook can be accessed with third party
identity provider.

* `instance_id` -
(Optional)
Required. User-defined unique ID of this instance.
Expand Down