File tree Expand file tree Collapse file tree 8 files changed +37
-7
lines changed Expand file tree Collapse file tree 8 files changed +37
-7
lines changed Original file line number Diff line number Diff line change 11# Tamr Terraform Template Repo
22
3+ ## v2.1.0 - July 12nd 2021
4+ * Adds tags for RDS Subnet Group.
5+ * Adds new variable ` tags ` to set tags for all resources
6+ * Deprecates ` additional_tags ` in favor of ` tags `
7+
38## v2.0.0 - June 30th 2021
49* Accepts a list of security groups
510* Returns a list of ports used by RDS
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ This terraform module will create:
5454| subnet\_ group\_ name | The name of the subnet group to add the RDS instance to | ` string ` | n/a | yes |
5555| vpc\_ id | VPC ID for the rds security group | ` string ` | n/a | yes |
5656| additional\_ cidrs | Additional CIDR to connect to RDS Postgres instance | ` list(string) ` | ` [] ` | no |
57- | additional\_ tags | Additional tags to set on the RDS instance | ` map(string) ` | ` {} ` | no |
57+ | additional\_ tags | [ DEPRECATED: Use ` tags ` instead ] Additional tags to set on the RDS instance. | ` map(string) ` | ` {} ` | no |
5858| allocated\_ storage | Allocate storage | ` number ` | ` 20 ` | no |
5959| apply\_ immediately | Apply immediately, do not set this to true for production | ` bool ` | ` false ` | no |
6060| backup\_ retention\_ period | Backup retention period in days | ` number ` | ` 14 ` | no |
@@ -72,6 +72,7 @@ This terraform module will create:
7272| security\_ group\_ name | Name for the security group for the rds instance | ` string ` | ` "tamr_rds_sg" ` | no |
7373| skip\_ final\_ snapshot | Skip final snapshot | ` bool ` | ` true ` | no |
7474| storage\_ type | Storage type (e.g. gp2, io1) | ` string ` | ` "gp2" ` | no |
75+ | tags | A map of tags to add to all resources. Replaces ` additional_tags ` . | ` map(string) ` | ` {} ` | no |
7576| username | The username for the master DB user. | ` string ` | ` "tamr" ` | no |
7677
7778## Outputs
Original file line number Diff line number Diff line change 1- 2.0 .0
1+ 2.1 .0
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ No provider.
1717| subnet\_ ids | List of at least 2 subnets in different AZs for DB subnet group | ` list(string) ` | n/a | yes |
1818| vpc\_ id | VPC ID of network. | ` string ` | n/a | yes |
1919| egress\_ cidr\_ blocks | CIDR blocks to attach to security groups for egress | ` list(string) ` | <pre >[ <br > "0.0.0.0/0"<br >] </pre > | no |
20+ | tags | A map of tags to add to all resources created by this example. | ` map(string) ` | <pre >{<br > "Author": "Tamr",<br > "Environment": "Example"<br >}</pre > | no |
2021
2122## Outputs
2223
Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ module "rds_postgres" {
88 username = " exampleUsername"
99 password = " examplePassword" # tfsec:ignore:GEN003
1010
11- vpc_id = var. vpc_id
12- subnet_group_name = " example_subnet_group"
11+ vpc_id = var. vpc_id
12+ subnet_group_name = " example_subnet_group"
1313 # Network requirement: DB subnet group needs a subnet in at least two Availability Zones
1414 rds_subnet_ids = var. subnet_ids
1515 security_group_ids = module. rds-postgres-sg . security_group_ids
16+ tags = var. tags
1617}
1718
1819module "sg-ports" {
@@ -29,4 +30,5 @@ module "rds-postgres-sg" {
2930 sg_name_prefix = var. name_prefix
3031 egress_protocol = " all"
3132 ingress_protocol = " tcp"
33+ tags = var. tags
3234}
Original file line number Diff line number Diff line change @@ -27,3 +27,13 @@ variable "egress_cidr_blocks" {
2727 type = list (string )
2828 default = [" 0.0.0.0/0" ]
2929}
30+
31+ variable "tags" {
32+ type = map (string )
33+ description = " A map of tags to add to all resources created by this example."
34+ default = {
35+ Author = " Tamr"
36+ Environment = " Example"
37+ }
38+ }
39+
Original file line number Diff line number Diff line change 1+ locals {
2+ effective_tags = length (var. tags ) > 0 ? var. tags : var. additional_tags
3+ }
4+
15resource "aws_db_parameter_group" "rds_postgres_pg" {
26 name = var. parameter_group_name
37 family = var. parameter_group_family
48 description = " TAMR RDS parameter group"
5- tags = var . additional_tags
9+ tags = local . effective_tags
610}
711
812resource "aws_db_subnet_group" "rds_postgres_subnet_group" {
913 name = var. subnet_group_name
1014 subnet_ids = var. rds_subnet_ids
15+ tags = local. effective_tags
1116}
1217
1318resource "aws_db_instance" "rds_postgres" {
@@ -41,7 +46,7 @@ resource "aws_db_instance" "rds_postgres" {
4146 apply_immediately = var. apply_immediately
4247
4348 copy_tags_to_snapshot = var. copy_tags_to_snapshot
44- tags = var . additional_tags
49+ tags = local . effective_tags
4550
4651 lifecycle {
4752 ignore_changes = [password ]
Original file line number Diff line number Diff line change @@ -104,8 +104,14 @@ variable "copy_tags_to_snapshot" {
104104}
105105
106106variable "additional_tags" {
107- description = " Additional tags to set on the RDS instance"
108107 type = map (string )
108+ description = " [DEPRECATED: Use `tags` instead] Additional tags to set on the RDS instance."
109+ default = {}
110+ }
111+
112+ variable "tags" {
113+ type = map (string )
114+ description = " A map of tags to add to all resources. Replaces `additional_tags`."
109115 default = {}
110116}
111117
You can’t perform that action at this time.
0 commit comments