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

f/aws_dms_endpoint: Adding PostgreSQL settings support #34724

Merged
merged 18 commits into from
Dec 13, 2023
Merged
Prev Previous commit
Next Next commit
wip - little changes
  • Loading branch information
Andrea Quintino committed Nov 25, 2023
commit 50ec6c3f7c6bc3b00dbd1caa01a5dacdbaff5e19
28 changes: 16 additions & 12 deletions internal/service/dms/endpoint.go
Original file line number Diff line number Diff line change
@@ -828,24 +828,22 @@ func resourceEndpointCreate(ctx context.Context, d *schema.ResourceData, meta in
expandTopLevelConnectionInfo(d, input)
}
case engineNameAuroraPostgresql, engineNamePostgres:
postgres_settings := expandPostgreSQLSettings()
if _, ok := d.GetOk("secrets_manager_arn"); ok {
input.PostgreSQLSettings = &dms.PostgreSQLSettings{
SecretsManagerAccessRoleArn: aws.String(d.Get("secrets_manager_access_role_arn").(string)),
SecretsManagerSecretId: aws.String(d.Get("secrets_manager_arn").(string)),
DatabaseName: aws.String(d.Get("database_name").(string)),
}
postgres_settings.SecretsManagerAccessRoleArn = aws.String(d.Get("secrets_manager_access_role_arn").(string))
postgres_settings.SecretsManagerSecretId = aws.String(d.Get("secrets_manager_arn").(string))
postgres_settings.DatabaseName = aws.String(d.Get("database_name").(string))
} else {
input.PostgreSQLSettings = &dms.PostgreSQLSettings{
Username: aws.String(d.Get("username").(string)),
Password: aws.String(d.Get("password").(string)),
ServerName: aws.String(d.Get("server_name").(string)),
Port: aws.Int64(int64(d.Get("port").(int))),
DatabaseName: aws.String(d.Get("database_name").(string)),
}
postgres_settings.Username = aws.String(d.Get("username").(string))
postgres_settings.Password = aws.String(d.Get("password").(string))
postgres_settings.ServerName = aws.String(d.Get("server_name").(string))
postgres_settings.Port = aws.Int64(int64(d.Get("port").(int)))
postgres_settings.DatabaseName = aws.String(d.Get("database_name").(string))

// Set connection info in top-level namespace as well
expandTopLevelConnectionInfo(d, input)
}
input.PostgreSQLSettings = postgres_settings
case engineNameDynamoDB:
input.DynamoDbSettings = &dms.DynamoDbSettings{
ServiceAccessRoleArn: aws.String(d.Get("service_access_role").(string)),
@@ -2140,6 +2138,12 @@ func flattenRedshiftSettings(settings *dms.RedshiftSettings) []map[string]interf
return []map[string]interface{}{m}
}

func expandPostgreSQLSettings() *dms.PostgreSQLSettings {
settings := &dms.PostgreSQLSettings{}

return settings
}

func expandS3Settings(tfMap map[string]interface{}) *dms.S3Settings {
if tfMap == nil {
return nil