Skip to content

Commit

Permalink
Adding tags support for root username password (#28)
Browse files Browse the repository at this point in the history
* adding tags support for root username password

* adding tag support for rds instance
  • Loading branch information
Jean-Michel Provencher authored and jmorissette committed Nov 11, 2019
1 parent 65e46f1 commit 61c75fd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rds_database_cluster/rds_database_cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ resource "aws_ssm_parameter" "db_root_master_username" {
name = "${lookup(var.optional_parameters, "parameter_store_path", "${var.custom_identifier}")}/${lookup(var.optional_parameters, "parameter_store_username_key", "Username")}"
type = "String"
value = "${lookup(var.optional_parameters, "master_username", "root")}"
tags = "${var.optional_ssm_parameter_tags}"
}

resource "aws_ssm_parameter" "db_root_master_password" {
Expand All @@ -22,6 +23,7 @@ resource "aws_ssm_parameter" "db_root_master_password" {
value = "${var.master_password}"

key_id = "${lookup(var.optional_parameters, "master_password_kms_key_id", "")}"
tags = "${var.optional_ssm_parameter_tags}"
}

resource "aws_rds_cluster" "rds_db_cluster" {
Expand Down
6 changes: 6 additions & 0 deletions rds_database_cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ variable "db_tags" {
default = {}
}

variable "optional_ssm_parameter_tags" {
type = "map"
description = "Additional tags to add to the SSM parameter resources"
default = {}
}

variable "availability_zones" {
type = "list"
description = "A list of EC2 Availability Zones that instances in the DB cluster can be created in"
Expand Down
2 changes: 2 additions & 0 deletions rds_database_instance/rds_database_instance.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ resource "aws_ssm_parameter" "db_root_username" {
name = "${lookup(var.optional_parameters, "parameter_store_path", "${var.custom_identifier}")}/${lookup(var.optional_parameters, "parameter_store_username_key", "Username")}"
type = "String"
value = "${lookup(var.optional_parameters, "username", "root_db")}"
tags = "${var.optional_ssm_parameter_tags}"
}

resource "aws_ssm_parameter" "db_root_password" {
Expand All @@ -22,6 +23,7 @@ resource "aws_ssm_parameter" "db_root_password" {
value = "${var.password}"

key_id = "${lookup(var.optional_parameters, "password_kms_key_id", "")}"
tags = "${var.optional_ssm_parameter_tags}"
}

resource "aws_db_instance" "rds_db_instance" {
Expand Down
6 changes: 6 additions & 0 deletions rds_database_instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ variable "db_tags" {
default = {}
}

variable "optional_ssm_parameter_tags" {
type = "map"
description = "Additional tags to add to the SSM parameter resources"
default = {}
}

variable "availability_zones" {
type = "list"
description = "A list of EC2 Availability Zones that instances in the DB cluster can be created in"
Expand Down

0 comments on commit 61c75fd

Please sign in to comment.