Skip to main content
The db_parameter_group submodule creates an aws_db_parameter_group for a specific engine family. Parameter groups let you manage database engine settings across one or more DB instances.

Source

./modules/db_parameter_group

Usage

Use this submodule standalone when you want to share a parameter group across multiple DB instances or manage parameters outside the lifecycle of a single DB instance:
module "db_parameter_group" {
  source  = "terraform-aws-modules/rds/aws//modules/db_parameter_group"
  version = "~> 7.0"

  name            = "mysql80-production"
  use_name_prefix = false
  description     = "MySQL 8.0 parameter group for production workloads"
  family          = "mysql8.0"

  parameters = [
    {
      name  = "character_set_client"
      value = "utf8mb4"
    },
    {
      name  = "character_set_server"
      value = "utf8mb4"
    },
    {
      name         = "max_connections"
      value        = "500"
      apply_method = "immediate"
    },
    {
      name         = "innodb_buffer_pool_size"
      value        = "{DBInstanceClassMemory*3/4}"
      apply_method = "pending-reboot"
    },
  ]

  tags = {
    Environment = "production"
  }
}
Then reference the output in a DB instance:
module "db" {
  source  = "terraform-aws-modules/rds/aws"
  version = "~> 7.0"

  identifier                = "mydb"
  create_db_parameter_group = false
  parameter_group_name      = module.db_parameter_group.db_parameter_group_id

  # ... other variables
}

Input variables

create
bool
Whether to create the parameter group resource.Default: true
name
string
The name of the DB parameter group. When use_name_prefix is true, this is used as a prefix.Default: ""
use_name_prefix
bool
Determines whether to use name as-is or create a unique name beginning with name as the prefix.Default: true
description
string
The description of the DB parameter group.Default: null
family
string
The engine family for the parameter group (e.g. mysql8.0, postgres15, oracle-se2-19). This must match the engine version of the DB instance.Default: null
parameters
list(object)
A list of DB parameters to apply to the parameter group.Default: null
skip_destroy
bool
Set to true to prevent the parameter group from being deleted at destroy time. The resource is instead just removed from Terraform state.Default: null
region
string
Region where the parameter group will be managed. Defaults to the region set in the provider configuration.Default: null
tags
map(string)
A mapping of tags to assign to the DB parameter group resource.Default: {}

Outputs

db_parameter_group_id
string
The name (ID) of the DB parameter group. Pass this to the parameter_group_name input of a DB instance.
db_parameter_group_arn
string
The ARN of the DB parameter group.

Build docs developers (and LLMs) love