Skip to content

dare-global/terraform-aws-documentdb

Repository files navigation

terraform-aws-documentdb

Terraform module for provisioning DocumentDB clusters on AWS

Usage

module "docdb" {
  source  = "dare-global/documentdb/aws"
  version = "1.X.X"

  name_prefix = "docdbdb-cluster-example"

  instance_class = "db.t3.medium"
  instance_count  = "1"

  engine                  = "docdb"
  engine_version          = "5.0.0"

  master_username = "master"
  master_password = "password"

  vpc_id     = data.aws_vpc.default.id
  subnet_ids = data.aws_subnets.all.ids
}

Examples

Requirements

Name Version
terraform >= 1.5
aws >= 5.0.0

Providers

Name Version
aws >= 5.0.0

Modules

No modules.

Resources

Name Type
aws_docdb_cluster.docdb resource
aws_docdb_cluster_instance.docdb resource
aws_docdb_cluster_parameter_group.docdb_parameter_group resource
aws_docdb_subnet_group.docdb resource
aws_security_group.main resource
aws_vpc_security_group_egress_rule.default_egress resource
aws_vpc_security_group_ingress_rule.cidr_blocks resource
aws_vpc_security_group_ingress_rule.prefix_lists resource

Inputs

Name Description Type Default Required
apply_immediately Specifies whether any cluster modifications are applied immediately, or during the next maintenance window. bool false no
backup_retention_period Common name prefix used to name resources number 1 no
ca_cert_identifier Identifier of the certificate authority (CA) certificate for the DB instance. string "rds-ca-rsa2048-g1" no
cidr_blocks ipv4 cidr ranges to associate with the security group list(string) [] no
cluster_instance_name_prefix Common name prefix used to name resources string null no
create_security_group Whether to create a security group for the cluster bool true no
deletion_protection Enable deletion protection for the cluster bool null no
enable_performance_insights Enable performance insights for the cluster instances bool true no
enabled_cloudwatch_logs_exports Enable log exports for audit or profiler logs list(string) [] no
engine Common name prefix used to name resources string n/a yes
engine_version The database engine version. Updating this argument results in an outage. string n/a yes
instance_class The instance class to use string "db.t4g.medium" no
instance_count The number of instances to be created and joined to the cluster number 1 no
kms_key_id The ARN for the KMS encryption key. When specifying kms_key_id, storage_encrypted needs to be set to true. string null no
master_password The password for the master db password. This should be created using a random string string n/a yes
master_username The password for the master db user. This should be created using a random string string n/a yes
name_prefix Common name prefix used to name resources string n/a yes
parameters A list of DB cluster parameters to apply. Note that parameters may differ from one family to an other list(object({ apply_method = optional(string), value = string, name = string })) [] no
performance_insights_kms_key KMS key ID to use for performance insights string null no
port The port on which the DB accepts connections string "27017" no
preferred_backup_window Common name prefix used to name resources string null no
prefix_list_ids list of prefix lists to associate with the security group list(string) [] no
promotion_tier Failover Priority setting on instance level. The reader who has lower tier has higher priority to get promoter to writer string null no
revoke_rules_on_delete Instruct Terraform to revoke all of the Security Groups attached
ingress and egress rules before deleting the rule itself.
Defaults to true
bool true no
security_group_tags Additional tags for the security group map(string) {} no
skip_final_snapshot Common name prefix used to name resources string null no
storage_encrypted Specifies whether the DB cluster is encrypted. The default is false bool null no
subnet_ids A list of VPC subnet IDs. list(string) n/a yes
tags A mapping of tags to assign to all resources map(string) {} no
vpc_id The VPC ID where the cluster will be deployed string n/a yes
vpc_security_group_ids List of VPC security groups to associate with the Cluster list(string) [] no

Outputs

Name Description
cluster_arn n/a
cluster_endpoint n/a
cluster_hosted_zone n/a
cluster_id n/a
cluster_members n/a
reader_endpoint n/a
security_group_arn ARN of the DocumentDB cluster Security Group
security_group_id ID of the DocumentDB cluster Security Group
security_group_name Name of the DocumentDB cluster Security Group

License

See LICENSE file for full details.

Maintainers

Pre-commit hooks

Install dependencies

MacOS

brew install pre-commit terraform-docs tflint