From 4f44144a5826005d79443cbe9ba272d035884961 Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 15 Apr 2020 13:30:33 -0400 Subject: [PATCH] resource/aws_dms_endpoint: Minor adjustments to finish kinesis implementation and back out mongodb changes from #8633 Output from acceptance testing: ``` --- PASS: TestAccAwsDmsEndpoint_DocDB (29.10s) --- PASS: TestAccAwsDmsEndpoint_Db2 (29.17s) --- PASS: TestAccAwsDmsEndpoint_Basic (29.30s) --- PASS: TestAccAwsDmsEndpoint_MongoDb (36.13s) --- PASS: TestAccAwsDmsEndpoint_DynamoDb (37.92s) --- PASS: TestAccAwsDmsEndpoint_S3 (39.02s) --- PASS: TestAccAwsDmsEndpoint_Kinesis (79.51s) ``` --- aws/resource_aws_dms_endpoint.go | 22 +++++++++------------- aws/resource_aws_dms_endpoint_test.go | 4 ++-- website/docs/r/dms_endpoint.html.markdown | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/aws/resource_aws_dms_endpoint.go b/aws/resource_aws_dms_endpoint.go index bc8bd9a6211..51f40138568 100644 --- a/aws/resource_aws_dms_endpoint.go +++ b/aws/resource_aws_dms_endpoint.go @@ -234,19 +234,20 @@ func resourceAwsDmsEndpoint() *schema.Resource { Type: schema.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - "JSON", + dms.MessageFormatValueJson, + dms.MessageFormatValueJsonUnformatted, }, false), - Default: "JSON", + Default: dms.MessageFormatValueJson, }, "service_access_role_arn": { - Type: schema.TypeString, - Optional: true, - Default: "", + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateArn, }, "stream_arn": { - Type: schema.TypeString, - Optional: true, - Default: "", + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateArn, }, }, }, @@ -652,11 +653,6 @@ func flattenDmsMongoDbSettings(settings *dms.MongoDbSettings) []map[string]inter "auth_source": aws.StringValue(settings.AuthSource), } - // The DMS API returns "scram-sha-1", cf. https://github.com/aws/aws-sdk-go/issues/2522 - if *settings.AuthMechanism == "scram-sha-1" { - m["auth_mechanism"] = "scram_sha_1" - } - return []map[string]interface{}{m} } diff --git a/aws/resource_aws_dms_endpoint_test.go b/aws/resource_aws_dms_endpoint_test.go index ab3de05698a..f34f58426f1 100644 --- a/aws/resource_aws_dms_endpoint_test.go +++ b/aws/resource_aws_dms_endpoint_test.go @@ -142,7 +142,7 @@ func TestAccAwsDmsEndpoint_Kinesis(t *testing.T) { Check: resource.ComposeTestCheckFunc( checkDmsEndpointExists(resourceName), resource.TestCheckResourceAttr(resourceName, "kinesis_settings.#", "1"), - resource.TestCheckResourceAttr(resourceName, "kinesis_settings.0.message_format", "JSON"), + resource.TestCheckResourceAttr(resourceName, "kinesis_settings.0.message_format", "json"), resource.TestCheckResourceAttrPair(resourceName, "kinesis_settings.0.stream_arn", "aws_kinesis_stream.stream1", "arn"), ), }, @@ -157,7 +157,7 @@ func TestAccAwsDmsEndpoint_Kinesis(t *testing.T) { Check: resource.ComposeTestCheckFunc( checkDmsEndpointExists(resourceName), resource.TestCheckResourceAttr(resourceName, "kinesis_settings.#", "1"), - resource.TestCheckResourceAttr(resourceName, "kinesis_settings.0.message_format", "JSON"), + resource.TestCheckResourceAttr(resourceName, "kinesis_settings.0.message_format", "json"), resource.TestCheckResourceAttrPair(resourceName, "kinesis_settings.0.stream_arn", "aws_kinesis_stream.stream2", "arn"), ), }, diff --git a/website/docs/r/dms_endpoint.html.markdown b/website/docs/r/dms_endpoint.html.markdown index 747c2faeaa7..9727fb3ce1e 100644 --- a/website/docs/r/dms_endpoint.html.markdown +++ b/website/docs/r/dms_endpoint.html.markdown @@ -65,7 +65,7 @@ The following arguments are supported: * `service_access_role` - (Optional) The Amazon Resource Name (ARN) used by the service access IAM role for dynamodb endpoints. * `mongodb_settings` - (Optional) Settings for the source MongoDB endpoint. Available settings are `auth_type` (default: `password`), `auth_mechanism` (default: `default`), `nesting_level` (default: `none`), `extract_doc_id` (default: `false`), `docs_to_investigate` (default: `1000`) and `auth_source` (default: `admin`). For more details, see [Using MongoDB as a Source for AWS DMS](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Source.MongoDB.html). * `s3_settings` - (Optional) Settings for the target S3 endpoint. Available settings are `service_access_role_arn`, `external_table_definition`, `csv_row_delimiter` (default: `\\n`), `csv_delimiter` (default: `,`), `bucket_folder`, `bucket_name` and `compression_type` (default: `NONE`). For more details, see [Using Amazon S3 as a Target for AWS Database Migration Service](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.S3.html). -* `kinesis_settings` - (Optional) Settings for the target Kinesis endpoint. Available settings are `service_access_role_arn` and `stream_arn`. For more details, see [Using Amazon Kinesis Data Streams as a Target for AWS Database Migration Service](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.Kinesis.html). +* `kinesis_settings` - (Optional) Settings for the target Kinesis endpoint. Available settings are `message_format`, `service_access_role_arn`, and `stream_arn`. For more details, see [Using Amazon Kinesis Data Streams as a Target for AWS Database Migration Service](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Target.Kinesis.html). ## Attributes Reference