From 0588e1ba73215e547a48ccf97e2f315098d0e3f8 Mon Sep 17 00:00:00 2001 From: Taylor Price Date: Wed, 2 Dec 2020 12:18:16 -0700 Subject: [PATCH] update to allow for engine version 4.0.0 --- main.tf | 12 ++++++------ output.tf | 14 +++++++------- variables.tf | 18 ++++++++++++++++++ 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/main.tf b/main.tf index dc30152..5282d42 100644 --- a/main.tf +++ b/main.tf @@ -3,12 +3,12 @@ resource "aws_docdb_subnet_group" "docdb" { subnet_ids = var.group_subnets } -resource "aws_docdb_cluster" "api_docdb" { +resource "aws_docdb_cluster" "docdb" { cluster_identifier_prefix = var.name db_subnet_group_name = aws_docdb_subnet_group.docdb.name - db_cluster_parameter_group_name = aws_docdb_cluster_parameter_group.api_docdb.name + db_cluster_parameter_group_name = aws_docdb_cluster_parameter_group.docdb.name vpc_security_group_ids = var.cluster_security_group - engine = "docdb" + engine = var.engine master_username = var.master_username master_password = var.master_password storage_encrypted = var.storage_encrypted @@ -22,13 +22,13 @@ resource "aws_docdb_cluster" "api_docdb" { resource "aws_docdb_cluster_instance" "cluster_instances" { count = var.cluster_instance_count identifier = "${var.name}-${count.index}" - cluster_identifier = aws_docdb_cluster.api_docdb.id + cluster_identifier = aws_docdb_cluster.docdb.id instance_class = var.cluster_instance_class ca_cert_identifier = var.ca_cert_identifier } -resource "aws_docdb_cluster_parameter_group" "api_docdb" { - family = "docdb3.6" +resource "aws_docdb_cluster_parameter_group" "docdb" { + family = var.family name_prefix = var.name description = "${var.name} docdb cluster parameter group" dynamic "parameter" { diff --git a/output.tf b/output.tf index 17147ab..850e9c7 100644 --- a/output.tf +++ b/output.tf @@ -1,27 +1,27 @@ output "arn" { - value = aws_docdb_cluster.api_docdb.arn + value = aws_docdb_cluster.docdb.arn } output "cluster_members" { - value = aws_docdb_cluster.api_docdb.cluster_members + value = aws_docdb_cluster.docdb.cluster_members } output "cluster_resource_id" { - value = aws_docdb_cluster.api_docdb.cluster_resource_id + value = aws_docdb_cluster.docdb.cluster_resource_id } output "endpoint" { - value = aws_docdb_cluster.api_docdb.endpoint + value = aws_docdb_cluster.docdb.endpoint } output "hosted_zone_id" { - value = aws_docdb_cluster.api_docdb.hosted_zone_id + value = aws_docdb_cluster.docdb.hosted_zone_id } output "id" { - value = aws_docdb_cluster.api_docdb.id + value = aws_docdb_cluster.docdb.id } output "reader_endpoint" { - value = aws_docdb_cluster.api_docdb.reader_endpoint + value = aws_docdb_cluster.docdb.reader_endpoint } diff --git a/variables.tf b/variables.tf index 4ec804e..8c4f63c 100644 --- a/variables.tf +++ b/variables.tf @@ -66,3 +66,21 @@ variable "ca_cert_identifier" { description = "Optional, identifier of the CA certificate to use for DB instance" type = string } + +variable "family" { + default = "docdb3.6" + description = "Version of docdb family being created" + type = string +} + +variable "engine" { + default = "docdb" + description = "The name of the database engine to be used for this DB cluster. Only `docdb` is supported." + type = string +} + +variable "engine_version" { + default = "3.6.0" + description = "The database engine version. Updating this argument results in an outage." + type = string +}