Skip to content

Commit 591b869

Browse files
committed
r/aws_dms_endpoint: Additional plan-time validations.
1 parent 5846887 commit 591b869

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

.changelog/43440.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
```release-note:enhancement
22
resource/aws_dms_endpoint: Add `postgres_settings.authentication_method` and `postgres_settings.service_access_role_arn` arguments
3+
```
4+
5+
```release-note:enhancement
6+
data-source/aws_dms_endpoint: Add `postgres_settings.authentication_method` and `postgres_settings.service_access_role_arn` attributes
7+
```
8+
9+
```release-note:enhancement
10+
resource/aws_dms_endpoint: Add plan-time validation of `postgres_settings.database_mode`, `postgres_settings.map_long_varchar_as`, and `postgres_settings.plugin_name` arguments
311
```

internal/service/dms/endpoint.go

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,9 @@ func resourceEndpoint() *schema.Resource {
371371
Optional: true,
372372
},
373373
"authentication_method": {
374-
Type: schema.TypeString,
375-
Optional: true,
374+
Type: schema.TypeString,
375+
Optional: true,
376+
ValidateDiagFunc: enum.Validate[awstypes.PostgreSQLAuthenticationMethod](),
376377
},
377378
"babelfish_database_name": {
378379
Type: schema.TypeString,
@@ -383,8 +384,9 @@ func resourceEndpoint() *schema.Resource {
383384
Optional: true,
384385
},
385386
"database_mode": {
386-
Type: schema.TypeString,
387-
Optional: true,
387+
Type: schema.TypeString,
388+
Optional: true,
389+
ValidateDiagFunc: enum.Validate[awstypes.DatabaseMode](),
388390
},
389391
"ddl_artifacts_schema": {
390392
Type: schema.TypeString,
@@ -419,20 +421,23 @@ func resourceEndpoint() *schema.Resource {
419421
Optional: true,
420422
},
421423
"map_long_varchar_as": {
422-
Type: schema.TypeString,
423-
Optional: true,
424+
Type: schema.TypeString,
425+
Optional: true,
426+
ValidateDiagFunc: enum.Validate[awstypes.LongVarcharMappingType](),
424427
},
425428
"max_file_size": {
426429
Type: schema.TypeInt,
427430
Optional: true,
428431
},
429432
"plugin_name": {
430-
Type: schema.TypeString,
431-
Optional: true,
433+
Type: schema.TypeString,
434+
Optional: true,
435+
ValidateDiagFunc: enum.Validate[awstypes.PluginNameValue](),
432436
},
433437
"service_access_role_arn": {
434-
Type: schema.TypeString,
435-
Optional: true,
438+
Type: schema.TypeString,
439+
Optional: true,
440+
ValidateFunc: verify.ValidARN,
436441
},
437442
"slot_name": {
438443
Type: schema.TypeString,
@@ -1995,14 +2000,14 @@ func flattenPostgreSQLSettings(apiObject *awstypes.PostgreSQLSettings) []map[str
19952000
if v := apiObject.AfterConnectScript; v != nil {
19962001
tfMap["after_connect_script"] = aws.ToString(v)
19972002
}
1998-
tfMap["authentication_method"] = string(apiObject.AuthenticationMethod)
2003+
tfMap["authentication_method"] = apiObject.AuthenticationMethod
19992004
if v := apiObject.BabelfishDatabaseName; v != nil {
20002005
tfMap["babelfish_database_name"] = aws.ToString(v)
20012006
}
20022007
if v := apiObject.CaptureDdls; v != nil {
20032008
tfMap["capture_ddls"] = aws.ToBool(v)
20042009
}
2005-
tfMap["database_mode"] = string(apiObject.DatabaseMode)
2010+
tfMap["database_mode"] = apiObject.DatabaseMode
20062011
if v := apiObject.DdlArtifactsSchema; v != nil {
20072012
tfMap["ddl_artifacts_schema"] = aws.ToString(v)
20082013
}
@@ -2027,11 +2032,11 @@ func flattenPostgreSQLSettings(apiObject *awstypes.PostgreSQLSettings) []map[str
20272032
if v := apiObject.MapJsonbAsClob; v != nil {
20282033
tfMap["map_jsonb_as_clob"] = aws.ToBool(v)
20292034
}
2030-
tfMap["map_long_varchar_as"] = string(apiObject.MapLongVarcharAs)
2035+
tfMap["map_long_varchar_as"] = apiObject.MapLongVarcharAs
20312036
if v := apiObject.MaxFileSize; v != nil {
20322037
tfMap["max_file_size"] = aws.ToInt32(v)
20332038
}
2034-
tfMap["plugin_name"] = string(apiObject.PluginName)
2039+
tfMap["plugin_name"] = apiObject.PluginName
20352040
if v := apiObject.ServiceAccessRoleArn; v != nil {
20362041
tfMap["service_access_role_arn"] = aws.ToString(v)
20372042
}

0 commit comments

Comments
 (0)