Skip to content

Commit

Permalink
Support DB param groups and increase "max_allowed_packet" (#191)
Browse files Browse the repository at this point in the history
* Add RDS parameter group and increase max packet len.

* make it a variable

* update changelog, misc fixes

* change from 16mb to 128mb as per Raj

Co-authored-by: Scott Barnhart <[email protected]>
  • Loading branch information
barnharts4 and Scott Barnhart authored May 10, 2021
1 parent be9f087 commit a1426b6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [6.8.0] - 2021-05-10
### Added
- Add support for Apiary-specific RDS parameter groups.
- Add variable to specify RDS/MySQL parameter value for `max_allowed_packet` (default 128MB).

## [6.7.9] - 2021-04-28
### Fixed
- If the S3 bucket specifies an expiration TTL in days that is <= the Intelligent-Tiering transition days, don't create
Expand Down
1 change: 1 addition & 0 deletions VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
| ranger_audit_secret_name | Ranger DB audit secret name. | string | `` | no |
| ranger_audit_solr_url | Ranger Solr audit provider configuration. | string | `` | no |
| ranger_policy_manager_url | Ranger admin URL to synchronize policies. | string | `` | no |
| rds_max_allowed_packet | RDS/MySQL setting for parameter 'max_allowed_packet' in bytes. | number | `134217728` | no |
| s3_enable_inventory | Enable S3 inventory configuration. | bool | `false` | no |
| s3_inventory_format | Output format for S3 inventory results. Can be Parquet, ORC, CSV | string | `ORC` | no |
| s3_inventory_update_schedule | Cron schedule to update S3 inventory tables (if enabled). Defaults to every 12 hours. | string | `0 */12 * * *` | no |
Expand Down
13 changes: 13 additions & 0 deletions db.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ resource "random_string" "db_master_password" {
special = false
}

resource aws_rds_cluster_parameter_group "apiary_rds_param_group" {
name = "${local.instance_alias}-param-group"
family = "aurora5.6" # Needs to be kept in sync with aws_rds_cluster.apiary_cluster.engine and version
description = "Apiary-specific Aurora parameters"
tags = merge(map("Name", "${local.instance_alias}-param-group"), var.apiary_tags)

parameter {
name = "max_allowed_packet"
value = var.rds_max_allowed_packet
}
}

resource "aws_rds_cluster" "apiary_cluster" {
count = var.external_database_host == "" ? 1 : 0
cluster_identifier = "${local.instance_alias}-cluster"
Expand All @@ -69,6 +81,7 @@ resource "aws_rds_cluster" "apiary_cluster" {
final_snapshot_identifier = "${local.instance_alias}-cluster-final-${random_id.snapshot_id[0].hex}"
iam_database_authentication_enabled = true
apply_immediately = var.db_apply_immediately
db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.apiary_rds_param_group.name

lifecycle {
create_before_destroy = true
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -480,3 +480,9 @@ variable "system_schema_name" {
type = string
default = "apiary_system"
}

variable "rds_max_allowed_packet" {
description = "RDS/MySQL setting for parameter 'max_allowed_packet' in bytes. Default is 128MB (Note that MySQL default is 4MB)."
type = number
default = 134217728
}

0 comments on commit a1426b6

Please sign in to comment.