forked from kleytonhsantos/terraform-aws-dms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We are adding a module for resource aws_dms_s3_endpoint as a alternative to solve the error related to the issue below hashicorp/terraform-provider-aws#27283 "aws_dms_replication_task failed with error InvalidParameterValueException: TimestampColumnName cannot be an empty string."
- Loading branch information
Showing
4 changed files
with
228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Module DMS for endpoint | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
No requirements. | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| aws | n/a | | ||
|
||
## Modules | ||
|
||
No Modules. | ||
|
||
## Resources | ||
|
||
| Name | | ||
|------| | ||
| [aws_dms_endpoint](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/dms_endpoint) | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| certificate\_arn | (Optional, Default: empty string) The Amazon Resource Name (ARN) for the certificate. | `string` | `""` | no | | ||
| create | (Opcional) Used to create the Data Migration Service | `bool` | `false` | no | | ||
| database\_name | (Optional) The name of the endpoint database. | `string` | `""` | no | | ||
| elasticsearch\_settings | (Optional) Configuration block with Elasticsearch settings. | `any` | `{}` | no | | ||
| endpoint\_id | (Required) The database endpoint identifier. | `string` | `""` | no | | ||
| endpoint\_type | (Required) The type of endpoint. Can be one of source \| target | `string` | `"source"` | no | | ||
| engine\_name | (Required) The type of engine for the endpoint. Can be one of aurora \| aurora-postgresql\| azuredb \| db2 \| docdb \| dynamodb \| elasticsearch \| kafka \| kinesis \| mariadb \| mongodb \| mysql \| oracle \| postgres \| redshift \| s3 \| sqlserver \| sybase. | `string` | `""` | no | | ||
| extra\_connection\_attributes | (Optional) Additional attributes associated with the connection. | `string` | `""` | no | | ||
| kafka\_settings | (Optional) Configuration block with Kafka settings. Detailed below | `any` | `{}` | no | | ||
| kinesis\_settings | (Optional) Configuration block with Kinesis settings. Detailed below. | `any` | `{}` | no | | ||
| kms\_key\_arn | (Required when engine\_name is mongodb, optional otherwise) | `string` | `""` | no | | ||
| mongodb\_settings | (Optional) Configuration block with MongoDB settings. | `any` | `{}` | no | | ||
| password | (Optional) The password to be used to login to the endpoint database. | `string` | `""` | no | | ||
| port | (Required) Port the database runs on for this endpoint | `number` | `null` | no | | ||
| s3\_settings | (Optional) Configuration block with S3 settings. Detailed below. | `any` | `{}` | no | | ||
| server\_name | (Optional) The host name of the server. | `string` | `""` | no | | ||
| service\_access\_role | (Optional) The Amazon Resource Name (ARN) used by the service access IAM role for dynamodb endpoints. | `string` | `""` | no | | ||
| ssl\_mode | Optional, Default: none) The SSL mode to use for the connection. Can be one of none \| require \| verify-ca \| verify-full | `string` | `"none"` | no | | ||
| tags | (Optional) A map of tags to assign to the resource. | `map(string)` | `{}` | no | | ||
| username | (Optional) The user name to be used to login to the endpoint database. | `string` | `""` | no | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| certificate\_arn | Certificate ARN | | ||
| endpoint\_arn | Endipoint ARN | | ||
| extra\_connection\_attributes | Extra connection attributes | | ||
| kms\_key\_arn | KMS key ARN | | ||
| ssl\_mode | SSL mode | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
resource "aws_dms_s3_endpoint" "this" { | ||
count = var.create ? 1 : 0 | ||
|
||
certificate_arn = var.certificate_arn | ||
endpoint_type = var.endpoint_type | ||
endpoint_id = "${var.endpoint_id}-${var.endpoint_type}" | ||
ssl_mode = var.ssl_mode | ||
kms_key_arn = var.kms_key_arn | ||
|
||
|
||
|
||
bucket_name = var.s3_settings[0]["bucket_name"] | ||
|
||
bucket_folder = lookup(var.s3_settings[0], "bucket_folder", null) | ||
external_table_definition = lookup(var.s3_settings[0], "external_table_definition", null) | ||
service_access_role_arn = lookup(var.s3_settings[0], "service_access_role_arn", null) | ||
compression_type = lookup(var.s3_settings[0], "compression_type", "NONE") | ||
csv_delimiter = lookup(var.s3_settings[0], "csv_delimiter", ",") | ||
csv_row_delimiter = lookup(var.s3_settings[0], "csv_row_delimiter", null) | ||
date_partition_enabled = lookup(var.s3_settings[0], "date_partition_enabled", false) | ||
data_format = lookup(var.s3_settings[0], "data_format", "csv") | ||
date_partition_delimiter = lookup(var.s3_settings[0], "date_partition_delimiter", "NONE") | ||
date_partition_sequence = lookup(var.s3_settings[0], "date_partition_sequence", "YYYYMMDD") | ||
include_op_for_full_load = lookup(var.s3_settings[0], "include_op_for_full_load", false) | ||
parquet_timestamp_in_millisecond = lookup(var.s3_settings[0], "parquet_timestamp_in_millisecond", false) | ||
parquet_version = lookup(var.s3_settings[0], "parquet_version", "parquet-1-0") | ||
enable_statistics = lookup(var.s3_settings[0], "enable_statistics", true) | ||
preserve_transactions = lookup(var.s3_settings[0], "preserve_transactions", false) | ||
|
||
tags = var.tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
output "endpoint_arn" { | ||
description = "Endipoint ARN" | ||
value = aws_dms_s3_endpoint.this.*.endpoint_arn | ||
} | ||
|
||
output "certificate_arn" { | ||
description = "Certificate ARN" | ||
value = aws_dms_s3_endpoint.this.*.certificate_arn | ||
} | ||
|
||
output "kms_key_arn" { | ||
description = "KMS key ARN" | ||
value = aws_dms_s3_endpoint.this.*.kms_key_arn | ||
} | ||
|
||
output "ssl_mode" { | ||
description = "SSL mode" | ||
value = aws_dms_s3_endpoint.this.*.ssl_mode | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
variable "create" { | ||
description = "(Opcional) Used to create the Data Migration Service" | ||
type = bool | ||
default = false | ||
} | ||
|
||
variable "certificate_arn" { | ||
description = "(Optional, Default: empty string) The Amazon Resource Name (ARN) for the certificate." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "endpoint_type" { | ||
description = "(Required) The type of endpoint. Can be one of source | target" | ||
type = string | ||
default = "source" | ||
} | ||
|
||
variable "endpoint_id" { | ||
description = "(Required) The database endpoint identifier." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "engine_name" { | ||
description = "(Required) The type of engine for the endpoint. Can be one of aurora | aurora-postgresql| azuredb | db2 | docdb | dynamodb | elasticsearch | kafka | kinesis | mariadb | mongodb | mysql | oracle | postgres | redshift | s3 | sqlserver | sybase." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "server_name" { | ||
description = "(Optional) The host name of the server." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "service_access_role" { | ||
description = "(Optional) The Amazon Resource Name (ARN) used by the service access IAM role for dynamodb endpoints." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "port" { | ||
description = "(Required) Port the database runs on for this endpoint" | ||
type = number | ||
default = null | ||
} | ||
|
||
variable "ssl_mode" { | ||
description = "Optional, Default: none) The SSL mode to use for the connection. Can be one of none | require | verify-ca | verify-full" | ||
type = string | ||
default = "none" | ||
} | ||
|
||
variable "username" { | ||
description = "(Optional) The user name to be used to login to the endpoint database." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "password" { | ||
description = "(Optional) The password to be used to login to the endpoint database." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "database_name" { | ||
description = "(Optional) The name of the endpoint database." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "extra_connection_attributes" { | ||
description = "(Optional) Additional attributes associated with the connection." | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "kms_key_arn" { | ||
description = "(Required when engine_name is mongodb, optional otherwise)" | ||
type = string | ||
default = "" | ||
} | ||
|
||
variable "elasticsearch_settings" { | ||
description = "(Optional) Configuration block with Elasticsearch settings." | ||
type = any | ||
default = {} | ||
} | ||
|
||
variable "kafka_settings" { | ||
description = "(Optional) Configuration block with Kafka settings. Detailed below" | ||
type = any | ||
default = {} | ||
} | ||
|
||
variable "kinesis_settings" { | ||
description = "(Optional) Configuration block with Kinesis settings. Detailed below." | ||
type = any | ||
default = {} | ||
} | ||
|
||
variable "mongodb_settings" { | ||
description = "(Optional) Configuration block with MongoDB settings." | ||
type = any | ||
default = {} | ||
} | ||
|
||
|
||
variable "s3_settings" { | ||
description = "(Optional) Configuration block with S3 settings. Detailed below." | ||
type = any | ||
default = {} | ||
} | ||
|
||
variable "tags" { | ||
description = "(Optional) A map of tags to assign to the resource." | ||
type = map(string) | ||
default = {} | ||
} |