From c698c6b41677d7a0f8e288aa949dc522c117915b Mon Sep 17 00:00:00 2001 From: The Magician Date: Fri, 22 Sep 2023 16:57:31 -0400 Subject: [PATCH] Add support for replica zones, service account scopes, and auditd logging in workstations configs (#9028) (#1487) Signed-off-by: Modular Magician --- .../workstations_workstation_config.go | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tfplan2cai/converters/google/resources/services/workstations/workstations_workstation_config.go b/tfplan2cai/converters/google/resources/services/workstations/workstations_workstation_config.go index 366011f0c..552840608 100644 --- a/tfplan2cai/converters/google/resources/services/workstations/workstations_workstation_config.go +++ b/tfplan2cai/converters/google/resources/services/workstations/workstations_workstation_config.go @@ -90,6 +90,18 @@ func GetWorkstationsWorkstationConfigApiObject(d tpgresource.TerraformResourceDa } else if v, ok := d.GetOkExists("running_timeout"); !tpgresource.IsEmptyValue(reflect.ValueOf(runningTimeoutProp)) && (ok || !reflect.DeepEqual(v, runningTimeoutProp)) { obj["runningTimeout"] = runningTimeoutProp } + replicaZonesProp, err := expandWorkstationsWorkstationConfigReplicaZones(d.Get("replica_zones"), d, config) + if err != nil { + return nil, err + } else if v, ok := d.GetOkExists("replica_zones"); !tpgresource.IsEmptyValue(reflect.ValueOf(replicaZonesProp)) && (ok || !reflect.DeepEqual(v, replicaZonesProp)) { + obj["replicaZones"] = replicaZonesProp + } + enableAuditAgentProp, err := expandWorkstationsWorkstationConfigEnableAuditAgent(d.Get("enable_audit_agent"), d, config) + if err != nil { + return nil, err + } else if v, ok := d.GetOkExists("enable_audit_agent"); !tpgresource.IsEmptyValue(reflect.ValueOf(enableAuditAgentProp)) && (ok || !reflect.DeepEqual(v, enableAuditAgentProp)) { + obj["enableAuditAgent"] = enableAuditAgentProp + } hostProp, err := expandWorkstationsWorkstationConfigHost(d.Get("host"), d, config) if err != nil { return nil, err @@ -156,6 +168,14 @@ func expandWorkstationsWorkstationConfigRunningTimeout(v interface{}, d tpgresou return v, nil } +func expandWorkstationsWorkstationConfigReplicaZones(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandWorkstationsWorkstationConfigEnableAuditAgent(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + func expandWorkstationsWorkstationConfigHost(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { @@ -198,6 +218,13 @@ func expandWorkstationsWorkstationConfigHostGceInstance(v interface{}, d tpgreso transformed["serviceAccount"] = transformedServiceAccount } + transformedServiceAccountScopes, err := expandWorkstationsWorkstationConfigHostGceInstanceServiceAccountScopes(original["service_account_scopes"], d, config) + if err != nil { + return nil, err + } else if val := reflect.ValueOf(transformedServiceAccountScopes); val.IsValid() && !tpgresource.IsEmptyValue(val) { + transformed["serviceAccountScopes"] = transformedServiceAccountScopes + } + transformedPoolSize, err := expandWorkstationsWorkstationConfigHostGceInstancePoolSize(original["pool_size"], d, config) if err != nil { return nil, err @@ -265,6 +292,10 @@ func expandWorkstationsWorkstationConfigHostGceInstanceServiceAccount(v interfac return v, nil } +func expandWorkstationsWorkstationConfigHostGceInstanceServiceAccountScopes(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + func expandWorkstationsWorkstationConfigHostGceInstancePoolSize(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil }