Skip to content

jbuettnerbild/dms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dms

Terraform module for AWS DMS

overview

the module create a target RDS Instance and if set also the replicas for the master instance.
Its also create a dms instance and endpoints for source and target RDS Instance. And a migration 
task that not startet automaticly. 

example

module "dms" {
  count  = var.enable_dms_replica ? 1 : 0
  source = "../../modules/dms"

  depends_on = [aws_db_instance.master, random_string.database_pass]

  dms_instance_name = var.override_db_master_name != "" ? var.override_db_master_name : "${local.basename}"

  source_address                       = aws_db_instance.master.address
  source_subnet_ids                    = data.terraform_remote_state.db-vpc.outputs.private_subnets
  source_vpc_security_group_ids        = [aws_security_group.sg-db.id]
  source_database_name                 = aws_db_instance.master.db_name
  source_engine                        = var.engine
  source_password                      = random_string.database_pass.result
  source_username                      = var.username
  source_port                          = var.port
  source_instance_subnet_group_name    = aws_db_subnet_group.default.name
  dms_replication_instance_kms_key_arn = data.aws_kms_key.dms.arn

  target_engine                        = var.engine
  target_db_multi_az                   = var.db_multi_az
  target_allocated_storage             = var.target_allocated_storage != "" ? var.target_allocated_storage : var.allocated_storage
  target_instance_name                 = var.target_instance_name
  target_instance_type                 = var.target_instance_type
  target_instance_engine_version       = var.target_instance_engine_version
  target_instance_parameter_group_name = var.target_instance_parameter_group_name
  target_replica_count                 = var.replica_count
  target_storage_encrypted             = var.target_storage_encrypted
  target_instance_kms_key_id           = var.target_storage_encrypted ? data.aws_kms_key.rds.arn : null
}

ToDos

Requirements

No requirements.

Providers

Name Version
aws n/a

Modules

No modules.

Resources

Name Type
aws_db_instance.target_master_instance resource
aws_db_instance.target_read_replica resource
aws_dms_endpoint.source resource
aws_dms_endpoint.target resource
aws_dms_replication_instance.dms_instance resource
aws_dms_replication_subnet_group.dms-replication-subnet-group resource
aws_dms_replication_task.initial resource
aws_iam_role.dms-access-for-endpoint resource
aws_iam_role.dms-cloudwatch-logs-role resource
aws_iam_role.dms-vpc-role resource
aws_iam_role_policy_attachment.dms-access-for-endpoint-AmazonDMSRedshiftS3Role resource
aws_iam_role_policy_attachment.dms-cloudwatch-logs-role-AmazonDMSCloudWatchLogsRole resource
aws_iam_role_policy_attachment.dms-vpc-role-AmazonDMSVPCManagementRole resource
aws_iam_policy_document.dms_assume_role data source

Inputs

Name Description Type Default Required
certificate_arn (Optional, Default: empty string) ARN for the certificate. string "" no
dms_availability_zone n/a string "eu-central-1a" no
dms_instance_class n/a string "dms.t3.micro" no
dms_instance_name n/a string n/a yes
dms_replication_instance_kms_key_arn n/a string null no
dms_replication_instance_multi_az n/a bool false no
engine_version n/a string "3.4.7" no
extra_connection_attributes (Optional) Additional attributes associated with the connection. For available attributes see Using Extra Connection Attributes with AWS Database Migration Service. string "" no
kms_key_arn n/a string null no
source_address endpoint address of source string n/a yes
source_database_name Required) Database endpoint identifier. Identifiers must contain from 1 to 255 alphanumeric characters or hyphens, begin with a letter, contain only ASCII letters, digits, and hyphens, not end with a hyphen, and not contain two consecutive hyphens. string "source" no
source_engine (Required) Type of engine for the source endpoint. Valid values are aurora, aurora-postgresql, azuredb, db2, docdb, dynamodb, elasticsearch, kafka, kinesis, mariadb, mongodb, mysql, opensearch, oracle, postgres, redshift, s3, sqlserver, sybase. Please note that some of engine names are available only for target endpoint type (e.g. redshift). string n/a yes
source_instance_subnet_group_name n/a string n/a yes
source_password (Optional) Password to be used to login to the endpoint database. string "test" no
source_port n/a number 5432 no
source_subnet_ids n/a list(string) [] no
source_username (Optional) User name to be used to login to the endpoint database. string "test" no
source_vpc_security_group_ids n/a list(string) [] no
target_allocated_storage The acclocated storage of the target database number 20 no
target_availability_zones AZ for the replicas list(string)
[
"eu-central-1a",
"eu-central-1b",
"eu-central-1c"
]
no
target_db_multi_az (Optional) Specifies if the target RDS instance is multi-AZ bool false no
target_engine (Required) Type of engine for the target endpoint. Valid values are aurora, aurora-postgresql, azuredb, db2, docdb, dynamodb, elasticsearch, kafka, kinesis, mariadb, mongodb, mysql, opensearch, oracle, postgres, redshift, s3, sqlserver, sybase. Please note that some of engine names are available only for target endpoint type (e.g. redshift). string n/a yes
target_instance_engine_version the engine version of the target db string "13.4" no
target_instance_kms_key_id n/a string null no
target_instance_name Name of the target replica string "test" no
target_instance_parameter_group_name n/a string n/a yes
target_instance_type instance type of the target instance string "db.t3.micro" no
target_replica_count Amount of the target read replicas number 0 no
target_storage_encrypted (Optional) Specifies whether the DB instance is encrypted. The default is true if not specified. bool true no
target_storage_type n/a string "gp2" no
upgrade_apply_immediately (Optional) Specifies whether any database modifications are applied immediately, or during the next maintenance window. Default is false. See Amazon RDS Documentation for more information. bool false no

Outputs

No outputs.

About

Terraform module for AWS DMS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages