Skip to content
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

Add Oracle support to DBMS #1538

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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/hcl/v2 v2.14.1
github.com/hashicorp/terraform-json v0.14.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231002220843-9aba12d2fa12
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231003001227-f655a1774178
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ github.com/hashicorp/terraform-plugin-log v0.7.0/go.mod h1:p4R1jWBXRTvL4odmEkFfD
github.com/hashicorp/terraform-plugin-mux v0.8.0 h1:WCTP66mZ+iIaIrCNJnjPEYnVjawTshnDJu12BcXK1EI=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0 h1:FtCLTiTcykdsURXPt/ku7fYXm3y19nbzbZcUxHx9RbI=
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0/go.mod h1:80wf5oad1tW+oLnbXS4UTYmDCrl7BuN1Q+IA91X1a4Y=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231002220843-9aba12d2fa12 h1:CjPXNTTmyiSIrem5N/hMY6OdSBzhFcbJvTnlhVfxXMA=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231002220843-9aba12d2fa12/go.mod h1:B+SSTmJXSg9TngEVOwrjgWj3AjQFwLsSNRD29750JJI=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231003001227-f655a1774178 h1:bQZg70sWUKZLzAHBEl1fzrlxNkw2QNADa8eJtIWUleU=
github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20231003001227-f655a1774178/go.mod h1:B+SSTmJXSg9TngEVOwrjgWj3AjQFwLsSNRD29750JJI=
github.com/hashicorp/terraform-registry-address v0.1.0 h1:W6JkV9wbum+m516rCl5/NjKxCyTVaaUBbzYcMzBDO3U=
github.com/hashicorp/terraform-registry-address v0.1.0/go.mod h1:EnyO2jYO6j29DTHbJcm00E5nQTFeTtyZH3H5ycydQ5A=
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ func GetDatabaseMigrationServiceConnectionProfileApiObject(d tpgresource.Terrafo
} else if v, ok := d.GetOkExists("postgresql"); !tpgresource.IsEmptyValue(reflect.ValueOf(postgresqlProp)) && (ok || !reflect.DeepEqual(v, postgresqlProp)) {
obj["postgresql"] = postgresqlProp
}
oracleProp, err := expandDatabaseMigrationServiceConnectionProfileOracle(d.Get("oracle"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("oracle"); !tpgresource.IsEmptyValue(reflect.ValueOf(oracleProp)) && (ok || !reflect.DeepEqual(v, oracleProp)) {
obj["oracle"] = oracleProp
}
cloudsqlProp, err := expandDatabaseMigrationServiceConnectionProfileCloudsql(d.Get("cloudsql"), d, config)
if err != nil {
return nil, err
Expand Down Expand Up @@ -391,6 +397,273 @@ func expandDatabaseMigrationServiceConnectionProfilePostgresqlNetworkArchitectur
return v, nil
}

func expandDatabaseMigrationServiceConnectionProfileOracle(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})

transformedHost, err := expandDatabaseMigrationServiceConnectionProfileOracleHost(original["host"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedHost); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["host"] = transformedHost
}

transformedPort, err := expandDatabaseMigrationServiceConnectionProfileOraclePort(original["port"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPort); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["port"] = transformedPort
}

transformedUsername, err := expandDatabaseMigrationServiceConnectionProfileOracleUsername(original["username"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedUsername); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["username"] = transformedUsername
}

transformedPassword, err := expandDatabaseMigrationServiceConnectionProfileOraclePassword(original["password"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPassword); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["password"] = transformedPassword
}

transformedPasswordSet, err := expandDatabaseMigrationServiceConnectionProfileOraclePasswordSet(original["password_set"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPasswordSet); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["passwordSet"] = transformedPasswordSet
}

transformedDatabaseService, err := expandDatabaseMigrationServiceConnectionProfileOracleDatabaseService(original["database_service"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedDatabaseService); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["databaseService"] = transformedDatabaseService
}

transformedSsl, err := expandDatabaseMigrationServiceConnectionProfileOracleSsl(original["ssl"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedSsl); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["ssl"] = transformedSsl
}

transformedStaticServiceIpConnectivity, err := expandDatabaseMigrationServiceConnectionProfileOracleStaticServiceIpConnectivity(original["static_service_ip_connectivity"], d, config)
if err != nil {
return nil, err
} else {
transformed["staticServiceIpConnectivity"] = transformedStaticServiceIpConnectivity
}

transformedForwardSshConnectivity, err := expandDatabaseMigrationServiceConnectionProfileOracleForwardSshConnectivity(original["forward_ssh_connectivity"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedForwardSshConnectivity); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["forwardSshConnectivity"] = transformedForwardSshConnectivity
}

transformedPrivateConnectivity, err := expandDatabaseMigrationServiceConnectionProfileOraclePrivateConnectivity(original["private_connectivity"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPrivateConnectivity); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["privateConnectivity"] = transformedPrivateConnectivity
}

return transformed, nil
}

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

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

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

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

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

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

func expandDatabaseMigrationServiceConnectionProfileOracleSsl(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})

transformedType, err := expandDatabaseMigrationServiceConnectionProfileOracleSslType(original["type"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedType); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["type"] = transformedType
}

transformedClientKey, err := expandDatabaseMigrationServiceConnectionProfileOracleSslClientKey(original["client_key"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedClientKey); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["clientKey"] = transformedClientKey
}

transformedClientCertificate, err := expandDatabaseMigrationServiceConnectionProfileOracleSslClientCertificate(original["client_certificate"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedClientCertificate); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["clientCertificate"] = transformedClientCertificate
}

transformedCaCertificate, err := expandDatabaseMigrationServiceConnectionProfileOracleSslCaCertificate(original["ca_certificate"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedCaCertificate); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["caCertificate"] = transformedCaCertificate
}

return transformed, nil
}

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

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

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

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

func expandDatabaseMigrationServiceConnectionProfileOracleStaticServiceIpConnectivity(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 {
return nil, nil
}

if l[0] == nil {
transformed := make(map[string]interface{})
return transformed, nil
}
transformed := make(map[string]interface{})

return transformed, nil
}

func expandDatabaseMigrationServiceConnectionProfileOracleForwardSshConnectivity(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})

transformedHostname, err := expandDatabaseMigrationServiceConnectionProfileOracleForwardSshConnectivityHostname(original["hostname"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedHostname); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["hostname"] = transformedHostname
}

transformedUsername, err := expandDatabaseMigrationServiceConnectionProfileOracleForwardSshConnectivityUsername(original["username"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedUsername); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["username"] = transformedUsername
}

transformedPort, err := expandDatabaseMigrationServiceConnectionProfileOracleForwardSshConnectivityPort(original["port"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPort); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["port"] = transformedPort
}

transformedPassword, err := expandDatabaseMigrationServiceConnectionProfileOracleForwardSshConnectivityPassword(original["password"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPassword); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["password"] = transformedPassword
}

transformedPrivateKey, err := expandDatabaseMigrationServiceConnectionProfileOracleForwardSshConnectivityPrivateKey(original["private_key"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPrivateKey); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["privateKey"] = transformedPrivateKey
}

return transformed, nil
}

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

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

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

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

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

func expandDatabaseMigrationServiceConnectionProfileOraclePrivateConnectivity(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
return nil, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})

transformedPrivateConnection, err := expandDatabaseMigrationServiceConnectionProfileOraclePrivateConnectivityPrivateConnection(original["private_connection"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedPrivateConnection); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["privateConnection"] = transformedPrivateConnection
}

return transformed, nil
}

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

func expandDatabaseMigrationServiceConnectionProfileCloudsql(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
Expand Down