From a1426b601ed2b82c1aa06bc2430af6d498201817 Mon Sep 17 00:00:00 2001 From: Scott Barnhart Date: Mon, 10 May 2021 09:15:08 -0700 Subject: [PATCH] Support DB param groups and increase "max_allowed_packet" (#191) * 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 --- CHANGELOG.md | 5 +++++ VARIABLES.md | 1 + db.tf | 13 +++++++++++++ variables.tf | 6 ++++++ 4 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab8c19a..e42b2a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/VARIABLES.md b/VARIABLES.md index ed5b7bc..a6b3a6c 100644 --- a/VARIABLES.md +++ b/VARIABLES.md @@ -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 | diff --git a/db.tf b/db.tf index f8616b8..86d1f00 100644 --- a/db.tf +++ b/db.tf @@ -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" @@ -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 diff --git a/variables.tf b/variables.tf index 161fe31..9f55298 100644 --- a/variables.tf +++ b/variables.tf @@ -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 +}