Skip to content

Commit

Permalink
Adding cluster param variable for major version upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
gappan committed Jan 26, 2022
1 parent 3c48d25 commit 79b0fee
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ No modules.
| <a name="input_data_reader_route53_zone_id"></a> [data\_reader\_route53\_zone\_id](#input\_data\_reader\_route53\_zone\_id) | If specified a data reader route53 record will be created | `string` | `""` | no |
| <a name="input_data_reader_tags"></a> [data\_reader\_tags](#input\_data\_reader\_tags) | A map of tags to add to data reader resources. | `map(string)` | `{}` | no |
| <a name="input_db_cluster_parameter_group_name"></a> [db\_cluster\_parameter\_group\_name](#input\_db\_cluster\_parameter\_group\_name) | The name of a DB Cluster parameter group to use | `string` | `"default.aurora5.6"` | no |
| <a name="input_db_instance_parameter_group_name"></a> [db\_instance\_parameter\_group\_name](#input\_db\_instance\_parameter\_group\_name) | Instance parameter group to associate with all instances of the DB cluster. The db\_instance\_parameter\_group\_name parameter is only valid in combination with the allow\_major\_version\_upgrade parameter. | `any` | `null` | no |
| <a name="input_db_parameter_group_name"></a> [db\_parameter\_group\_name](#input\_db\_parameter\_group\_name) | The name of a DB parameter group to use | `string` | `"default.aurora5.6"` | no |
| <a name="input_delete_timeout"></a> [delete\_timeout](#input\_delete\_timeout) | Timeout used for destroying cluster. This includes any cleanup task during the destroying process. | `string` | `"120m"` | no |
| <a name="input_deletion_protection"></a> [deletion\_protection](#input\_deletion\_protection) | The database can't be deleted when this value is set to true. | `bool` | `true` | no |
Expand Down
43 changes: 22 additions & 21 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,28 @@ resource "aws_db_subnet_group" "main" {
resource "aws_rds_cluster" "main" {
count = var.create_resources ? 1 : 0

allow_major_version_upgrade = var.allow_major_version_upgrade
cluster_identifier = "${var.identifier_prefix}${var.name}"
engine = var.engine
engine_version = var.engine_version
kms_key_id = var.kms_key_id
master_username = var.username
master_password = local.master_password
deletion_protection = var.deletion_protection
final_snapshot_identifier = "${var.final_snapshot_identifier_prefix}${var.name}-${random_id.snapshot_identifier[0].hex}"
skip_final_snapshot = var.skip_final_snapshot
backup_retention_period = var.backup_retention_period
preferred_backup_window = var.preferred_backup_window
preferred_maintenance_window = var.preferred_maintenance_window
port = local.port
db_subnet_group_name = aws_db_subnet_group.main[0].name
vpc_security_group_ids = concat([aws_security_group.main[0].id], var.extra_security_groups)
snapshot_identifier = var.snapshot_identifier
storage_encrypted = var.storage_encrypted
apply_immediately = var.apply_immediately
db_cluster_parameter_group_name = var.db_cluster_parameter_group_name
tags = var.tags
allow_major_version_upgrade = var.allow_major_version_upgrade
cluster_identifier = "${var.identifier_prefix}${var.name}"
engine = var.engine
engine_version = var.engine_version
kms_key_id = var.kms_key_id
master_username = var.username
master_password = local.master_password
deletion_protection = var.deletion_protection
final_snapshot_identifier = "${var.final_snapshot_identifier_prefix}${var.name}-${random_id.snapshot_identifier[0].hex}"
skip_final_snapshot = var.skip_final_snapshot
backup_retention_period = var.backup_retention_period
preferred_backup_window = var.preferred_backup_window
preferred_maintenance_window = var.preferred_maintenance_window
port = local.port
db_instance_parameter_group_name = var.allow_major_version_upgrade ? var.db_cluster_db_instance_parameter_group_name : null
db_subnet_group_name = aws_db_subnet_group.main[0].name
vpc_security_group_ids = concat([aws_security_group.main[0].id], var.extra_security_groups)
snapshot_identifier = var.snapshot_identifier
storage_encrypted = var.storage_encrypted
apply_immediately = var.apply_immediately
db_cluster_parameter_group_name = var.db_cluster_parameter_group_name
tags = var.tags

timeouts {
create = var.create_timeout
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ variable "allow_major_version_upgrade" {
default = false
}

variable "db_instance_parameter_group_name" {
description = "Instance parameter group to associate with all instances of the DB cluster. The db_instance_parameter_group_name parameter is only valid in combination with the allow_major_version_upgrade parameter."
default = null
}

variable "allowed_security_groups" {
description = "A list of Security Group ID's to allow access to."
default = []
Expand Down

0 comments on commit 79b0fee

Please sign in to comment.