Skip to content

Commit

Permalink
resource/aws_dms_endpoint: Minor adjustments to finish kinesis implem…
Browse files Browse the repository at this point in the history
…entation 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)
```
  • Loading branch information
bflad committed Apr 15, 2020
1 parent 915618a commit 4f44144
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
22 changes: 9 additions & 13 deletions aws/resource_aws_dms_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
Expand Down Expand Up @@ -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}
}

Expand Down
4 changes: 2 additions & 2 deletions aws/resource_aws_dms_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
Expand All @@ -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"),
),
},
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/dms_endpoint.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 4f44144

Please sign in to comment.