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

dms/endpoint: Fix bug where KMS key ignored #23444

Merged
merged 6 commits into from
Mar 2, 2022
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
3 changes: 3 additions & 0 deletions .changelog/23444.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_dms_endpoint: Fix bug where KMS key was ignored for DynamoDB, OpenSearch, Kafka, Kinesis, Oracle, PostgreSQL, and S3 engines.
```
36 changes: 18 additions & 18 deletions internal/service/dms/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,24 @@ func resourceEndpointCreate(d *schema.ResourceData, meta interface{}) error {
Tags: Tags(tags.IgnoreAWS()),
}

if v, ok := d.GetOk("certificate_arn"); ok {
request.CertificateArn = aws.String(v.(string))
}

// Send ExtraConnectionAttributes in the API request for all resource types
// per https://github.com/hashicorp/terraform-provider-aws/issues/8009
if v, ok := d.GetOk("extra_connection_attributes"); ok {
request.ExtraConnectionAttributes = aws.String(v.(string))
}

if v, ok := d.GetOk("kms_key_arn"); ok {
request.KmsKeyId = aws.String(v.(string))
}

if v, ok := d.GetOk("ssl_mode"); ok {
request.SslMode = aws.String(v.(string))
}

switch d.Get("engine_name").(string) {
case engineNameDynamoDB:
request.DynamoDbSettings = &dms.DynamoDbSettings{
Expand Down Expand Up @@ -697,24 +715,6 @@ func resourceEndpointCreate(d *schema.ResourceData, meta interface{}) error {
if v, ok := d.GetOk("database_name"); ok {
request.DatabaseName = aws.String(v.(string))
}

if v, ok := d.GetOk("kms_key_arn"); ok {
request.KmsKeyId = aws.String(v.(string))
}
}

if v, ok := d.GetOk("certificate_arn"); ok {
request.CertificateArn = aws.String(v.(string))
}

// Send ExtraConnectionAttributes in the API request for all resource types
// per https://github.com/hashicorp/terraform-provider-aws/issues/8009
if v, ok := d.GetOk("extra_connection_attributes"); ok {
request.ExtraConnectionAttributes = aws.String(v.(string))
}

if v, ok := d.GetOk("ssl_mode"); ok {
request.SslMode = aws.String(v.(string))
}

log.Println("[DEBUG] DMS create endpoint:", request)
Expand Down
Loading