Skip to content

Commit

Permalink
Allow the option group verison to be empty/optional
Browse files Browse the repository at this point in the history
  • Loading branch information
MSR-RyanFisher committed Nov 9, 2019
1 parent 6ad596d commit 8101033
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ Available targets:
| name | The Name of the application or solution (e.g. `bastion` or `portal`) | string | - | yes |
| namespace | Namespace (e.g. `eg` or `cp`) | string | `` | no |
| option_group_name | Name of the DB option group to associate | string | `` | no |
| option_group_version | A version identifier to append to the option group name | string | `` | no |
| parameter_group_name | Name of the DB parameter group to associate | string | `` | no |
| publicly_accessible | Determines if database can be publicly available (NOT recommended) | bool | `false` | no |
| security_group_ids | The IDs of the security groups from which to allow `ingress` traffic to the DB instance | list(string) | `<list>` | no |
Expand Down
14 changes: 13 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,15 @@ resource "aws_db_parameter_group" "default" {
value = parameter.value.value
}
}

lifecycle {
create_before_destroy = true
}
}

resource "aws_db_option_group" "default" {
count = length(var.option_group_name) == 0 && var.enabled ? 1 : 0
name = join(var.delimiter, [module.label.id, var.option_group_version])
name = join(var.delimiter, compact([module.label.id, var.option_group_version]))
engine_name = var.engine
major_engine_version = local.major_engine_version
tags = module.label.tags
Expand Down Expand Up @@ -121,6 +125,10 @@ resource "aws_db_subnet_group" "default" {
name = module.label.id
subnet_ids = var.subnet_ids
tags = module.label.tags

lifecycle {
create_before_destroy = true
}
}

resource "aws_security_group" "default" {
Expand All @@ -137,6 +145,10 @@ resource "aws_security_group" "default" {
}

tags = module.label.tags

lifecycle {
create_before_destroy = true
}
}

resource "aws_security_group_rule" "default_ingress" {
Expand Down

0 comments on commit 8101033

Please sign in to comment.