From 740938149af830321bf104319f0b109346e0f5db Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 14:37:56 +0600 Subject: [PATCH 01/17] Added rds as backing service --- aws/backing-services/rds.tf | 79 +++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 aws/backing-services/rds.tf diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf new file mode 100644 index 000000000..044b7613e --- /dev/null +++ b/aws/backing-services/rds.tf @@ -0,0 +1,79 @@ +# Don't use `admin` +# ("MasterUsername admin cannot be used as it is a reserved word used by the engine") +variable "RDS_ADMIN_NAME" { + type = "string" + description = "RDS DB admin user name" +} + +# Must be longer than 8 chars +# ("The parameter MasterUserPassword is not a valid password because it is shorter than 8 characters") +variable "RDS_ADMIN_PASSWORD" { + type = "string" + description = "RDS DB password for the admin user" +} + +variable "RDS_DB_NAME" { + type = "string" + description = "RDS DB database name" +} + +# db.r4.large is the smallest instance type supported by Aurora Postgres +# https://aws.amazon.com/rds/aurora/pricing +variable "RDS_INSTANCE_TYPE" { + type = "string" + default = "db.r4.large" + description = "EC2 instance type for RDS DB" +} + +variable "RDS_CLUSTER_SIZE" { + type = "string" + default = "2" + description = "RDS DB cluster size" +} + +variable "RDS_CLUSTER_ENABLED" { + type = "string" + default = "true" + description = "Set to false to prevent the module from creating any resources" +} + +variable "RDS_SNAPSHOT" { + type = "string" + default = "" + description = "Restore snapshots" +} + +module "rds" { + source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.0" + namespace = "${var.namespace}" + stage = "${var.stage}" + name = "rds" + dns_zone_id = "${var.zone_id}" + host_name = "rds" + security_group_ids = ["${module.kops_metadata.nodes_security_group_id}"] + database_name = "${var.RDS_DB_NAME}" + database_user = "${var.RDS_ADMIN_NAME}" + database_password = "${var.RDS_ADMIN_PASSWORD}" + database_port = 3306 + multi_az = "false" + storage_type = "gp2" + allocated_storage = "20" + storage_encrypted = "true" + engine = "mariadb" + engine_version = "10.1.19" + instance_class = "${var.RDS_CLUSTER_SIZE}" + db_parameter_group = "mariadb10.1" + parameter_group_name = "mariadb-10-1" + publicly_accessible = "false" + subnet_ids = ["${module.subnets.private_subnet_ids}"] + vpc_id = "${module.vpc.vpc_id}" + snapshot_identifier = "${var.RDS_SNAPSHOT}}" + auto_minor_version_upgrade = "false" + allow_major_version_upgrade = "false" + apply_immediately = "true" + skip_final_snapshot = "false" + copy_tags_to_snapshot = "true" + backup_retention_period = 7 + backup_window = "22:00-03:00" +} + From 81ecd1a298538a28dfbedc5411c371d98904b51d Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 14:44:40 +0600 Subject: [PATCH 02/17] Added rds as backing service --- aws/backing-services/rds.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index 044b7613e..0dd9d1b83 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -44,7 +44,7 @@ variable "RDS_SNAPSHOT" { } module "rds" { - source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.0" + source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.0" namespace = "${var.namespace}" stage = "${var.stage}" name = "rds" @@ -76,4 +76,3 @@ module "rds" { backup_retention_period = 7 backup_window = "22:00-03:00" } - From 7db74e46ab8fa0c342b7801f67b1343656823e23 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 15:50:53 +0600 Subject: [PATCH 03/17] Added rds as backing service --- aws/backing-services/rds.tf | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index 0dd9d1b83..a63b4a466 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -17,20 +17,14 @@ variable "RDS_DB_NAME" { description = "RDS DB database name" } -# db.r4.large is the smallest instance type supported by Aurora Postgres -# https://aws.amazon.com/rds/aurora/pricing +# db.t2.micro is free tier +# https://aws.amazon.com/rds/free variable "RDS_INSTANCE_TYPE" { type = "string" - default = "db.r4.large" + default = "db.t2.micro" description = "EC2 instance type for RDS DB" } -variable "RDS_CLUSTER_SIZE" { - type = "string" - default = "2" - description = "RDS DB cluster size" -} - variable "RDS_CLUSTER_ENABLED" { type = "string" default = "true" @@ -61,7 +55,7 @@ module "rds" { storage_encrypted = "true" engine = "mariadb" engine_version = "10.1.19" - instance_class = "${var.RDS_CLUSTER_SIZE}" + instance_class = "${var.RDS_INSTANCE_TYPE}" db_parameter_group = "mariadb10.1" parameter_group_name = "mariadb-10-1" publicly_accessible = "false" From 0a04fcdf5d2d3f5402b89f15814e5a9d15d30558 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 16:23:09 +0600 Subject: [PATCH 04/17] Added rds as backing service --- aws/backing-services/rds.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index a63b4a466..a2c291c5d 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -61,7 +61,7 @@ module "rds" { publicly_accessible = "false" subnet_ids = ["${module.subnets.private_subnet_ids}"] vpc_id = "${module.vpc.vpc_id}" - snapshot_identifier = "${var.RDS_SNAPSHOT}}" + snapshot_identifier = "${var.RDS_SNAPSHOT}" auto_minor_version_upgrade = "false" allow_major_version_upgrade = "false" apply_immediately = "true" From aad6f94ce3c85ddc095d8b4817f9aa7f646b82e4 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 16:54:58 +0600 Subject: [PATCH 05/17] Added rds as backing service --- aws/backing-services/elasticsearch.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aws/backing-services/elasticsearch.tf b/aws/backing-services/elasticsearch.tf index f23453228..c094eacd3 100644 --- a/aws/backing-services/elasticsearch.tf +++ b/aws/backing-services/elasticsearch.tf @@ -63,7 +63,8 @@ locals { } module "elasticsearch" { - source = "git::https://github.com/cloudposse/terraform-aws-elasticsearch.git?ref=tags/0.1.2" + #source = "git::https://github.com/cloudposse/terraform-aws-elasticsearch.git?ref=tags/0.1.2" + source = "git::https://github.com/cloudposse/terraform-aws-elasticsearch.git?ref=feature/cp-11/fix-ingress" namespace = "${var.namespace}" stage = "${var.stage}" name = "${var.ELASTICSEARCH_NAME}" From 7b8b40a51b6c1dfa2d68363ca6a8b11e4d7154d8 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 17:42:01 +0600 Subject: [PATCH 06/17] Fix ingress --- aws/backing-services/rds.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index a2c291c5d..2d144a3d9 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -52,7 +52,7 @@ module "rds" { multi_az = "false" storage_type = "gp2" allocated_storage = "20" - storage_encrypted = "true" + storage_encrypted = "false" engine = "mariadb" engine_version = "10.1.19" instance_class = "${var.RDS_INSTANCE_TYPE}" From 3eae9890e0045aa3ab913383e410a4655db4c54b Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 18:19:07 +0600 Subject: [PATCH 07/17] Fix ingress --- aws/backing-services/rds.tf | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index 2d144a3d9..763e2e836 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -37,6 +37,12 @@ variable "RDS_SNAPSHOT" { description = "Restore snapshots" } +variable "RDS_PARAMETER_GROUP_NAME" { + type = "string" + default = "" + description = "Existed paramater group name to use" +} + module "rds" { source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.0" namespace = "${var.namespace}" @@ -57,7 +63,7 @@ module "rds" { engine_version = "10.1.19" instance_class = "${var.RDS_INSTANCE_TYPE}" db_parameter_group = "mariadb10.1" - parameter_group_name = "mariadb-10-1" + parameter_group_name = "${var.RDS_PARAMETER_GROUP_NAME}" publicly_accessible = "false" subnet_ids = ["${module.subnets.private_subnet_ids}"] vpc_id = "${module.vpc.vpc_id}" From c4809e065cc4595c52b63b9fbc7c1d67bc345d7a Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 19:40:40 +0600 Subject: [PATCH 08/17] Added rds outputs --- aws/backing-services/rds.tf | 91 ++++++++++++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 7 deletions(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index 763e2e836..ca6032fbb 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -25,6 +25,24 @@ variable "RDS_INSTANCE_TYPE" { description = "EC2 instance type for RDS DB" } +variable "RDS_ENGINE" { + type = "string" + default = "mysql" + description = "RDS DB engine" +} + +variable "RDS_ENGINE_VERSION" { + type = "string" + default = "5.6" + description = "RDS DB engine version" +} + +variable "RDS_DB_PARAMETER_GROUP" { + type = "string" + default = "mysql5.6" + description = "RDS DB engine version" +} + variable "RDS_CLUSTER_ENABLED" { type = "string" default = "true" @@ -43,6 +61,30 @@ variable "RDS_PARAMETER_GROUP_NAME" { description = "Existed paramater group name to use" } +variable "RDS_MULTI_AZ" { + type = "string" + default = "false" + description = "Run instaces in multiple az" +} + +variable "RDS_STORAGE_TYPE" { + type = "string" + default = "gp2" + description = "Storage type" +} + +variable "RDS_STORAGE_SIZE" { + type = "string" + default = "20" + description = "Storage size" +} + +variable "RDS_STORAGE_ENCRYPTED" { + type = "string" + default = "false" + description = "Set true to encrypt storage" +} + module "rds" { source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.0" namespace = "${var.namespace}" @@ -55,14 +97,14 @@ module "rds" { database_user = "${var.RDS_ADMIN_NAME}" database_password = "${var.RDS_ADMIN_PASSWORD}" database_port = 3306 - multi_az = "false" - storage_type = "gp2" - allocated_storage = "20" - storage_encrypted = "false" - engine = "mariadb" - engine_version = "10.1.19" + multi_az = "${var.RDS_MULTI_AZ}" + storage_type = "${var.RDS_STORAGE_TYPE}" + allocated_storage = "${var.RDS_STORAGE_SIZE}}" + storage_encrypted = "${var.RDS_STORAGE_ENCRYPTED}" + engine = "${var.RDS_ENGINE}" + engine_version = "${var.RDS_ENGINE_VERSION}" instance_class = "${var.RDS_INSTANCE_TYPE}" - db_parameter_group = "mariadb10.1" + db_parameter_group = "${var.RDS_DB_PARAMETER_GROUP}" parameter_group_name = "${var.RDS_PARAMETER_GROUP_NAME}" publicly_accessible = "false" subnet_ids = ["${module.subnets.private_subnet_ids}"] @@ -76,3 +118,38 @@ module "rds" { backup_retention_period = 7 backup_window = "22:00-03:00" } + +output "rds_instance_id" { + value = "${module.rds.instance_id}" + description = "RDS ID of the instance" +} + +output "rds_instance_address" { + value = "${module.rds.instance_address}" + description = "RDS address of the instance" +} + +output "rds_instance_endpoint" { + value = "${module.rds.instance_endpoint}" + description = "RDS DNS Endpoint of the instance" +} + +output "rds_db_name" { + value = "${var.RDS_DB_NAME}" + description = "RDS db name" +} + +output "rds_root_user" { + value = "${var.RDS_ADMIN_NAME}" + description = "RDS root name" +} + +output "rds_root_password" { + value = "${var.RDS_ADMIN_PASSWORD}" + description = "RDS root password" +} + +output "rds_hostname" { + value = "${module.rds.hostname}" + description = "RDS host name of the instance" +} From dc573eabb8b5539d6049cb28a80ac25ff02e78e9 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 19:49:27 +0600 Subject: [PATCH 09/17] Added rds outputs --- aws/backing-services/rds.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index ca6032fbb..64c09c748 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -99,7 +99,7 @@ module "rds" { database_port = 3306 multi_az = "${var.RDS_MULTI_AZ}" storage_type = "${var.RDS_STORAGE_TYPE}" - allocated_storage = "${var.RDS_STORAGE_SIZE}}" + allocated_storage = "${var.RDS_STORAGE_SIZE}" storage_encrypted = "${var.RDS_STORAGE_ENCRYPTED}" engine = "${var.RDS_ENGINE}" engine_version = "${var.RDS_ENGINE_VERSION}" From 48ff4a92d06ef29fec4541ff7441f6e35ff3831c Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 21:18:18 +0600 Subject: [PATCH 10/17] Added enabled option --- aws/backing-services/rds.tf | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index 64c09c748..756fb91f8 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -1,5 +1,11 @@ -# Don't use `admin` -# ("MasterUsername admin cannot be used as it is a reserved word used by the engine") +variable "RDS_ENABLED" { + type = "string" + default = "false" + description = "Set to true to create rds instance" +} + +# Don't use `root` +# ("MasterUsername root cannot be used as it is a reserved word used by the engine") variable "RDS_ADMIN_NAME" { type = "string" description = "RDS DB admin user name" @@ -12,6 +18,8 @@ variable "RDS_ADMIN_PASSWORD" { description = "RDS DB password for the admin user" } +# Don't use `default` +# ("DatabaseName default cannot be used as it is a reserved word used by the engine") variable "RDS_DB_NAME" { type = "string" description = "RDS DB database name" @@ -86,7 +94,8 @@ variable "RDS_STORAGE_ENCRYPTED" { } module "rds" { - source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.0" + source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.1" + enabled = "${var.RDS_ENABLED}" namespace = "${var.namespace}" stage = "${var.stage}" name = "rds" From a0ae728f870579eee1af89401ae5e06492476286 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 21:35:21 +0600 Subject: [PATCH 11/17] Update versions of rds and elastic search --- aws/backing-services/elasticsearch.tf | 3 +-- aws/backing-services/rds.tf | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aws/backing-services/elasticsearch.tf b/aws/backing-services/elasticsearch.tf index c094eacd3..7350c1cdc 100644 --- a/aws/backing-services/elasticsearch.tf +++ b/aws/backing-services/elasticsearch.tf @@ -63,8 +63,7 @@ locals { } module "elasticsearch" { - #source = "git::https://github.com/cloudposse/terraform-aws-elasticsearch.git?ref=tags/0.1.2" - source = "git::https://github.com/cloudposse/terraform-aws-elasticsearch.git?ref=feature/cp-11/fix-ingress" + source = "git::https://github.com/cloudposse/terraform-aws-elasticsearch.git?ref=tags/0.1.3" namespace = "${var.namespace}" stage = "${var.stage}" name = "${var.ELASTICSEARCH_NAME}" diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index 756fb91f8..f24ebc412 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -94,7 +94,8 @@ variable "RDS_STORAGE_ENCRYPTED" { } module "rds" { - source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.1" + #source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.1" + source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=feature/cp-11/disable-rds" enabled = "${var.RDS_ENABLED}" namespace = "${var.namespace}" stage = "${var.stage}" From e8ab02c26f3621fea5d74c2e68a3baf13db6bf01 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 22:01:05 +0600 Subject: [PATCH 12/17] Pin propriate version --- aws/backing-services/rds.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index f24ebc412..756fb91f8 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -94,8 +94,7 @@ variable "RDS_STORAGE_ENCRYPTED" { } module "rds" { - #source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.1" - source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=feature/cp-11/disable-rds" + source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.1" enabled = "${var.RDS_ENABLED}" namespace = "${var.namespace}" stage = "${var.stage}" From ae5f7da5f2e1718c4096b2e5809dc12819a91eae Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 22:20:52 +0600 Subject: [PATCH 13/17] Address PR comments --- aws/backing-services/rds.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index 756fb91f8..a864045ef 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -60,13 +60,13 @@ variable "RDS_CLUSTER_ENABLED" { variable "RDS_SNAPSHOT" { type = "string" default = "" - description = "Restore snapshots" + description = "Set to a snapshot ID to restore from snapshot" } variable "RDS_PARAMETER_GROUP_NAME" { type = "string" default = "" - description = "Existed paramater group name to use" + description = "Existing parameter group name to use" } variable "RDS_MULTI_AZ" { From b3ae234bcacebf70d7de28500f925de945580c47 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 22:29:33 +0600 Subject: [PATCH 14/17] Address Comments --- aws/backing-services/rds.tf | 50 +++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index a864045ef..41c8706d0 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -93,6 +93,42 @@ variable "RDS_STORAGE_ENCRYPTED" { description = "Set true to encrypt storage" } +variable "RDS_AUTO_MINOR_VERSION_UPGRADE" { + type = "string" + default = "false" + description = "Allow automated minor version upgrade (e.g. from Postgres 9.5.3 to Postgres 9.5.4)" +} + +variable "RDS_ALLOW_MAJOR_VERSION_UPGRADE" { + type = "string" + default = "false" + description = "Allow major version upgrade" +} + +variable "RDS_APPLY_IMMEDIATELY" { + type = "string" + default = "true" + description = "Specifies whether any database modifications are applied immediately, or during the next maintenance window" +} + +variable "RDS_SKIP_FINAL_SNAPSHOT" { + type = "string" + default = "false" + description = "If true (default), no snapshot will be made before deleting DB" +} + +variable "RDS_BACKUP_RETENTION_PERIOD" { + type = "string" + default = "7" + description = "Backup retention period in days. Must be > 0 to enable backups" +} + +variable "RDS_BACKUP_WINDOW" { + type = "string" + default = "22:00-03:00" + description = "When AWS can perform DB snapshots, can't overlap with maintenance window" +} + module "rds" { source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=tags/0.4.1" enabled = "${var.RDS_ENABLED}" @@ -119,13 +155,13 @@ module "rds" { subnet_ids = ["${module.subnets.private_subnet_ids}"] vpc_id = "${module.vpc.vpc_id}" snapshot_identifier = "${var.RDS_SNAPSHOT}" - auto_minor_version_upgrade = "false" - allow_major_version_upgrade = "false" - apply_immediately = "true" - skip_final_snapshot = "false" + auto_minor_version_upgrade = "${var.RDS_AUTO_MINOR_VERSION_UPGRADE}" + allow_major_version_upgrade = "${var.RDS_ALLOW_MAJOR_VERSION_UPGRADE}" + apply_immediately = "${var.RDS_APPLY_IMMEDIATELY}" + skip_final_snapshot = "${var.RDS_SKIP_FINAL_SNAPSHOT}" copy_tags_to_snapshot = "true" - backup_retention_period = 7 - backup_window = "22:00-03:00" + backup_retention_period = "${var.RDS_BACKUP_RETENTION_PERIOD}" + backup_window = "${var.RDS_BACKUP_WINDOW}" } output "rds_instance_id" { @@ -150,7 +186,7 @@ output "rds_db_name" { output "rds_root_user" { value = "${var.RDS_ADMIN_NAME}" - description = "RDS root name" + description = "RDS root user name" } output "rds_root_password" { From 66c25bb6229d587f55b1a606e9199c75d95e91ee Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 22:40:20 +0600 Subject: [PATCH 15/17] Address Comments --- aws/backing-services/rds.tf | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index 41c8706d0..b8f5c9f0a 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -45,6 +45,12 @@ variable "RDS_ENGINE_VERSION" { description = "RDS DB engine version" } +variable "RDS_PORT" { + type = "string" + default = "3306" + description = "RDS DB port" +} + variable "RDS_DB_PARAMETER_GROUP" { type = "string" default = "mysql5.6" @@ -141,7 +147,7 @@ module "rds" { database_name = "${var.RDS_DB_NAME}" database_user = "${var.RDS_ADMIN_NAME}" database_password = "${var.RDS_ADMIN_PASSWORD}" - database_port = 3306 + database_port = "${var.RDS_PORT}" multi_az = "${var.RDS_MULTI_AZ}" storage_type = "${var.RDS_STORAGE_TYPE}" allocated_storage = "${var.RDS_STORAGE_SIZE}" @@ -179,6 +185,11 @@ output "rds_instance_endpoint" { description = "RDS DNS Endpoint of the instance" } +output "rds_port" { + value = "${var.RDS_PORT}" + description = "RDS port" +} + output "rds_db_name" { value = "${var.RDS_DB_NAME}" description = "RDS db name" From 3f515b871a9cdc2ed4ffa6aab37305016d3c46bb Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 23:26:03 +0600 Subject: [PATCH 16/17] Address Comments --- aws/backing-services/rds.tf | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index b8f5c9f0a..0977a4401 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -1,9 +1,16 @@ +variable "RDS_NAME" { + type = "string" + default = "rds" + description = "RDS instance name" +} + variable "RDS_ENABLED" { type = "string" default = "false" description = "Set to true to create rds instance" } + # Don't use `root` # ("MasterUsername root cannot be used as it is a reserved word used by the engine") variable "RDS_ADMIN_NAME" { @@ -140,9 +147,9 @@ module "rds" { enabled = "${var.RDS_ENABLED}" namespace = "${var.namespace}" stage = "${var.stage}" - name = "rds" + name = "${var.RDS_NAME}" dns_zone_id = "${var.zone_id}" - host_name = "rds" + host_name = "${var.RDS_NAME}" security_group_ids = ["${module.kops_metadata.nodes_security_group_id}"] database_name = "${var.RDS_DB_NAME}" database_user = "${var.RDS_ADMIN_NAME}" From 3ec3db94ca0790f1c6b228857793a25a8c09eca1 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Wed, 3 Oct 2018 23:28:35 +0600 Subject: [PATCH 17/17] Address Comments --- aws/backing-services/rds.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/aws/backing-services/rds.tf b/aws/backing-services/rds.tf index 0977a4401..7582867b2 100644 --- a/aws/backing-services/rds.tf +++ b/aws/backing-services/rds.tf @@ -10,7 +10,6 @@ variable "RDS_ENABLED" { description = "Set to true to create rds instance" } - # Don't use `root` # ("MasterUsername root cannot be used as it is a reserved word used by the engine") variable "RDS_ADMIN_NAME" {