Giter VIP home page Giter VIP logo

terraform-aws-rds's Introduction

AWS RDS Terraform module

Terraform module which creates RDS resources on AWS.

SWUbanner

Root module calls these modules which can also be used separately to create independent resources:

Usage

module "db" {
  source = "terraform-aws-modules/rds/aws"

  identifier = "demodb"

  engine            = "mysql"
  engine_version    = "5.7"
  instance_class    = "db.t3a.large"
  allocated_storage = 5

  db_name  = "demodb"
  username = "user"
  port     = "3306"

  iam_database_authentication_enabled = true

  vpc_security_group_ids = ["sg-12345678"]

  maintenance_window = "Mon:00:00-Mon:03:00"
  backup_window      = "03:00-06:00"

  # Enhanced Monitoring - see example for details on how to create the role
  # by yourself, in case you don't want to create it automatically
  monitoring_interval    = "30"
  monitoring_role_name   = "MyRDSMonitoringRole"
  create_monitoring_role = true

  tags = {
    Owner       = "user"
    Environment = "dev"
  }

  # DB subnet group
  create_db_subnet_group = true
  subnet_ids             = ["subnet-12345678", "subnet-87654321"]

  # DB parameter group
  family = "mysql5.7"

  # DB option group
  major_engine_version = "5.7"

  # Database Deletion Protection
  deletion_protection = true

  parameters = [
    {
      name  = "character_set_client"
      value = "utf8mb4"
    },
    {
      name  = "character_set_server"
      value = "utf8mb4"
    }
  ]

  options = [
    {
      option_name = "MARIADB_AUDIT_PLUGIN"

      option_settings = [
        {
          name  = "SERVER_AUDIT_EVENTS"
          value = "CONNECT"
        },
        {
          name  = "SERVER_AUDIT_FILE_ROTATIONS"
          value = "37"
        },
      ]
    },
  ]
}

Conditional creation

The following values are provided to toggle on/off creation of the associated resources as desired:

module "db" {
  source = "terraform-aws-modules/rds/aws"

  # Disable creation of RDS instance(s)
  create_db_instance = false

  # Disable creation of option group - provide an option group or default AWS default
  create_db_option_group = false

  # Disable creation of parameter group - provide a parameter group or default to AWS default
  create_db_parameter_group = false

  # Enable creation of subnet group (disabled by default)
  create_db_subnet_group = true

  # Enable creation of monitoring IAM role
  create_monitoring_role = true

  # ... omitted
}

Option Groups

Reference

Users have the ability to:

  • Create an option group with the name provided:
  option_group_name            = "prod-instance-mysql-8.0"
  option_group_use_name_prefix = false
  • Create an option group using a unique prefix beginning with the name provided:
  option_group_name = "prod-instance-mysql-8.0"
  • Pass the name of an option group to use that has been created outside of the module:
  create_db_option_group = false
  option_group_name      = "prod-instance-mysql-8.0" # must already exist in AWS
  • Skip creating an option group for PostgreSQL entirely as that is not supported
  engine            = "postgres"
  option_group_name = "prod-instance-postgresql-11.0" # this will be ignored, no option group created
  • Use a default option group provided by AWS
  create_db_option_group = false

Parameter Groups

Reference

Users have the ability to:

  • Create a parameter group with the name provided:
  parameter_group_name            = "prod-instance-mysql-8.0"
  parameter_group_use_name_prefix = false
  • Create a parameter group using a unique prefix beginning with the name provided:
  parameter_group_name = "prod-instance-mysql-8.0"
  • Pass the name of a parameter group to use that has been created outside of the module:
  create_db_parameter_group = false
  parameter_group_name   = "prod-instance-mysql-8.0" # must already exist in AWS
  • Use a default parameter group provided by AWS
  create_db_parameter_group = false

Examples

Notes

  1. This module does not create RDS security group. Use terraform-aws-security-group module for this.
  2. For an RDS instance with storage_type using gp3, be aware that iops and storage_throughput cannot be specified if the allocated_storage value is below a per-engine threshold. See the RDS User Guide for details.

Requirements

Name Version
terraform >= 1.0
aws >= 5.47

Providers

No providers.

Modules

Name Source Version
db_instance ./modules/db_instance n/a
db_instance_role_association ./modules/db_instance_role_association n/a
db_option_group ./modules/db_option_group n/a
db_parameter_group ./modules/db_parameter_group n/a
db_subnet_group ./modules/db_subnet_group n/a

Resources

No resources.

Inputs

Name Description Type Default Required
allocated_storage The allocated storage in gigabytes number null no
allow_major_version_upgrade Indicates that major version upgrades are allowed. Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible bool false no
apply_immediately Specifies whether any database modifications are applied immediately, or during the next maintenance window bool false no
auto_minor_version_upgrade Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window bool true no
availability_zone The Availability Zone of the RDS instance string null no
backup_retention_period The days to retain backups for number null no
backup_window The daily time range (in UTC) during which automated backups are created if they are enabled. Example: '09:46-10:16'. Must not overlap with maintenance_window string null no
blue_green_update Enables low-downtime updates using RDS Blue/Green deployments. map(string) {} no
ca_cert_identifier Specifies the identifier of the CA certificate for the DB instance string null no
character_set_name The character set name to use for DB encoding in Oracle instances. This can't be changed. See Oracle Character Sets Supported in Amazon RDS and Collations and Character Sets for Microsoft SQL Server for more information. This can only be set on creation string null no
cloudwatch_log_group_class Specified the log class of the log group. Possible values are: STANDARD or INFREQUENT_ACCESS string null no
cloudwatch_log_group_kms_key_id The ARN of the KMS Key to use when encrypting log data string null no
cloudwatch_log_group_retention_in_days The number of days to retain CloudWatch logs for the DB instance number 7 no
cloudwatch_log_group_skip_destroy Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state bool null no
copy_tags_to_snapshot On delete, copy all Instance tags to the final snapshot bool false no
create_cloudwatch_log_group Determines whether a CloudWatch log group is created for each enabled_cloudwatch_logs_exports bool false no
create_db_instance Whether to create a database instance bool true no
create_db_option_group Create a database option group bool true no
create_db_parameter_group Whether to create a database parameter group bool true no
create_db_subnet_group Whether to create a database subnet group bool false no
create_monitoring_role Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs bool false no
custom_iam_instance_profile RDS custom iam instance profile string null no
db_instance_role_associations A map of DB instance supported feature name to role association ARNs. map(any) {} no
db_instance_tags Additional tags for the DB instance map(string) {} no
db_name The DB name to create. If omitted, no database is created initially string null no
db_option_group_tags Additional tags for the DB option group map(string) {} no
db_parameter_group_tags Additional tags for the DB parameter group map(string) {} no
db_subnet_group_description Description of the DB subnet group to create string null no
db_subnet_group_name Name of DB subnet group. DB instance will be created in the VPC associated with the DB subnet group. If unspecified, will be created in the default VPC string null no
db_subnet_group_tags Additional tags for the DB subnet group map(string) {} no
db_subnet_group_use_name_prefix Determines whether to use subnet_group_name as is or create a unique name beginning with the subnet_group_name as the prefix bool true no
dedicated_log_volume Use a dedicated log volume (DLV) for the DB instance. Requires Provisioned IOPS. bool false no
delete_automated_backups Specifies whether to remove automated backups immediately after the DB instance is deleted bool true no
deletion_protection The database can't be deleted when this value is set to true bool false no
domain The ID of the Directory Service Active Directory domain to create the instance in string null no
domain_auth_secret_arn (Optional, but required if domain_fqdn is provided) The ARN for the Secrets Manager secret with the self managed Active Directory credentials for the user joining the domain. Conflicts with domain and domain_iam_role_name. string null no
domain_dns_ips (Optional, but required if domain_fqdn is provided) The IPv4 DNS IP addresses of your primary and secondary self managed Active Directory domain controllers. Two IP addresses must be provided. If there isn't a secondary domain controller, use the IP address of the primary domain controller for both entries in the list. Conflicts with domain and domain_iam_role_name. list(string) null no
domain_fqdn The fully qualified domain name (FQDN) of the self managed Active Directory domain. Conflicts with domain and domain_iam_role_name. string null no
domain_iam_role_name (Required if domain is provided) The name of the IAM role to be used when making API calls to the Directory Service string null no
domain_ou (Optional, but required if domain_fqdn is provided) The self managed Active Directory organizational unit for your DB instance to join. Conflicts with domain and domain_iam_role_name. string null no
enabled_cloudwatch_logs_exports List of log types to enable for exporting to CloudWatch logs. If omitted, no logs will be exported. Valid values (depending on engine): alert, audit, error, general, listener, slowquery, trace, postgresql (PostgreSQL), upgrade (PostgreSQL) list(string) [] no
engine The database engine to use string null no
engine_version The engine version to use string null no
family The family of the DB parameter group string null no
final_snapshot_identifier_prefix The name which is prefixed to the final snapshot on cluster destroy string "final" no
iam_database_authentication_enabled Specifies whether or not the mappings of AWS Identity and Access Management (IAM) accounts to database accounts are enabled bool false no
identifier The name of the RDS instance string n/a yes
instance_class The instance type of the RDS instance string null no
instance_use_identifier_prefix Determines whether to use identifier as is or create a unique identifier beginning with identifier as the specified prefix bool false no
iops The amount of provisioned IOPS. Setting this implies a storage_type of 'io1' or gp3. See notes for limitations regarding this variable for gp3 number null no
kms_key_id The ARN for the KMS encryption key. If creating an encrypted replica, set this to the destination KMS ARN. If storage_encrypted is set to true and kms_key_id is not specified the default KMS key created in your account will be used. Be sure to use the full ARN, not a key alias. string null no
license_model License model information for this DB instance. Optional, but required for some DB engines, i.e. Oracle SE1 string null no
maintenance_window The window to perform maintenance in. Syntax: 'ddd:hh24:mi-ddd:hh24:mi'. Eg: 'Mon:00:00-Mon:03:00' string null no
major_engine_version Specifies the major version of the engine that this option group should be associated with string null no
manage_master_user_password Set to true to allow RDS to manage the master user password in Secrets Manager bool true no
manage_master_user_password_rotation Whether to manage the master user password rotation. By default, false on creation, rotation is managed by RDS. Setting this value to false after previously having been set to true will disable automatic rotation. bool false no
master_user_password_rotate_immediately Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window. bool null no
master_user_password_rotation_automatically_after_days Specifies the number of days between automatic scheduled rotations of the secret. Either automatically_after_days or schedule_expression must be specified. number null no
master_user_password_rotation_duration The length of the rotation window in hours. For example, 3h for a three hour window. string null no
master_user_password_rotation_schedule_expression A cron() or rate() expression that defines the schedule for rotating your secret. Either automatically_after_days or schedule_expression must be specified. string null no
master_user_secret_kms_key_id The key ARN, key ID, alias ARN or alias name for the KMS key to encrypt the master user password secret in Secrets Manager.
If not specified, the default KMS key for your Amazon Web Services account is used.
string null no
max_allocated_storage Specifies the value for Storage Autoscaling number 0 no
monitoring_interval The interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60 number 0 no
monitoring_role_arn The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. Must be specified if monitoring_interval is non-zero string null no
monitoring_role_description Description of the monitoring IAM role string null no
monitoring_role_name Name of the IAM role which will be created when create_monitoring_role is enabled string "rds-monitoring-role" no
monitoring_role_permissions_boundary ARN of the policy that is used to set the permissions boundary for the monitoring IAM role string null no
monitoring_role_use_name_prefix Determines whether to use monitoring_role_name as is or create a unique identifier beginning with monitoring_role_name as the specified prefix bool false no
multi_az Specifies if the RDS instance is multi-AZ bool false no
nchar_character_set_name The national character set is used in the NCHAR, NVARCHAR2, and NCLOB data types for Oracle instances. This can't be changed. string null no
network_type The type of network stack to use string null no
option_group_description The description of the option group string null no
option_group_name Name of the option group string null no
option_group_timeouts Define maximum timeout for deletion of aws_db_option_group resource map(string) {} no
option_group_use_name_prefix Determines whether to use option_group_name as is or create a unique name beginning with the option_group_name as the prefix bool true no
options A list of Options to apply any [] no
parameter_group_description Description of the DB parameter group to create string null no
parameter_group_name Name of the DB parameter group to associate or create string null no
parameter_group_use_name_prefix Determines whether to use parameter_group_name as is or create a unique name beginning with the parameter_group_name as the prefix bool true no
parameters A list of DB parameters (map) to apply list(map(string)) [] no
password Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file.
The password provided will not be used if manage_master_user_password is set to true.
string null no
performance_insights_enabled Specifies whether Performance Insights are enabled bool false no
performance_insights_kms_key_id The ARN for the KMS key to encrypt Performance Insights data string null no
performance_insights_retention_period The amount of time in days to retain Performance Insights data. Valid values are 7, 731 (2 years) or a multiple of 31 number 7 no
port The port on which the DB accepts connections string null no
publicly_accessible Bool to control if instance is publicly accessible bool false no
putin_khuylo Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo! bool true no
replica_mode Specifies whether the replica is in either mounted or open-read-only mode. This attribute is only supported by Oracle instances. Oracle replicas operate in open-read-only mode unless otherwise specified string null no
replicate_source_db Specifies that this resource is a Replicate database, and to use this value as the source database. This correlates to the identifier of another Amazon RDS Database to replicate string null no
restore_to_point_in_time Restore to a point in time (MySQL is NOT supported) map(string) null no
s3_import Restore from a Percona Xtrabackup in S3 (only MySQL is supported) map(string) null no
skip_final_snapshot Determines whether a final DB snapshot is created before the DB instance is deleted. If true is specified, no DBSnapshot is created. If false is specified, a DB snapshot is created before the DB instance is deleted bool false no
snapshot_identifier Specifies whether or not to create this database from a snapshot. This correlates to the snapshot ID you'd find in the RDS console, e.g: rds:production-2015-06-26-06-05 string null no
storage_encrypted Specifies whether the DB instance is encrypted bool true no
storage_throughput Storage throughput value for the DB instance. See notes for limitations regarding this variable for gp3 number null no
storage_type One of 'standard' (magnetic), 'gp2' (general purpose SSD), 'gp3' (new generation of general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'gp2' if not. If you specify 'io1' or 'gp3' , you must also include a value for the 'iops' parameter string null no
subnet_ids A list of VPC subnet IDs list(string) [] no
tags A mapping of tags to assign to all resources map(string) {} no
timeouts Updated Terraform resource management timeouts. Applies to aws_db_instance in particular to permit resource management times map(string) {} no
timezone Time zone of the DB instance. timezone is currently only supported by Microsoft SQL Server. The timezone can only be set on creation. See MSSQL User Guide for more information string null no
username Username for the master DB user string null no
vpc_security_group_ids List of VPC security groups to associate list(string) [] no

Outputs

Name Description
db_instance_address The address of the RDS instance
db_instance_arn The ARN of the RDS instance
db_instance_availability_zone The availability zone of the RDS instance
db_instance_ca_cert_identifier Specifies the identifier of the CA certificate for the DB instance
db_instance_cloudwatch_log_groups Map of CloudWatch log groups created and their attributes
db_instance_domain The ID of the Directory Service Active Directory domain the instance is joined to
db_instance_domain_auth_secret_arn The ARN for the Secrets Manager secret with the self managed Active Directory credentials for the user joining the domain
db_instance_domain_dns_ips The IPv4 DNS IP addresses of your primary and secondary self managed Active Directory domain controllers
db_instance_domain_fqdn The fully qualified domain name (FQDN) of an self managed Active Directory domain
db_instance_domain_iam_role_name The name of the IAM role to be used when making API calls to the Directory Service
db_instance_domain_ou The self managed Active Directory organizational unit for your DB instance to join
db_instance_endpoint The connection endpoint
db_instance_engine The database engine
db_instance_engine_version_actual The running version of the database
db_instance_hosted_zone_id The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record)
db_instance_identifier The RDS instance identifier
db_instance_master_user_secret_arn The ARN of the master user secret (Only available when manage_master_user_password is set to true)
db_instance_name The database name
db_instance_port The database port
db_instance_resource_id The RDS Resource ID of this instance
db_instance_role_associations A map of DB Instance Identifiers and IAM Role ARNs separated by a comma
db_instance_secretsmanager_secret_rotation_enabled Specifies whether automatic rotation is enabled for the secret
db_instance_status The RDS instance status
db_instance_username The master username for the database
db_listener_endpoint Specifies the listener connection endpoint for SQL Server Always On
db_option_group_arn The ARN of the db option group
db_option_group_id The db option group id
db_parameter_group_arn The ARN of the db parameter group
db_parameter_group_id The db parameter group id
db_subnet_group_arn The ARN of the db subnet group
db_subnet_group_id The db subnet group name
enhanced_monitoring_iam_role_arn The Amazon Resource Name (ARN) specifying the monitoring role
enhanced_monitoring_iam_role_name The name of the monitoring role

Authors

Module is maintained by Anton Babenko with help from these awesome contributors.

License

Apache 2 Licensed. See LICENSE for full details.

Additional information for users from Russia and Belarus

terraform-aws-rds's People

Contributors

ajax-mykhailo-oleksiuk avatar antonbabenko avatar betajobot avatar bryantbiggs avatar burib avatar decayofmind avatar dev-slatto avatar dpiddockcmp avatar etiennechabert avatar fmartingr avatar jensendw avatar magreenbaum avatar mehstg avatar nazartm avatar nghiapt avatar orenfromberg avatar philslab-ninja avatar rafmagns-skepa-dreag avatar riccardo-salamanna avatar robinbowes avatar rsmets avatar saimonn avatar santi698 avatar semantic-release-bot avatar smelchior avatar solidsly avatar stefan-matic avatar techieforfun avatar yamaszone avatar zahorniak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-aws-rds's Issues

vpc_security_group_ids reverts to VPC default SG

If I specify an already-existing security group id (below) the RDS instance seems to ignore and reverts to the default VPC Security Group.

module "db" {
  vpc_security_group_ids = ["sg-123456"]
}

Issues passing option group options requiring settings

Samples in the readme include items such as:

options = [
{
option_name = "MARIADB_AUDIT_PLUGIN"
}
]

For options requiring settings related to the option name, attempting a number of combinations such as this fail:

options = [
{
option_name = "SQLSERVER_BACKUP_RESTORE"
option_settings {
name = "IAM_ROLE_ARN"
value = "${aws_iam_role.database_role.arn}"
}
}
]

results in:
Error: module.database.module.db_option_group.aws_db_option_group.this: "option.0.option_name": required field is not set

The above example was formatted in the same manner used for aws_db_option_group resources. Is there another format in which they should be used with the terraform-aws-rds module? perhaps an item for the readme or one/some of the examples provided.

Support for enabled_cloudwatch_logs_exports

Feature to enable:
enabled_cloudwatch_logs_exports - (Optional) Name list of enable log type for exporting to cloudwatch logs. If omitted, any logs will not be exported to cloudwatch logs. Either of the following is supported: audit, error, general, slowquery.

db_instance docs

Can I expect this coming anytime soon?

RDS Oracle support

Hi,

Does this module support Oracle RDS? I tried using it but as Oracle needs "license_model" to be provided, so when I checked in Terraform documentation, it supports it but upon checking the module code, it does not have this parameter available so I get below error everytime I run terraform plan:

1 error(s) occurred:
module root: module db: license_model is not a valid parameter

Please advise.

Unable to login to MySQL Database

This module seems really convenient for us to deploy a database on AWS. However, after I deploy a MySQL Database and try to login using MySQL Workbench, the connection failed.

I used code from following link and did not modify anything.
https://github.com/terraform-aws-modules/terraform-aws-rds/tree/v1.19.0/examples/complete-mysql

By contrast, if I follow the official guide, everything seems correct.
https://aws.amazon.com/getting-started/tutorials/create-mysql-db/

When I compare these two databases, I found that security groups are different. I wonder whether it causes the problem I met, or if I used this module incorrectly. Thanks a lot!

Add support for encrypted master password

The whole point of Terraform is to keep infrastructure configuration checked into source control, so having the database master password in plain text goes against this.

Would it be possible to use a KMS-encrypted string as the password?

Cannot create multi-region + multi-az (MySQL)

I've created a multi-region (3 regions) MySQL deployment with multi_az = true. So we have the primary instance and read-replicas in 2 other regions. It all applies successfully, no errors but on inspecting the infra in the AWS console I can see the primary instance is multi_az but the read-replicas (in different regions) are not.

If I do another terraform apply then terraform notices that the other regions are not multi_az and states that they will be set to true but on applying it remains stubbornly set to false.

I am able to turn it on in the AWS console and I notice this seems to be a recent feature: https://aws.amazon.com/about-aws/whats-new/2018/01/amazon-rds-read-replicas-now-support-multi-az-deployments/ - perhaps this is why it is not working?

Output of re-running terraform apply (not 2 other attributes also failed to take, backup retention and IAM access):

Terraform will perform the following actions:

  ~ module.rds-sydney.module.db.module.db_instance.aws_db_instance.this
      backup_retention_period:             "0" => "1"
      iam_database_authentication_enabled: "false" => "true"
      multi_az:                            "false" => "true"

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

module.rds-sydney.module.db.module.db_instance.aws_db_instance.this: Modifying... (ID: test-multiregion-rds-sydney)
  backup_retention_period:             "0" => "1"
  iam_database_authentication_enabled: "false" => "true"
  multi_az:                            "false" => "true"
module.rds-sydney.db.db_instance.aws_db_instance.this: Still modifying... (ID: test-multiregion-rds-sydney, 10s elapsed)
module.rds-sydney.db.db_instance.aws_db_instance.this: Still modifying... (ID: test-multiregion-rds-sydney, 20s elapsed)
module.rds-sydney.db.db_instance.aws_db_instance.this: Still modifying... (ID: test-multiregion-rds-sydney, 30s elapsed)
module.rds-sydney.module.db.module.db_instance.aws_db_instance.this: Modifications complete after 37s (ID: test-multiregion-rds-sydney)

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Addition of availability_zone parameter forces recreation of the db

After availability_zone was added as a parameter, Terraform wants to destroy and recreate my database:
availability_zone: "eu-central-1b" => <computed> (forces new resource)

This is when I don't specify the availability_zone in my configuration.
If I try adding it, I get an error saying that it cannot be specified when using multi-az RDS.

aws_db_subnet_group.this: value of 'count' cannot be computed

Hi,

I created a VPC and database_subnet using
"terraform-aws-modules/vpc/aws" module.

Then, when I pass database_subnet_group to "terraform-aws-modules/rds/aws" module, I get the error as

aws_db_subnet_group.this: value of 'count' cannot be computed

But, if I create the VPC first and then create the RDS, there is no issue.

Unable to destroy the RDS and the parameter_option_group during the same pipeline

Hello @antonbabenko,

While trying to destroy my RDS instance with terraform-destroy (using this template with modules), I'm getting errors as the db_parameter-group can't be deleted, it happens during the first time that I run terraform-destroy: "InvalidDBParameterGroupState: one or more database instances are still members of this parameter group". In this case, I checked and the rds instance is deleted and the db_option_group too.

When I tried for a second time, it's deleted without errors. I think there are dependencies issues and because the instance takes a long to be deleted, terraform doesn't realised that the rds is deleted when trying to delete the db_parameter group.

It could be possible to implement a wait condition between modules?

Thanks

Specifying availability zone?

Hi, is there a way to specify the AZ when using the main module? I see the variable in db_instance, but nothing in main.tf

Thanks

Warnings on upgrading to Terraform v0.11.1




Warning: output "this_db_parameter_group_arn": must use splat syntax to access aws_db_parameter_group.this attribute "arn", because it has "count" set; use aws_db_parameter_group.this.*.arn to obtain a list of the attributes across all instances

Error when final_snapshot_identifier is not set

Hi, I've been using the module for a while but after the last version I'm getting an error after every terraform plan when final_snapshot_identifier is not set.

* module.db_instance.aws_db_instance.this: only alphanumeric characters and hyphens allowed in "final_snapshot_identifier"

It may be related to this closed issue

Support for Aurora MySQL

The module doesn't seem to play nice with RDS Aurora for MySQL (5.7). First it seems that storage_type is not supported for any of standard/io1/gp2:

aws_db_instance.this: Error creating DB Instance: StorageTypeNotSupported: Invalid storage type: io1
	status code: 400, request id: 326e86ca-cdb8-4a72-be42-e98d9708d61b

If I comment out that line for the resource creation a different error crops up:

aws_db_instance.this: Error creating DB Instance: InvalidParameterCombination: Standalone DB Instances are not supported for the specified engine
	status code: 400, request id: 07ec75d1-5240-421b-b6ee-e553671faa2c

It seems that no cluster is created to host the Aurora instance, which is not a supported configuration for Aurora. Is it possible to support Aurora in this module?

Terraform not finding all parameters in parameter group for plan.

Upon subsequent runs of terraform after creating a cluster and instance parameter group via terrafrom, Terraform does not know of the existence of some parameters and thinks it needs to reapply parameters. when infact the values are set to the correct value according to the aws console.
These are for postgres-aurora9.6. All variables are set with sane defaults in corresponding variables.tf files

Plan:

~ module.NAME_cluster_parameter_group.aws_rds_cluster_parameter_group.postgresql
      parameter.#:                                       "32" => "42"
      parameter.1088520732.apply_method:                 "" => ""
      parameter.1088520732.name:                         "" => "ssl"
      parameter.1088520732.value:                        "" => "1"
      parameter.1124637299.apply_method:                 "" => ""
      parameter.1124637299.name:                         "" => "client_encoding"
      parameter.1124637299.value:                        "" => "UTF8"
      parameter.1215537625.apply_method:                 "pending-reboot" => ""
      parameter.1215537625.name:                         "lc_monetary" => "lc_monetary"
      parameter.1215537625.value:                        "c" => "C"
      parameter.1221875064.apply_method:                 "pending-reboot" => ""
      parameter.1221875064.name:                         "datestyle" => "datestyle"
      parameter.1221875064.value:                        "iso, mdy" => "ISO, MDY"
      parameter.1243608657.apply_method:                 "pending-reboot" => ""
      parameter.1243608657.name:                         "track_commit_timestamp" => "track_commit_timestamp"
      parameter.1243608657.value:                        "0" => "0"
      parameter.135038709.apply_method:                  "pending-reboot" => ""
      parameter.135038709.name:                          "lc_numeric" => "lc_numeric"
      parameter.135038709.value:                         "c" => "C"
      parameter.1513804943.apply_method:                 "pending-reboot" => ""
      parameter.1513804943.name:                         "orafce.timezone" => "orafce.timezone"
      parameter.1513804943.value:                        "utc" => "UTC"
      parameter.1533413219.apply_method:                 "pending-reboot" => ""
      parameter.1533413219.name:                         "default_with_oids" => "default_with_oids"
      parameter.1533413219.value:                        "0" => "0"
      parameter.1548775132.apply_method:                 "pending-reboot" => ""
      parameter.1548775132.name:                         "autovacuum_analyze_scale_factor" => "autovacuum_analyze_scale_factor"
      parameter.1548775132.value:                        "0.01" => "0.01"
      parameter.1600158149.apply_method:                 "pending-reboot" => ""
      parameter.1600158149.name:                         "log_autovacuum_min_duration" => "log_autovacuum_min_duration"
      parameter.1600158149.value:                        "-1" => "-1"
      parameter.1615406913.apply_method:                 "pending-reboot" => ""
      parameter.1615406913.name:                         "vacuum_cost_limit" => "vacuum_cost_limit"
      parameter.1615406913.value:                        "200" => "200"
      parameter.1861664363.apply_method:                 "pending-reboot" => ""
      parameter.1861664363.name:                         "autovacuum_work_mem" => "autovacuum_work_mem"
      parameter.1861664363.value:                        "-1" => "-1"
      parameter.1980051807.apply_method:                 "pending-reboot" => ""
      parameter.1980051807.name:                         "array_nulls" => "array_nulls"
      parameter.1980051807.value:                        "1" => "1"
      parameter.2090939227.apply_method:                 "pending-reboot" => ""
      parameter.2090939227.name:                         "rds.force_autovacuum_logging_level" => "rds.force_autovacuum_logging_level"
      parameter.2090939227.value:                        "disabled" => "disabled"
      parameter.2092812219.apply_method:                 "pending-reboot" => ""
      parameter.2092812219.name:                         "autovacuum_vacuum_threshold" => "autovacuum_vacuum_threshold"
      parameter.2092812219.value:                        "50" => "50"
      parameter.2165550923.apply_method:                 "pending-reboot" => ""
      parameter.2165550923.name:                         "vacuum_freeze_table_age" => "vacuum_freeze_table_age"
      parameter.2165550923.value:                        "150000000" => "150000000"
      parameter.2313469300.apply_method:                 "pending-reboot" => ""
      parameter.2313469300.name:                         "vacuum_multixact_freeze_min_age" => "vacuum_multixact_freeze_min_age"
      parameter.2313469300.value:                        "5000000" => "5000000"
      parameter.2422635300.apply_method:                 "pending-reboot" => ""
      parameter.2422635300.name:                         "autovacuum_multixact_freeze_max_age" => "autovacuum_multixact_freeze_max_age"
      parameter.2422635300.value:                        "400000000" => "400000000"
      parameter.2501266137.apply_method:                 "" => ""
      parameter.2501266137.name:                         "" => "rds.force_ssl"
      parameter.2501266137.value:                        "" => "0"
      parameter.2513129746.apply_method:                 "pending-reboot" => ""
      parameter.2513129746.name:                         "vacuum_freeze_min_age" => "vacuum_freeze_min_age"
      parameter.2513129746.value:                        "50000000" => "50000000"
      parameter.2695200582.apply_method:                 "pending-reboot" => ""
      parameter.2695200582.name:                         "lc_time" => "lc_time"
      parameter.2695200582.value:                        "c" => "C"
      parameter.2720520919.apply_method:                 "pending-reboot" => ""
      parameter.2720520919.name:                         "vacuum_multixact_freeze_table_age" => "vacuum_multixact_freeze_table_age"
      parameter.2720520919.value:                        "150000000" => "150000000"
      parameter.2981320485.apply_method:                 "" => ""
      parameter.2981320485.name:                         "" => "autovacuum_max_workers"
      parameter.2981320485.value:                        "" => "GREATEST({DBInstanceClassMemory/64371566592},3)"
      parameter.3160707358.apply_method:                 "" => ""
      parameter.3160707358.name:                         "" => "autovacuum_vacuum_cost_delay"
      parameter.3160707358.value:                        "" => "5"
      parameter.3204276105.apply_method:                 "" => ""
      parameter.3204276105.name:                         "" => "timezone"
      parameter.3204276105.value:                        "" => "UTC"
      parameter.3309557757.apply_method:                 "" => ""
      parameter.3309557757.name:                         "" => "vacuum_cost_page_miss"
      parameter.3309557757.value:                        "" => "0"
      parameter.3330762744.apply_method:                 "pending-reboot" => ""
      parameter.3330762744.name:                         "intervalstyle" => "intervalstyle"
      parameter.3330762744.value:                        "postgres" => "postgres"
      parameter.3354378144.apply_method:                 "pending-reboot" => ""
      parameter.3354378144.name:                         "autovacuum_vacuum_cost_limit" => "autovacuum_vacuum_cost_limit"
      parameter.3354378144.value:                        "-1" => "-1"
      parameter.3637487751.apply_method:                 "pending-reboot" => ""
      parameter.3637487751.name:                         "vacuum_cost_page_hit" => "vacuum_cost_page_hit"
      parameter.3637487751.value:                        "1" => "1"
      parameter.3812753642.apply_method:                 "pending-reboot" => ""
      parameter.3812753642.name:                         "orafce.nls_date_format" => "orafce.nls_date_format"
      parameter.3812753642.value:                        "default" => "DEFAULT"
      parameter.3923327853.apply_method:                 "" => ""
      parameter.3923327853.name:                         "" => "max_prepared_transactions"
      parameter.3923327853.value:                        "" => "0"
      parameter.4017101848.apply_method:                 "" => ""
      parameter.4017101848.name:                         "" => "autovacuum_naptime"
      parameter.4017101848.value:                        "" => "5"
      parameter.4065324060.apply_method:                 "pending-reboot" => ""
      parameter.4065324060.name:                         "autovacuum_freeze_max_age" => "autovacuum_freeze_max_age"
      parameter.4065324060.value:                        "1000000000" => "1000000000"
      parameter.514936223.apply_method:                  "pending-reboot" => ""
      parameter.514936223.name:                          "wal_buffers" => "wal_buffers"
      parameter.514936223.value:                         "2048" => "2048"
      parameter.522068284.apply_method:                  "" => ""
      parameter.522068284.name:                          "" => "synchronous_commit"
      parameter.522068284.value:                         "" => "on"
      parameter.584376853.apply_method:                  "pending-reboot" => ""
      parameter.584376853.name:                          "autovacuum" => "autovacuum"
      parameter.584376853.value:                         "0" => "0"
      parameter.893742915.apply_method:                  "pending-reboot" => ""
      parameter.893742915.name:                          "autovacuum_analyze_threshold" => "autovacuum_analyze_threshold"
      parameter.893742915.value:                         "50" => "50"
      parameter.916951694.apply_method:                  "pending-reboot" => ""
      parameter.916951694.name:                          "autovacuum_vacuum_scale_factor" => "autovacuum_vacuum_scale_factor"
      parameter.916951694.value:                         "0.01" => "0.01"
      parameter.949234213.apply_method:                  "pending-reboot" => ""
      parameter.949234213.name:                          "extra_float_digits" => "extra_float_digits"
      parameter.949234213.value:                         "0" => "0"
      parameter.966492384.apply_method:                  "pending-reboot" => ""
      parameter.966492384.name:                          "vacuum_cost_delay" => "vacuum_cost_delay"
      parameter.966492384.value:                         "0" => "0"
      parameter.987316213.apply_method:                  "pending-reboot" => ""
      parameter.987316213.name:                          "vacuum_defer_cleanup_age" => "vacuum_defer_cleanup_age"
      parameter.987316213.value:                         "0" => "0"
      parameter.991909077.apply_method:                  "pending-reboot" => ""
      parameter.991909077.name:                          "backslash_quote" => "backslash_quote"
      parameter.991909077.value:                         "safe_encoding" => "safe_encoding"

  ~ module.NAME_dev_cluster_parameter_group.aws_rds_cluster_parameter_group.postgresql
      parameter.#:                                       "32" => "42"
      parameter.1088520732.apply_method:                 "" => ""
      parameter.1088520732.name:                         "" => "ssl"
      parameter.1088520732.value:                        "" => "1"
      parameter.1124637299.apply_method:                 "" => ""
      parameter.1124637299.name:                         "" => "client_encoding"
      parameter.1124637299.value:                        "" => "UTF8"
      parameter.1215537625.apply_method:                 "pending-reboot" => ""
      parameter.1215537625.name:                         "lc_monetary" => "lc_monetary"
      parameter.1215537625.value:                        "c" => "C"
      parameter.1221875064.apply_method:                 "pending-reboot" => ""
      parameter.1221875064.name:                         "datestyle" => "datestyle"
      parameter.1221875064.value:                        "iso, mdy" => "ISO, MDY"
      parameter.1243608657.apply_method:                 "pending-reboot" => ""
      parameter.1243608657.name:                         "track_commit_timestamp" => "track_commit_timestamp"
      parameter.1243608657.value:                        "0" => "0"
      parameter.135038709.apply_method:                  "pending-reboot" => ""
      parameter.135038709.name:                          "lc_numeric" => "lc_numeric"
      parameter.135038709.value:                         "c" => "C"
      parameter.1513804943.apply_method:                 "pending-reboot" => ""
      parameter.1513804943.name:                         "orafce.timezone" => "orafce.timezone"
      parameter.1513804943.value:                        "utc" => "UTC"
      parameter.1533413219.apply_method:                 "pending-reboot" => ""
      parameter.1533413219.name:                         "default_with_oids" => "default_with_oids"
      parameter.1533413219.value:                        "0" => "0"
      parameter.1548775132.apply_method:                 "pending-reboot" => ""
      parameter.1548775132.name:                         "autovacuum_analyze_scale_factor" => "autovacuum_analyze_scale_factor"
      parameter.1548775132.value:                        "0.01" => "0.01"
      parameter.1600158149.apply_method:                 "pending-reboot" => ""
      parameter.1600158149.name:                         "log_autovacuum_min_duration" => "log_autovacuum_min_duration"
      parameter.1600158149.value:                        "-1" => "-1"
      parameter.1615406913.apply_method:                 "pending-reboot" => ""
      parameter.1615406913.name:                         "vacuum_cost_limit" => "vacuum_cost_limit"
      parameter.1615406913.value:                        "200" => "200"
      parameter.1861664363.apply_method:                 "pending-reboot" => ""
      parameter.1861664363.name:                         "autovacuum_work_mem" => "autovacuum_work_mem"
      parameter.1861664363.value:                        "-1" => "-1"
      parameter.1980051807.apply_method:                 "pending-reboot" => ""
      parameter.1980051807.name:                         "array_nulls" => "array_nulls"
      parameter.1980051807.value:                        "1" => "1"
      parameter.2090939227.apply_method:                 "pending-reboot" => ""
      parameter.2090939227.name:                         "rds.force_autovacuum_logging_level" => "rds.force_autovacuum_logging_level"
      parameter.2090939227.value:                        "disabled" => "disabled"
      parameter.2092812219.apply_method:                 "pending-reboot" => ""
      parameter.2092812219.name:                         "autovacuum_vacuum_threshold" => "autovacuum_vacuum_threshold"
      parameter.2092812219.value:                        "50" => "50"
      parameter.2165550923.apply_method:                 "pending-reboot" => ""
      parameter.2165550923.name:                         "vacuum_freeze_table_age" => "vacuum_freeze_table_age"
      parameter.2165550923.value:                        "150000000" => "150000000"
      parameter.2313469300.apply_method:                 "pending-reboot" => ""
      parameter.2313469300.name:                         "vacuum_multixact_freeze_min_age" => "vacuum_multixact_freeze_min_age"
      parameter.2313469300.value:                        "5000000" => "5000000"
      parameter.2422635300.apply_method:                 "pending-reboot" => ""
      parameter.2422635300.name:                         "autovacuum_multixact_freeze_max_age" => "autovacuum_multixact_freeze_max_age"
      parameter.2422635300.value:                        "400000000" => "400000000"
      parameter.2501266137.apply_method:                 "" => ""
      parameter.2501266137.name:                         "" => "rds.force_ssl"
      parameter.2501266137.value:                        "" => "0"
      parameter.2513129746.apply_method:                 "pending-reboot" => ""
      parameter.2513129746.name:                         "vacuum_freeze_min_age" => "vacuum_freeze_min_age"
      parameter.2513129746.value:                        "50000000" => "50000000"
      parameter.2695200582.apply_method:                 "pending-reboot" => ""
      parameter.2695200582.name:                         "lc_time" => "lc_time"
      parameter.2695200582.value:                        "c" => "C"
      parameter.2720520919.apply_method:                 "pending-reboot" => ""
      parameter.2720520919.name:                         "vacuum_multixact_freeze_table_age" => "vacuum_multixact_freeze_table_age"
      parameter.2720520919.value:                        "150000000" => "150000000"
      parameter.2981320485.apply_method:                 "" => ""
      parameter.2981320485.name:                         "" => "autovacuum_max_workers"
      parameter.2981320485.value:                        "" => "GREATEST({DBInstanceClassMemory/64371566592},3)"
      parameter.3160707358.apply_method:                 "" => ""
      parameter.3160707358.name:                         "" => "autovacuum_vacuum_cost_delay"
      parameter.3160707358.value:                        "" => "5"
      parameter.3204276105.apply_method:                 "" => ""
      parameter.3204276105.name:                         "" => "timezone"
      parameter.3204276105.value:                        "" => "UTC"
      parameter.3309557757.apply_method:                 "" => ""
      parameter.3309557757.name:                         "" => "vacuum_cost_page_miss"
      parameter.3309557757.value:                        "" => "0"
      parameter.3330762744.apply_method:                 "pending-reboot" => ""
      parameter.3330762744.name:                         "intervalstyle" => "intervalstyle"
      parameter.3330762744.value:                        "postgres" => "postgres"
      parameter.3354378144.apply_method:                 "pending-reboot" => ""
      parameter.3354378144.name:                         "autovacuum_vacuum_cost_limit" => "autovacuum_vacuum_cost_limit"
      parameter.3354378144.value:                        "-1" => "-1"
      parameter.3637487751.apply_method:                 "pending-reboot" => ""
      parameter.3637487751.name:                         "vacuum_cost_page_hit" => "vacuum_cost_page_hit"
      parameter.3637487751.value:                        "1" => "1"
      parameter.3812753642.apply_method:                 "pending-reboot" => ""
      parameter.3812753642.name:                         "orafce.nls_date_format" => "orafce.nls_date_format"
      parameter.3812753642.value:                        "default" => "DEFAULT"
      parameter.3923327853.apply_method:                 "" => ""
      parameter.3923327853.name:                         "" => "max_prepared_transactions"
      parameter.3923327853.value:                        "" => "0"
      parameter.4017101848.apply_method:                 "" => ""
      parameter.4017101848.name:                         "" => "autovacuum_naptime"
      parameter.4017101848.value:                        "" => "5"
      parameter.4065324060.apply_method:                 "pending-reboot" => ""
      parameter.4065324060.name:                         "autovacuum_freeze_max_age" => "autovacuum_freeze_max_age"
      parameter.4065324060.value:                        "1000000000" => "1000000000"
      parameter.514936223.apply_method:                  "pending-reboot" => ""
      parameter.514936223.name:                          "wal_buffers" => "wal_buffers"
      parameter.514936223.value:                         "2048" => "2048"
      parameter.522068284.apply_method:                  "" => ""
      parameter.522068284.name:                          "" => "synchronous_commit"
      parameter.522068284.value:                         "" => "on"
      parameter.584376853.apply_method:                  "pending-reboot" => ""
      parameter.584376853.name:                          "autovacuum" => "autovacuum"
      parameter.584376853.value:                         "0" => "0"
      parameter.893742915.apply_method:                  "pending-reboot" => ""
      parameter.893742915.name:                          "autovacuum_analyze_threshold" => "autovacuum_analyze_threshold"
      parameter.893742915.value:                         "50" => "50"
      parameter.916951694.apply_method:                  "pending-reboot" => ""
      parameter.916951694.name:                          "autovacuum_vacuum_scale_factor" => "autovacuum_vacuum_scale_factor"
      parameter.916951694.value:                         "0.01" => "0.01"
      parameter.949234213.apply_method:                  "pending-reboot" => ""
      parameter.949234213.name:                          "extra_float_digits" => "extra_float_digits"
      parameter.949234213.value:                         "0" => "0"
      parameter.966492384.apply_method:                  "pending-reboot" => ""
      parameter.966492384.name:                          "vacuum_cost_delay" => "vacuum_cost_delay"
      parameter.966492384.value:                         "0" => "0"
      parameter.987316213.apply_method:                  "pending-reboot" => ""
      parameter.987316213.name:                          "vacuum_defer_cleanup_age" => "vacuum_defer_cleanup_age"
      parameter.987316213.value:                         "0" => "0"
      parameter.991909077.apply_method:                  "pending-reboot" => ""
      parameter.991909077.name:                          "backslash_quote" => "backslash_quote"
      parameter.991909077.value:                         "safe_encoding" => "safe_encoding"

  ~ module.Name_dev_instance_parameter_group.aws_db_parameter_group.parameter_group
      parameter.#:                                       "90" => "96"
      parameter.1422768260.apply_method:                 "immediate" => "immediate"
      parameter.1422768260.name:                         "search_path" => "search_path"
      parameter.1422768260.value:                        "NAME" => "Name"
      parameter.1451413951.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1451413951.name:                         "deadlock_timeout" => "deadlock_timeout"
      parameter.1451413951.value:                        "1000" => "1000"
      parameter.1502571100.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1502571100.name:                         "default_transaction_isolation" => "default_transaction_isolation"
      parameter.1502571100.value:                        "read committed" => "read committed"
      parameter.1519679918.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1519679918.name:                         "old_snapshot_threshold" => "old_snapshot_threshold"
      parameter.1519679918.value:                        "-1" => "-1"
      parameter.1540839477.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1540839477.name:                         "log_statement_stats" => "log_statement_stats"
      parameter.1540839477.value:                        "0" => "0"
      parameter.1546714764.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1546714764.name:                         "log_connections" => "log_connections"
      parameter.1546714764.value:                        "1" => "1"
      parameter.1572611654.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1572611654.name:                         "debug_print_parse" => "debug_print_parse"
      parameter.1572611654.value:                        "0" => "0"
      parameter.1580387101.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1580387101.name:                         "quote_all_identifiers" => "quote_all_identifiers"
      parameter.1580387101.value:                        "0" => "0"
      parameter.1677698.apply_method:                    "pending-reboot" => "pending-reboot"
      parameter.1677698.name:                            "debug_print_plan" => "debug_print_plan"
      parameter.1677698.value:                           "0" => "0"
      parameter.1828315344.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1828315344.name:                         "tcp_keepalives_interval" => "tcp_keepalives_interval"
      parameter.1828315344.value:                        "30" => "30"
      parameter.1861364783.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1861364783.name:                         "sql_inheritance" => "sql_inheritance"
      parameter.1861364783.value:                        "1" => "1"
      parameter.190646215.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.190646215.name:                          "idle_in_transaction_session_timeout" => "idle_in_transaction_session_timeout"
      parameter.190646215.value:                         "0" => "0"
      parameter.1925698600.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1925698600.name:                         "enable_nestloop" => "enable_nestloop"
      parameter.1925698600.value:                        "1" => "1"
      parameter.1928928487.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1928928487.name:                         "enable_material" => "enable_material"
      parameter.1928928487.value:                        "1" => "1"
      parameter.1932023567.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1932023567.name:                         "standard_conforming_strings" => "standard_conforming_strings"
      parameter.1932023567.value:                        "1" => "1"
      parameter.1975806121.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1975806121.name:                         "backend_flush_after" => "backend_flush_after"
      parameter.1975806121.value:                        "0" => "0"
      parameter.198718064.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.198718064.name:                          "geqo_selection_bias" => "geqo_selection_bias"
      parameter.198718064.value:                         "2" => "2"
      parameter.202186912.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.202186912.name:                          "enable_bitmapscan" => "enable_bitmapscan"
      parameter.202186912.value:                         "1" => "1"
      parameter.2023713159.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2023713159.name:                         "authentication_timeout" => "authentication_timeout"
      parameter.2023713159.value:                        "60" => "60"
      parameter.2151215073.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2151215073.name:                         "replacement_sort_tuples" => "replacement_sort_tuples"
      parameter.2151215073.value:                        "150000" => "150000"
      parameter.2174993032.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2174993032.name:                         "track_activities" => "track_activities"
      parameter.2174993032.value:                        "1" => "1"
      parameter.2202876166.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2202876166.name:                         "enable_indexscan" => "enable_indexscan"
      parameter.2202876166.value:                        "1" => "1"
      parameter.2206000301.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2206000301.name:                         "bgwriter_flush_after" => "bgwriter_flush_after"
      parameter.2206000301.value:                        "0" => "0"
      parameter.2217426290.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2217426290.name:                         "seq_page_cost" => "seq_page_cost"
      parameter.2217426290.value:                        "1" => "1"
      parameter.2221178149.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2221178149.name:                         "log_disconnections" => "log_disconnections"
      parameter.2221178149.value:                        "0" => "0"
      parameter.2225252821.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2225252821.name:                         "geqo_pool_size" => "geqo_pool_size"
      parameter.2225252821.value:                        "0" => "0"
      parameter.2278488613.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2278488613.name:                         "track_activity_query_size" => "track_activity_query_size"
      parameter.2278488613.value:                        "4096" => "4096"
      parameter.2365536252.apply_method:                 "" => "pending-reboot"
      parameter.2365536252.name:                         "" => "rds.log_retention_period"
      parameter.2365536252.value:                        "" => "4320"
      parameter.2392658520.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2392658520.name:                         "min_parallel_relation_size" => "min_parallel_relation_size"
      parameter.2392658520.value:                        "1024" => "1024"
      parameter.2405481796.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2405481796.name:                         "track_io_timing" => "track_io_timing"
      parameter.2405481796.value:                        "0" => "0"
      parameter.2435955495.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2435955495.name:                         "default_statistics_target" => "default_statistics_target"
      parameter.2435955495.value:                        "100" => "100"
      parameter.2476682411.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2476682411.name:                         "log_parser_stats" => "log_parser_stats"
      parameter.2476682411.value:                        "0" => "0"
      parameter.2498869969.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2498869969.name:                         "log_replication_commands" => "log_replication_commands"
      parameter.2498869969.value:                        "0" => "0"
      parameter.2500721510.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2500721510.name:                         "log_executor_stats" => "log_executor_stats"
      parameter.2500721510.value:                        "0" => "0"
      parameter.261177294.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.261177294.name:                          "enable_indexonlyscan" => "enable_indexonlyscan"
      parameter.261177294.value:                         "1" => "1"
      parameter.2678363042.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2678363042.name:                         "geqo" => "geqo"
      parameter.2678363042.value:                        "1" => "1"
      parameter.2718445070.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2718445070.name:                         "log_min_messages" => "log_min_messages"
      parameter.2718445070.value:                        "warning" => "warning"
      parameter.2724075734.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2724075734.name:                         "work_mem" => "work_mem"
      parameter.2724075734.value:                        "10240" => "10240"
      parameter.2728992439.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2728992439.name:                         "bytea_output" => "bytea_output"
      parameter.2728992439.value:                        "hex" => "hex"
      parameter.2785817395.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2785817395.name:                         "force_parallel_mode" => "force_parallel_mode"
      parameter.2785817395.value:                        "0" => "0"
      parameter.2788216241.apply_method:                 "" => "pending-reboot"
      parameter.2788216241.name:                         "" => "max_connections"
      parameter.2788216241.value:                        "" => "LEAST({DBInstanceClassMemory/9531392},5000)"
      parameter.2903879482.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2903879482.name:                         "rds.force_admin_logging_level" => "rds.force_admin_logging_level"
      parameter.2903879482.value:                        "disabled" => "disabled"
      parameter.2908795600.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2908795600.name:                         "cpu_operator_cost" => "cpu_operator_cost"
      parameter.2908795600.value:                        "0.0025" => "0.0025"
      parameter.2914842648.apply_method:                 "" => "pending-reboot"
      parameter.2914842648.name:                         "" => "log_destination"
      parameter.2914842648.value:                        "" => "stderr"
      parameter.3081782084.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3081782084.name:                         "xmlbinary" => "xmlbinary"
      parameter.3081782084.value:                        "base64" => "base64"
      parameter.3103355137.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3103355137.name:                         "tcp_keepalives_count" => "tcp_keepalives_count"
      parameter.3103355137.value:                        "2" => "2"
      parameter.3109900427.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3109900427.name:                         "log_rotation_age" => "log_rotation_age"
      parameter.3109900427.value:                        "1440" => "1440"
      parameter.3162224084.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3162224084.name:                         "max_files_per_process" => "max_files_per_process"
      parameter.3162224084.value:                        "1000" => "1000"
      parameter.3190497616.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3190497616.name:                         "geqo_effort" => "geqo_effort"
      parameter.3190497616.value:                        "5" => "5"
      parameter.3254117251.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3254117251.name:                         "track_counts" => "track_counts"
      parameter.3254117251.value:                        "1" => "1"
      parameter.3280364801.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3280364801.name:                         "log_hostname" => "log_hostname"
      parameter.3280364801.value:                        "0" => "0"
      parameter.333809027.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.333809027.name:                          "max_pred_locks_per_transaction" => "max_pred_locks_per_transaction"
      parameter.333809027.value:                         "64" => "64"
      parameter.3378195295.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3378195295.name:                         "random_page_cost" => "random_page_cost"
      parameter.3378195295.value:                        "4" => "4"
      parameter.3381325933.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3381325933.name:                         "tcp_keepalives_idle" => "tcp_keepalives_idle"
      parameter.3381325933.value:                        "300" => "300"
      parameter.3396398692.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3396398692.name:                         "enable_tidscan" => "enable_tidscan"
      parameter.3396398692.value:                        "1" => "1"
      parameter.3482315670.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3482315670.name:                         "log_temp_files" => "log_temp_files"
      parameter.3482315670.value:                        "0" => "0"
      parameter.3509339723.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3509339723.name:                         "log_lock_waits" => "log_lock_waits"
      parameter.3509339723.value:                        "1" => "1"
      parameter.3512603685.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3512603685.name:                         "gin_pending_list_limit" => "gin_pending_list_limit"
      parameter.3512603685.value:                        "4096" => "4096"
      parameter.3523920282.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3523920282.name:                         "transaction_read_only" => "transaction_read_only"
      parameter.3523920282.value:                        "1" => "1"
      parameter.3647326279.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3647326279.name:                         "shared_buffers" => "shared_buffers"
      parameter.3647326279.value:                        "1048576" => "1048576"
      parameter.3672656680.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3672656680.name:                         "geqo_seed" => "geqo_seed"
      parameter.3672656680.value:                        "0" => "0"
      parameter.3698302546.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3698302546.name:                         "check_function_bodies" => "check_function_bodies"
      parameter.3698302546.value:                        "1" => "1"
      parameter.369889916.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.369889916.name:                          "checkpoint_flush_after" => "checkpoint_flush_after"
      parameter.369889916.value:                         "0" => "0"
      parameter.3760047677.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3760047677.name:                         "enable_hashagg" => "enable_hashagg"
      parameter.3760047677.value:                        "1" => "1"
      parameter.3839588931.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3839588931.name:                         "enable_hashjoin" => "enable_hashjoin"
      parameter.3839588931.value:                        "1" => "1"
      parameter.3855889627.apply_method:                 "" => "pending-reboot"
      parameter.3855889627.name:                         "" => "max_locks_per_transaction"
      parameter.3855889627.value:                        "" => "64"
      parameter.3961608889.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3961608889.name:                         "log_rotation_size" => "log_rotation_size"
      parameter.3961608889.value:                        "0" => "0"
      parameter.4021936831.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4021936831.name:                         "geqo_generations" => "geqo_generations"
      parameter.4021936831.value:                        "0" => "0"
      parameter.4055561836.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4055561836.name:                         "default_transaction_read_only" => "default_transaction_read_only"
      parameter.4055561836.value:                        "0" => "0"
      parameter.4081677535.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4081677535.name:                         "track_functions" => "track_functions"
      parameter.4081677535.value:                        "none" => "none"
      parameter.4093931630.apply_method:                 "" => "pending-reboot"
      parameter.4093931630.name:                         "" => "max_stack_depth"
      parameter.4093931630.value:                        "" => "6144"
      parameter.4117113417.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4117113417.name:                         "enable_mergejoin" => "enable_mergejoin"
      parameter.4117113417.value:                        "1" => "1"
      parameter.4124944092.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4124944092.name:                         "log_planner_stats" => "log_planner_stats"
      parameter.4124944092.value:                        "0" => "0"
      parameter.4149204254.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4149204254.name:                         "max_parallel_workers_per_gather" => "max_parallel_workers_per_gather"
      parameter.4149204254.value:                        "0" => "0"
      parameter.4173698454.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4173698454.name:                         "temp_buffers" => "temp_buffers"
      parameter.4173698454.value:                        "1024" => "1024"
      parameter.4207098182.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4207098182.name:                         "enable_seqscan" => "enable_seqscan"
      parameter.4207098182.value:                        "1" => "1"
      parameter.423680902.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.423680902.name:                          "escape_string_warning" => "escape_string_warning"
      parameter.423680902.value:                         "1" => "1"
      parameter.4241621932.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4241621932.name:                         "transform_null_equals" => "transform_null_equals"
      parameter.4241621932.value:                        "1" => "1"
      parameter.4256552709.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4256552709.name:                         "wal_receiver_status_interval" => "wal_receiver_status_interval"
      parameter.4256552709.value:                        "10" => "10"
      parameter.4259241292.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4259241292.name:                         "constraint_exclusion" => "constraint_exclusion"
      parameter.4259241292.value:                        "partition" => "partition"
      parameter.4268703723.apply_method:                 "" => "pending-reboot"
      parameter.4268703723.name:                         "" => "max_replication_slots"
      parameter.4268703723.value:                        "" => "5"
      parameter.4275856841.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4275856841.name:                         "max_worker_processes" => "max_worker_processes"
      parameter.4275856841.value:                        "8" => "8"
      parameter.461859435.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.461859435.name:                          "update_process_title" => "update_process_title"
      parameter.461859435.value:                         "1" => "1"
      parameter.462964166.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.462964166.name:                          "join_collapse_limit" => "join_collapse_limit"
      parameter.462964166.value:                         "8" => "8"
      parameter.556213951.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.556213951.name:                          "log_statement" => "log_statement"
      parameter.556213951.value:                         "ddl" => "ddl"
      parameter.556535055.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.556535055.name:                          "parallel_setup_cost" => "parallel_setup_cost"
      parameter.556535055.value:                         "1000" => "1000"
      parameter.611083839.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.611083839.name:                          "synchronize_seqscans" => "synchronize_seqscans"
      parameter.611083839.value:                         "1" => "1"
      parameter.751632498.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.751632498.name:                          "log_error_verbosity" => "log_error_verbosity"
      parameter.751632498.value:                         "default" => "default"
      parameter.813687133.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.813687133.name:                          "cursor_tuple_fraction" => "cursor_tuple_fraction"
      parameter.813687133.value:                         "0.1" => "0.1"
      parameter.814782652.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.814782652.name:                          "parallel_tuple_cost" => "parallel_tuple_cost"
      parameter.814782652.value:                         "0.1" => "0.1"
      parameter.855297220.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.855297220.name:                          "cpu_index_tuple_cost" => "cpu_index_tuple_cost"
      parameter.855297220.value:                         "0.005" => "0.005"
      parameter.860462917.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.860462917.name:                          "cpu_tuple_cost" => "cpu_tuple_cost"
      parameter.860462917.value:                         "0.01" => "0.01"
      parameter.934800352.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.934800352.name:                          "statement_timeout" => "statement_timeout"
      parameter.934800352.value:                         "0" => "0"
      parameter.936181157.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.936181157.name:                          "enable_sort" => "enable_sort"
      parameter.936181157.value:                         "1" => "1"
      parameter.939797248.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.939797248.name:                          "client_min_messages" => "client_min_messages"
      parameter.939797248.value:                         "notice" => "notice"
      parameter.976910085.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.976910085.name:                          "from_collapse_limit" => "from_collapse_limit"
      parameter.976910085.value:                         "8" => "8"

  ~ module.NAME_instance_parameter_group.aws_db_parameter_group.parameter_group
      parameter.#:                                       "90" => "96"
      parameter.1422768260.apply_method:                 "immediate" => "immediate"
      parameter.1422768260.name:                         "search_path" => "search_path"
      parameter.1422768260.value:                        "NAME" => "NAME"
      parameter.1451413951.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1451413951.name:                         "deadlock_timeout" => "deadlock_timeout"
      parameter.1451413951.value:                        "1000" => "1000"
      parameter.146525376.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.146525376.name:                          "work_mem" => "work_mem"
      parameter.146525376.value:                         "20480" => "20480"
      parameter.1502571100.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1502571100.name:                         "default_transaction_isolation" => "default_transaction_isolation"
      parameter.1502571100.value:                        "read committed" => "read committed"
      parameter.1519679918.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1519679918.name:                         "old_snapshot_threshold" => "old_snapshot_threshold"
      parameter.1519679918.value:                        "-1" => "-1"
      parameter.1540839477.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1540839477.name:                         "log_statement_stats" => "log_statement_stats"
      parameter.1540839477.value:                        "0" => "0"
      parameter.1546714764.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1546714764.name:                         "log_connections" => "log_connections"
      parameter.1546714764.value:                        "1" => "1"
      parameter.1572611654.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1572611654.name:                         "debug_print_parse" => "debug_print_parse"
      parameter.1572611654.value:                        "0" => "0"
      parameter.1580387101.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1580387101.name:                         "quote_all_identifiers" => "quote_all_identifiers"
      parameter.1580387101.value:                        "0" => "0"
      parameter.1677698.apply_method:                    "pending-reboot" => "pending-reboot"
      parameter.1677698.name:                            "debug_print_plan" => "debug_print_plan"
      parameter.1677698.value:                           "0" => "0"
      parameter.1828315344.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1828315344.name:                         "tcp_keepalives_interval" => "tcp_keepalives_interval"
      parameter.1828315344.value:                        "30" => "30"
      parameter.1861364783.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1861364783.name:                         "sql_inheritance" => "sql_inheritance"
      parameter.1861364783.value:                        "1" => "1"
      parameter.190646215.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.190646215.name:                          "idle_in_transaction_session_timeout" => "idle_in_transaction_session_timeout"
      parameter.190646215.value:                         "0" => "0"
      parameter.1925698600.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1925698600.name:                         "enable_nestloop" => "enable_nestloop"
      parameter.1925698600.value:                        "1" => "1"
      parameter.1928928487.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1928928487.name:                         "enable_material" => "enable_material"
      parameter.1928928487.value:                        "1" => "1"
      parameter.1932023567.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1932023567.name:                         "standard_conforming_strings" => "standard_conforming_strings"
      parameter.1932023567.value:                        "1" => "1"
      parameter.1975806121.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.1975806121.name:                         "backend_flush_after" => "backend_flush_after"
      parameter.1975806121.value:                        "0" => "0"
      parameter.198718064.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.198718064.name:                          "geqo_selection_bias" => "geqo_selection_bias"
      parameter.198718064.value:                         "2" => "2"
      parameter.202186912.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.202186912.name:                          "enable_bitmapscan" => "enable_bitmapscan"
      parameter.202186912.value:                         "1" => "1"
      parameter.2023713159.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2023713159.name:                         "authentication_timeout" => "authentication_timeout"
      parameter.2023713159.value:                        "60" => "60"
      parameter.2151215073.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2151215073.name:                         "replacement_sort_tuples" => "replacement_sort_tuples"
      parameter.2151215073.value:                        "150000" => "150000"
      parameter.2174993032.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2174993032.name:                         "track_activities" => "track_activities"
      parameter.2174993032.value:                        "1" => "1"
      parameter.2175716758.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2175716758.name:                         "shared_buffers" => "shared_buffers"
      parameter.2175716758.value:                        "2097152" => "2097152"
      parameter.2202876166.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2202876166.name:                         "enable_indexscan" => "enable_indexscan"
      parameter.2202876166.value:                        "1" => "1"
      parameter.2206000301.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2206000301.name:                         "bgwriter_flush_after" => "bgwriter_flush_after"
      parameter.2206000301.value:                        "0" => "0"
      parameter.2217426290.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2217426290.name:                         "seq_page_cost" => "seq_page_cost"
      parameter.2217426290.value:                        "1" => "1"
      parameter.2221178149.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2221178149.name:                         "log_disconnections" => "log_disconnections"
      parameter.2221178149.value:                        "0" => "0"
      parameter.2225252821.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2225252821.name:                         "geqo_pool_size" => "geqo_pool_size"
      parameter.2225252821.value:                        "0" => "0"
      parameter.2278488613.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2278488613.name:                         "track_activity_query_size" => "track_activity_query_size"
      parameter.2278488613.value:                        "4096" => "4096"
      parameter.2365536252.apply_method:                 "" => "pending-reboot"
      parameter.2365536252.name:                         "" => "rds.log_retention_period"
      parameter.2365536252.value:                        "" => "4320"
      parameter.2392658520.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2392658520.name:                         "min_parallel_relation_size" => "min_parallel_relation_size"
      parameter.2392658520.value:                        "1024" => "1024"
      parameter.2405481796.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2405481796.name:                         "track_io_timing" => "track_io_timing"
      parameter.2405481796.value:                        "0" => "0"
      parameter.2435955495.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2435955495.name:                         "default_statistics_target" => "default_statistics_target"
      parameter.2435955495.value:                        "100" => "100"
      parameter.2468548634.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2468548634.name:                         "max_parallel_workers_per_gather" => "max_parallel_workers_per_gather"
      parameter.2468548634.value:                        "4" => "4"
      parameter.2476682411.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2476682411.name:                         "log_parser_stats" => "log_parser_stats"
      parameter.2476682411.value:                        "0" => "0"
      parameter.2498869969.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2498869969.name:                         "log_replication_commands" => "log_replication_commands"
      parameter.2498869969.value:                        "0" => "0"
      parameter.2500721510.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2500721510.name:                         "log_executor_stats" => "log_executor_stats"
      parameter.2500721510.value:                        "0" => "0"
      parameter.261177294.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.261177294.name:                          "enable_indexonlyscan" => "enable_indexonlyscan"
      parameter.261177294.value:                         "1" => "1"
      parameter.2678363042.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2678363042.name:                         "geqo" => "geqo"
      parameter.2678363042.value:                        "1" => "1"
      parameter.2718445070.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2718445070.name:                         "log_min_messages" => "log_min_messages"
      parameter.2718445070.value:                        "warning" => "warning"
      parameter.2728992439.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2728992439.name:                         "bytea_output" => "bytea_output"
      parameter.2728992439.value:                        "hex" => "hex"
      parameter.2785817395.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2785817395.name:                         "force_parallel_mode" => "force_parallel_mode"
      parameter.2785817395.value:                        "0" => "0"
      parameter.2788216241.apply_method:                 "" => "pending-reboot"
      parameter.2788216241.name:                         "" => "max_connections"
      parameter.2788216241.value:                        "" => "LEAST({DBInstanceClassMemory/9531392},5000)"
      parameter.2903879482.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2903879482.name:                         "rds.force_admin_logging_level" => "rds.force_admin_logging_level"
      parameter.2903879482.value:                        "disabled" => "disabled"
      parameter.2908795600.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.2908795600.name:                         "cpu_operator_cost" => "cpu_operator_cost"
      parameter.2908795600.value:                        "0.0025" => "0.0025"
      parameter.2914842648.apply_method:                 "" => "pending-reboot"
      parameter.2914842648.name:                         "" => "log_destination"
      parameter.2914842648.value:                        "" => "stderr"
      parameter.3081782084.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3081782084.name:                         "xmlbinary" => "xmlbinary"
      parameter.3081782084.value:                        "base64" => "base64"
      parameter.3103355137.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3103355137.name:                         "tcp_keepalives_count" => "tcp_keepalives_count"
      parameter.3103355137.value:                        "2" => "2"
      parameter.3109900427.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3109900427.name:                         "log_rotation_age" => "log_rotation_age"
      parameter.3109900427.value:                        "1440" => "1440"
      parameter.3162224084.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3162224084.name:                         "max_files_per_process" => "max_files_per_process"
      parameter.3162224084.value:                        "1000" => "1000"
      parameter.3190497616.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3190497616.name:                         "geqo_effort" => "geqo_effort"
      parameter.3190497616.value:                        "5" => "5"
      parameter.3254117251.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3254117251.name:                         "track_counts" => "track_counts"
      parameter.3254117251.value:                        "1" => "1"
      parameter.3280364801.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3280364801.name:                         "log_hostname" => "log_hostname"
      parameter.3280364801.value:                        "0" => "0"
      parameter.333809027.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.333809027.name:                          "max_pred_locks_per_transaction" => "max_pred_locks_per_transaction"
      parameter.333809027.value:                         "64" => "64"
      parameter.3378195295.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3378195295.name:                         "random_page_cost" => "random_page_cost"
      parameter.3378195295.value:                        "4" => "4"
      parameter.3381325933.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3381325933.name:                         "tcp_keepalives_idle" => "tcp_keepalives_idle"
      parameter.3381325933.value:                        "300" => "300"
      parameter.3396398692.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3396398692.name:                         "enable_tidscan" => "enable_tidscan"
      parameter.3396398692.value:                        "1" => "1"
      parameter.3482315670.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3482315670.name:                         "log_temp_files" => "log_temp_files"
      parameter.3482315670.value:                        "0" => "0"
      parameter.3509339723.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3509339723.name:                         "log_lock_waits" => "log_lock_waits"
      parameter.3509339723.value:                        "1" => "1"
      parameter.3512603685.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3512603685.name:                         "gin_pending_list_limit" => "gin_pending_list_limit"
      parameter.3512603685.value:                        "4096" => "4096"
      parameter.3523920282.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3523920282.name:                         "transaction_read_only" => "transaction_read_only"
      parameter.3523920282.value:                        "1" => "1"
      parameter.3548177820.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3548177820.name:                         "max_worker_processes" => "max_worker_processes"
      parameter.3548177820.value:                        "16" => "16"
      parameter.3672656680.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3672656680.name:                         "geqo_seed" => "geqo_seed"
      parameter.3672656680.value:                        "0" => "0"
      parameter.3698302546.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3698302546.name:                         "check_function_bodies" => "check_function_bodies"
      parameter.3698302546.value:                        "1" => "1"
      parameter.369889916.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.369889916.name:                          "checkpoint_flush_after" => "checkpoint_flush_after"
      parameter.369889916.value:                         "0" => "0"
      parameter.3760047677.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3760047677.name:                         "enable_hashagg" => "enable_hashagg"
      parameter.3760047677.value:                        "1" => "1"
      parameter.3839588931.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3839588931.name:                         "enable_hashjoin" => "enable_hashjoin"
      parameter.3839588931.value:                        "1" => "1"
      parameter.3855889627.apply_method:                 "" => "pending-reboot"
      parameter.3855889627.name:                         "" => "max_locks_per_transaction"
      parameter.3855889627.value:                        "" => "64"
      parameter.3961608889.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.3961608889.name:                         "log_rotation_size" => "log_rotation_size"
      parameter.3961608889.value:                        "0" => "0"
      parameter.4021936831.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4021936831.name:                         "geqo_generations" => "geqo_generations"
      parameter.4021936831.value:                        "0" => "0"
      parameter.4055561836.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4055561836.name:                         "default_transaction_read_only" => "default_transaction_read_only"
      parameter.4055561836.value:                        "0" => "0"
      parameter.4081677535.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4081677535.name:                         "track_functions" => "track_functions"
      parameter.4081677535.value:                        "none" => "none"
      parameter.4093931630.apply_method:                 "" => "pending-reboot"
      parameter.4093931630.name:                         "" => "max_stack_depth"
      parameter.4093931630.value:                        "" => "6144"
      parameter.4117113417.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4117113417.name:                         "enable_mergejoin" => "enable_mergejoin"
      parameter.4117113417.value:                        "1" => "1"
      parameter.4124944092.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4124944092.name:                         "log_planner_stats" => "log_planner_stats"
      parameter.4124944092.value:                        "0" => "0"
      parameter.4173698454.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4173698454.name:                         "temp_buffers" => "temp_buffers"
      parameter.4173698454.value:                        "1024" => "1024"
      parameter.4207098182.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4207098182.name:                         "enable_seqscan" => "enable_seqscan"
      parameter.4207098182.value:                        "1" => "1"
      parameter.423680902.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.423680902.name:                          "escape_string_warning" => "escape_string_warning"
      parameter.423680902.value:                         "1" => "1"
      parameter.4241621932.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4241621932.name:                         "transform_null_equals" => "transform_null_equals"
      parameter.4241621932.value:                        "1" => "1"
      parameter.4256552709.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4256552709.name:                         "wal_receiver_status_interval" => "wal_receiver_status_interval"
      parameter.4256552709.value:                        "10" => "10"
      parameter.4259241292.apply_method:                 "pending-reboot" => "pending-reboot"
      parameter.4259241292.name:                         "constraint_exclusion" => "constraint_exclusion"
      parameter.4259241292.value:                        "partition" => "partition"
      parameter.4268703723.apply_method:                 "" => "pending-reboot"
      parameter.4268703723.name:                         "" => "max_replication_slots"
      parameter.4268703723.value:                        "" => "5"
      parameter.461859435.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.461859435.name:                          "update_process_title" => "update_process_title"
      parameter.461859435.value:                         "1" => "1"
      parameter.462964166.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.462964166.name:                          "join_collapse_limit" => "join_collapse_limit"
      parameter.462964166.value:                         "8" => "8"
      parameter.556213951.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.556213951.name:                          "log_statement" => "log_statement"
      parameter.556213951.value:                         "ddl" => "ddl"
      parameter.556535055.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.556535055.name:                          "parallel_setup_cost" => "parallel_setup_cost"
      parameter.556535055.value:                         "1000" => "1000"
      parameter.611083839.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.611083839.name:                          "synchronize_seqscans" => "synchronize_seqscans"
      parameter.611083839.value:                         "1" => "1"
      parameter.751632498.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.751632498.name:                          "log_error_verbosity" => "log_error_verbosity"
      parameter.751632498.value:                         "default" => "default"
      parameter.813687133.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.813687133.name:                          "cursor_tuple_fraction" => "cursor_tuple_fraction"
      parameter.813687133.value:                         "0.1" => "0.1"
      parameter.814782652.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.814782652.name:                          "parallel_tuple_cost" => "parallel_tuple_cost"
      parameter.814782652.value:                         "0.1" => "0.1"
      parameter.855297220.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.855297220.name:                          "cpu_index_tuple_cost" => "cpu_index_tuple_cost"
      parameter.855297220.value:                         "0.005" => "0.005"
      parameter.860462917.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.860462917.name:                          "cpu_tuple_cost" => "cpu_tuple_cost"
      parameter.860462917.value:                         "0.01" => "0.01"
      parameter.934800352.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.934800352.name:                          "statement_timeout" => "statement_timeout"
      parameter.934800352.value:                         "0" => "0"
      parameter.936181157.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.936181157.name:                          "enable_sort" => "enable_sort"
      parameter.936181157.value:                         "1" => "1"
      parameter.939797248.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.939797248.name:                          "client_min_messages" => "client_min_messages"
      parameter.939797248.value:                         "notice" => "notice"
      parameter.976910085.apply_method:                  "pending-reboot" => "pending-reboot"
      parameter.976910085.name:                          "from_collapse_limit" => "from_collapse_limit"
      parameter.976910085.value:                         "8" => "8"

cluster-parameter-group-main.tf:

provider "aws" {
  region = "${var.region}"
}

resource "aws_rds_cluster_parameter_group" "postgresql" {
  name        = "${var.name}"
  family      = "${var.family}"
  description = "${var.description}"

  lifecycle {
    ignore_changes = ["name", "description"]
  }

  parameter {
    name         = "array_nulls"
    value        = "${var.array_nulls}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "autovacuum"
    value        = "${var.autovacuum}"
    apply_method = "pending-reboot"

  }
  parameter {
    name         = "autovacuum_analyze_scale_factor"
    value        = "${var.autovacuum_analyze_scale_factor}"
    apply_method = "pending-reboot"

  }
  parameter {
    name         = "autovacuum_analyze_threshold"
    value        = "${var.autovacuum_analyze_threshold}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "autovacuum_freeze_max_age"
    value        = "${var.autovacuum_freeze_max_age}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "autovacuum_max_workers"
    value        = "${var.autovacuum_max_workers}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "autovacuum_multixact_freeze_max_age"
    value        = "${var.autovacuum_multixact_freeze_max_age}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "autovacuum_naptime"
    value        = "${var.autovacuum_naptime}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "autovacuum_vacuum_cost_delay"
    value        = "${var.autovacuum_vacuum_cost_delay}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "autovacuum_vacuum_cost_limit"
    value        = "${var.autovacuum_vacuum_cost_limit}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "autovacuum_vacuum_scale_factor"
    value        = "${var.autovacuum_vacuum_scale_factor}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "autovacuum_vacuum_threshold"
    value        = "${var.autovacuum_vacuum_threshold}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "autovacuum_work_mem"
    value        = "${var.autovacuum_work_mem}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "backslash_quote"
    value        = "${var.backslash_quote}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "client_encoding"
    value        = "${var.client_encoding}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "datestyle"
    value        = "${var.datestyle}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "default_with_oids"
    value        = "${var.default_with_oids}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "extra_float_digits"
    value        = "${var.extra_float_digits}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "intervalstyle"
    value        = "${var.intervalstyle}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "lc_monetary"
    value        = "${var.lc_monetary}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "lc_numeric"
    value        = "${var.lc_numeric}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "lc_time"
    value        = "${var.lc_time}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "log_autovacuum_min_duration"
    value        = "${var.log_autovacuum_min_duration}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "max_prepared_transactions"
    value        = "${var.max_prepared_transactions}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "orafce.nls_date_format"
    value        = "${var.orafce-nls_date_format}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "orafce.timezone"
    value        = "${var.orafce-timezone}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "rds.force_autovacuum_logging_level"
    value        = "${var.rds-force_autovacuum_logging_level}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "rds.force_ssl"
    value        = "${var.rds-force_ssl}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "ssl"
    value        = "${var.ssl}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "synchronous_commit"
    value        = "${var.synchronous_commit}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "timezone"
    value        = "${var.timezone}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "track_commit_timestamp"
    value        = "${var.track_commit_timestamp}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "vacuum_cost_delay"
    value        = "${var.vacuum_cost_delay}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "vacuum_cost_limit"
    value        = "${var.vacuum_cost_limit}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "vacuum_cost_page_hit"
    value        = "${var.vacuum_cost_page_hit}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "vacuum_cost_page_miss"
    value        = "${var.vacuum_cost_page_miss}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "vacuum_defer_cleanup_age"
    value        = "${var.vacuum_defer_cleanup_age}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "vacuum_freeze_min_age"
    value        = "${var.vacuum_freeze_min_age}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "vacuum_freeze_table_age"
    value        = "${var.vacuum_freeze_table_age}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "vacuum_multixact_freeze_min_age"
    value        = "${var.vacuum_multixact_freeze_min_age}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "vacuum_multixact_freeze_table_age"
    value        = "${var.vacuum_multixact_freeze_table_age}"
    apply_method = "pending-reboot"
  }
  parameter {
    name         = "wal_buffers"
    value        = "${var.wal_buffers}"
    apply_method = "pending-reboot"
  }
}

output "cluster_parameter_group" {
  value = "${aws_rds_cluster_parameter_group.postgresql.name}"
}```

instance-parameter-group-main.tf
```terraform
provider "aws" {
  region = "${var.region}"
}
resource "aws_db_parameter_group" "parameter_group" {

  name        = "${var.name}"
  family      = "${var.family}"
  description = "${var.description}"

  lifecycle {
    ignore_changes = ["name", "description"]
  }

  parameter {
    name         = "authentication_timeout"
    value        = "${var.authentication_timeout}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "backend_flush_after"
    value        = "${var.backend_flush_after}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "bgwriter_flush_after"
    value        = "${var.bgwriter_flush_after}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "bytea_output"
    value        = "${var.bytea_output}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "check_function_bodies"
    value        = "${var.check_function_bodies}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "checkpoint_flush_after"
    value        = "${var.checkpoint_flush_after}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "client_min_messages"
    value        = "${var.client_min_messages}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "constraint_exclusion"
    value        = "${var.constraint_exclusion}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "cpu_index_tuple_cost"
    value        = "${var.cpu_index_tuple_cost}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "cpu_operator_cost"
    value        = "${var.cpu_operator_cost}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "cpu_tuple_cost"
    value        = "${var.cpu_tuple_cost}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "cursor_tuple_fraction"
    value        = "${var.cursor_tuple_fraction}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "deadlock_timeout"
    value        = "${var.deadlock_timeout}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "debug_pretty_print"
//    value        = "${var.debug_pretty_print}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "debug_print_parse"
    value        = "${var.debug_print_parse}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "debug_print_plan"
    value        = "${var.debug_print_plan}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "debug_print_rewritten"
//    value        = "${var.debug_print_rewritten}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "default_statistics_target"
    value        = "${var.default_statistics_target}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "default_transaction_deferrable"
//    value        = "${var.default_transaction_deferrable}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "default_transaction_isolation"
    value        = "${var.default_transaction_isolation}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "default_transaction_read_only"
    value        = "${var.default_transaction_read_only}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "effective_cache_size"
//    value        = "${var.effective_cache_size}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "enable_bitmapscan"
    value        = "${var.enable_bitmapscan}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "enable_hashagg"
    value        = "${var.enable_hashagg}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "enable_hashjoin"
    value        = "${var.enable_hashjoin}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "enable_indexonlyscan"
    value        = "${var.enable_indexonlyscan}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "enable_indexscan"
    value        = "${var.enable_indexscan}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "enable_material"
    value        = "${var.enable_material}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "enable_mergejoin"
    value        = "${var.enable_mergejoin}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "enable_nestloop"
    value        = "${var.enable_nestloop}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "enable_seqscan"
    value        = "${var.enable_seqscan}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "enable_sort"
    value        = "${var.enable_sort}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "enable_tidscan"
    value        = "${var.enable_tidscan}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "escape_string_warning"
    value        = "${var.escape_string_warning}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "force_parallel_mode"
    value        = "${var.force_parallel_mode}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "from_collapse_limit"
    value        = "${var.from_collapse_limit}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "geqo"
    value        = "${var.geqo}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "geqo_effort"
    value        = "${var.geqo_effort}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "geqo_generations"
    value        = "${var.geqo_generations}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "geqo_pool_size"
    value        = "${var.geqo_pool_size}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "geqo_seed"
    value        = "${var.geqo_seed}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "geqo_selection_bias"
    value        = "${var.geqo_selection_bias}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "geqo_threshold"
//    value        = "${var.geqo_threshold}"
//    apply_method = "pending-reboot"
//  }

//  parameter {
//    name         = "gin_fuzzy_search_limit"
//    value        = "${var.gin_fuzzy_search_limit}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "gin_pending_list_limit"
    value        = "${var.gin_pending_list_limit}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "idle_in_transaction_session_timeout"
    value        = "${var.idle_in_transaction_session_timeout}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "join_collapse_limit"
    value        = "${var.join_collapse_limit}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_connections"
    value        = "${var.log_connections}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_destination"
    value        = "${var.log_destination}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_disconnections"
    value        = "${var.log_disconnections}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "log_duration"
//    value        = "${var.log_duration}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "log_error_verbosity"
    value        = "${var.log_error_verbosity}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_executor_stats"
    value        = "${var.log_executor_stats}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "log_filename"
//    value        = "${var.log_filename}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "log_hostname"
    value        = "${var.log_hostname}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_lock_waits"
    value        = "${var.log_lock_waits}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "log_min_duration_statement"
//    value        = "${var.log_min_duration_statement}"
//    apply_method = "pending-reboot"
//  }

//  parameter {
//    name         = "log_min_error_statement"
//    value        = "${var.log_min_error_statement}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "log_min_messages"
    value        = "${var.log_min_messages}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_parser_stats"
    value        = "${var.log_parser_stats}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_planner_stats"
    value        = "${var.log_planner_stats}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_replication_commands"
    value        = "${var.log_replication_commands}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_rotation_age"
    value        = "${var.log_rotation_age}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_rotation_size"
    value        = "${var.log_rotation_size}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_statement"
    value        = "${var.log_statement}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_statement_stats"
    value        = "${var.log_statement_stats}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "log_temp_files"
    value        = "${var.log_temp_files}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "maintenance_work_mem"
//    value        = "${var.maintenance_work_mem}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "max_connections"
    value        = "${var.max_connections}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "max_files_per_process"
    value        = "${var.max_files_per_process}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "max_locks_per_transaction"
    value        = "${var.max_locks_per_transaction}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "max_parallel_workers_per_gather"
    value        = "${var.max_parallel_workers_per_gather}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "max_pred_locks_per_transaction"
    value        = "${var.max_pred_locks_per_transaction}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "max_replication_slots"
    value        = "${var.max_replication_slots}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "max_stack_depth"
    value        = "${var.max_stack_depth}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "max_wal_senders"
//    value        = "${var.max_wal_senders}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "max_worker_processes"
    value        = "${var.max_worker_processes}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "min_parallel_relation_size"
    value        = "${var.min_parallel_relation_size}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "old_snapshot_threshold"
    value        = "${var.old_snapshot_threshold}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "operator_precedence_warning"
//    value        = "${var.operator_precedence_warning}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "parallel_setup_cost"
    value        = "${var.parallel_setup_cost}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "parallel_tuple_cost"
    value        = "${var.parallel_tuple_cost}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "quote_all_identifiers"
    value        = "${var.quote_all_identifiers}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "random_page_cost"
    value        = "${var.random_page_cost}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "rds.force_admin_logging_level"
    value        = "${var.rds-force_admin_logging_level}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "rds.log_retention_period"
    value        = "${var.rds-log_retention_period}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "rds.rds_superuser_reserved_connections"
//    value        = "${var.rds-rds_superuser_reserved_connections}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "replacement_sort_tuples"
    value        = "${var.replacement_sort_tuples}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "row_security"
//    value        = "${var.row_security}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "search_path"
    value        = "${var.search_path}"
    apply_method = "immediate"
  }

  parameter {
    name         = "seq_page_cost"
    value        = "${var.seq_page_cost}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "session_replication_role"
//    value        = "${var.session_replication_role}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "shared_buffers"
    value        = "${var.shared_buffers}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "shared_preload_libraries"
//    value        = "${var.shared_preload_libraries}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "sql_inheritance"
    value        = "${var.sql_inheritance}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "standard_conforming_strings"
    value        = "${var.standard_conforming_strings}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "statement_timeout"
    value        = "${var.statement_timeout}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "synchronize_seqscans"
    value        = "${var.synchronize_seqscans}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "tcp_keepalives_count"
    value        = "${var.tcp_keepalives_count}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "tcp_keepalives_idle"
    value        = "${var.tcp_keepalives_idle}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "tcp_keepalives_interval"
    value        = "${var.tcp_keepalives_interval}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "temp_buffers"
    value        = "${var.temp_buffers}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "temp_tablespaces"
//    value        = "${var.temp_tablespaces}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "track_activities"
    value        = "${var.track_activities}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "track_activity_query_size"
    value        = "${var.track_activity_query_size}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "track_counts"
    value        = "${var.track_counts}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "track_functions"
    value        = "${var.track_functions}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "track_io_timing"
    value        = "${var.track_io_timing}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "transaction_deferrable"
//    value        = "${var.transaction_deferrable}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "transaction_read_only"
    value        = "${var.transaction_read_only}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "transform_null_equals"
    value        = "${var.transform_null_equals}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "update_process_title"
    value        = "${var.update_process_title}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "wal_receiver_status_interval"
    value        = "${var.wal_receiver_status_interval}"
    apply_method = "pending-reboot"
  }
//
//  parameter {
//    name         = "wal_receiver_timeout"
//    value        = "${var.wal_receiver_timeout}"
//    apply_method = "pending-reboot"
//  }

//  parameter {
//    name         = "wal_sender_timeout"
//    value        = "${var.wal_sender_timeout}"
//    apply_method = "pending-reboot"
//  }

  parameter {
    name         = "work_mem"
    value        = "${var.work_mem}"
    apply_method = "pending-reboot"
  }

  parameter {
    name         = "xmlbinary"
    value        = "${var.xmlbinary}"
    apply_method = "pending-reboot"
  }

//  parameter {
//    name         = "xmloption"
//    value        = "${var.xmloption}"
//    apply_method = "pending-reboot"
//  }
}

output "instance_parameter_group" {
  value = "${aws_db_parameter_group.parameter_group.name}"
}

Terraform versions:

Terraform v0.11.7
+ provider.aws v1.8.0

invalid or unknown key: deletion_protection

terraform plan will complain using v1.22.0:

Error: module.my_rds_postgres.module.db_instance.aws_db_instance.this: : invalid or unknown key: deletion_protection

but v1.21.0 would pass without error.

Can't pass an already existing db_subnet_group: `value of 'count' cannot be computed`

Hi,

As for this change it is impossible to pass a resource/data's derived subnet_group_id to this current module, it throws:

aws_db_subnet_group.this: value of 'count' cannot be computed

Example, taking the already existing example from the RDS module itself:

provider "aws" {
  region = "eu-west-1"
}

##############################################################
# Data sources to get VPC, subnets and security group details
##############################################################
data "aws_vpc" "default" {
  default = true
}

data "aws_security_group" "default" {
  vpc_id = "${data.aws_vpc.default.id}"
  name   = "default"
}

data "aws_subnet_ids" "all" {
  vpc_id = "${data.aws_vpc.default.id}"
}

// Added for this issue purposes:
resource "aws_db_subnet_group" "this" {
  name_prefix = "my_db_subnet_group"
  subnet_ids  = ["${data.aws_subnet_ids.all.ids}"]
}

#####
# DB
#####
module "db" {
  source  = "terraform-aws-modules/rds/aws"
  version = "1.13.0"

  identifier = "demodb"

  # All available versions: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.VersionMgmt
  engine            = "mysql"
  engine_version    = "5.7.19"
  instance_class    = "db.t2.large"
  allocated_storage = 5
  storage_encrypted = false

  # kms_key_id        = "arm:aws:kms:<region>:<accound id>:key/<kms key id>"
  name     = "demodb"
  username = "user"
  password = "YourPwdShouldBeLongAndSecure!"
  port     = "3306"

  vpc_security_group_ids = ["${data.aws_security_group.default.id}"]

  maintenance_window = "Mon:00:00-Mon:03:00"
  backup_window      = "03:00-06:00"

  # disable backups to create DB faster
  backup_retention_period = 0

  tags = {
    Owner       = "user"
    Environment = "dev"
  }

  # DB subnet group
  # Disable automatic db_subnet_group creation, as we want to pass one that already exists:
  create_db_subnet_group = false
  db_subnet_group_name   = "${aws_db_subnet_group.this.id}"

  # DB parameter group
  family = "mysql5.7"

  # Snapshot name upon DB deletion
  final_snapshot_identifier = "demodb"
}

When runing terraform plan:

$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.aws_vpc.default: Refreshing state...
data.aws_subnet_ids.all: Refreshing state...
data.aws_security_group.default: Refreshing state...

------------------------------------------------------------------------

Error: Error running plan: 1 error(s) occurred:

* module.db.module.db_subnet_group.aws_db_subnet_group.this: aws_db_subnet_group.this: value of 'count' cannot be computed

So reusing a DB subnet group is impossible.

Facing problem After creating rds with snapshot.

After terraform apply with snapshot, when I am doing terraform plan for second time its giving below error

  • module.rds_xyz.module.db.module.db_instance.local.this_db_instance_password: local.this_db_instance_password: Resource 'aws_db_instance.this' does not have attribute 'password' for variable 'aws_db_instance.this.*.password'

Note: I am passing username and password blank, as I am restoring it

parameter_group_name expects string but receives a list

Error: Error refreshing state: 1 error(s) occurred: * module.production.module.db.module.db_instance.var.parameter_group_name: variable parameter_group_name in module production.db.db_instance should be type string, got list

Terraform version:
Terraform v0.11.1

  • provider.aws v1.5.0

db_subnet_group support for name?

Hi, I see that the db_subnet_group module only support name_prefix and not name. Can you shed some lights on that decision? I could probably create manually my db subnet group and pass its name to db_subnet_group_name, but is it recommended to have a db subnet group per rds instance, hence why name_prefix is only supported?

Thanks!

sqlserver-ex database instances must have "null" name

The engine type sqlserver-ex only supports a single database and thus does not have a DBName (as reported by terraform) - that value must be null.

I was able to work around this issue by forking the module and commenting out the name in resource "aws_db_instance" "this_mssql" for now.

Cannot modify existing RDS instance

Description
Applying the multi_az setting on an existing RDS instance does not work.

Procedure

  1. Create a mysql instance using the following code:
module "db" {
  source = "terraform-aws-modules/rds/aws"
  identifier = "somedb"

  engine            = "mysql"
  engine_version    = "5.6.27"
  instance_class    = "db.t2.small"
  allocated_storage = 20
  storage_encrypted = false

  maintenance_window = "Mon:00:00-Mon:03:00"
  backup_window      = "03:00-06:00"

  backup_retention_period = 0


  family = "mysql5.6"
  major_engine_version = "5.6"

  name     = "somedb"
  username = "${var.mysql_username}"
  password = "${var.mysql_password}"
  port     = "3306"

  subnet_ids = "${data.terraform_remote_state.shared_resources.private_subnets}"
  vpc_security_group_ids =  ["${data.aws_security_group.default.id}"]

  tags = {
    Terraform = "true"
    Environment = "${terraform.workspace}"
  }
}
  1. terraform plan && terraform apply
  2. Modify the existing resource:
module "db" {
  source = "terraform-aws-modules/rds/aws"
  identifier = "somedb"

  engine            = "mysql"
  engine_version    = "5.6.27"
  instance_class    = "db.t2.small"
  allocated_storage = 20
  storage_encrypted = false

  maintenance_window = "Mon:00:00-Mon:03:00"
  backup_window      = "03:00-06:00"

  backup_retention_period = 7
  multi_az = true


  family = "mysql5.6"
  major_engine_version = "5.6"

  name     = "somedb"
  username = "${var.mysql_username}"
  password = "${var.mysql_password}"
  port     = "3306"

  subnet_ids = "${data.terraform_remote_state.shared_resources.private_subnets}"
  vpc_security_group_ids =  ["${data.aws_security_group.default.id}"]

  tags = {
    Terraform = "true"
    Environment = "${terraform.workspace}"
  }
}
  1. repeat step 2

Expected behavior
The DB has multi_az enabled.

Actual behavior
multi_az is still disabled even though terraform reported that the command executed successfully

kms_key_id should be named kms_key_arn

The aws_kms_key resource have to outputs: key_id and arn. I got confused by the naming of the arg kms_key_id in this module because it's not the key_id of aws_kms_key but the arn (at least that's what I understood from the error message).

Example:

resource "aws_kms_key" "my_key" {
  description = "my key"
}

module "db" {
  source = "terraform-aws-modules/rds/aws"

  # fails:
  kms_key_id = "${aws_kms_key.my_key.key_id}"
  # works
  kms_key_id = "${aws_kms_key.my_key.arn}"
  [...]
}

Would it make sense to rename kms_key_id to kms_key_arn? Or am I perhaps doing something completely wrong here?

Invalid Required Arguments

module "db1" {
  source = "terraform-aws-modules/rds/aws"

  identifier = "dev-rds"

  engine         = "aurora-mysql"
  instance_class = "db.r4.large"

  username = "username"
  password = "password"
  port     = "3306"

  iam_database_authentication_enabled = true

  vpc_security_group_ids = ["${module.db1_secgrp.this_security_group_id}"]
  subnet_ids             = "$module.vpc.database_subnets"

  maintenance_window = "Mon:00:00-Mon:03:00"
  backup_window      = "03:00-06:00"
}

Returns

Error: module "db1": missing required argument "allocated_storage"
Error: module "db1": missing required argument "engine_version"

Neither of those are actually used arguments when deploying a Aurora Instance.

aws_db_instance - allocated_storage and snapshot_identifier invalid combination

I have an RDS PostgreSQL created in terraform that was created from a snapshot using the snapshot_identifier parameter. This correctly set the allocated_storage to be the same as the snapshot. I now need to increase the allocated storage because the database has grown, however, providing a parameter for allocated-storage gives me an error. "allocated_storage" is not a valid argument.

I want my terraform code to reflect my infrastructure so was expecting this to detect that the allocated storage needed to be updated. At the moment my option is to just change the storage in the AWS console but that goes against infrastructure as code. Just want to know whether you think this is an issue or whether it is by design. Thanks in advance.

support for point in time restore aws api for aws rds

Hi:
I am using the terraform-aws-rds module for one of our terraform project at work and recently have been looking into support for restore of aws rds (postgres specifically) using snapshot and PITR (point in time restore) api's that aws provides. terraform-aws-rds module today already support snapshot based restore but not PITR agreeably because terraform-provider-aws also does have have PITR support today.
I have opened this issue on git hub for the same for terraform-provider-aws: hashicorp/terraform-provider-aws#5286

Can someone share details on how I can contribute to the terraform-aws-rds module or if someone can provide support below PITR feature. Did not see any instructions to contribute on the terraform-modules github page. May be I can copy the module locally and make changes there?

Here are more details:

Beyond adding relevant code in terraform-provider-aws in this go file for PITR, I realized that I need to also update the terraform-aws-rds module that I am consuming to recognize the new variables that I need to support for PIRT.

This is a draft version of changes I am playing with in the resource_aws_db_instance.go on my local machine. As you can see I basically added four new arguments
SourceDBInstanceIdentifier: aws.String(d.Get("source_db_instance_identifier").(string)), TargetDBInstanceIdentifier: aws.String(d.Get("target_db_instance_dentifier").(string)), UseLatestRestorableTime: aws.Bool(d.Get("use_latest_restorable_time").(bool)), RestoreTime: aws.Time(d.Get("restore_time").(time.Time)),

And got rid of below that's required for snapshot based restore.
// DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), // DBSnapshotIdentifier: aws.String(d.Get("snapshot_identifier").(string)),

Potential change to support PITR:

else if _, ok := d.GetOk("source_db_instance_identifier"); ok {

	//opts := rds.RestoreDBInstanceFromDBSnapshotInput{
	//	DBInstanceClass:         aws.String(d.Get("instance_class").(string)),
	//	DBInstanceIdentifier:    aws.String(d.Get("identifier").(string)),
	//	DBSnapshotIdentifier:    aws.String(d.Get("snapshot_identifier").(string)),
	//	AutoMinorVersionUpgrade: aws.Bool(d.Get("auto_minor_version_upgrade").(bool)),
	//	PubliclyAccessible:      aws.Bool(d.Get("publicly_accessible").(bool)),
	//	Tags:                    tags,
	//	CopyTagsToSnapshot:      aws.Bool(d.Get("copy_tags_to_snapshot").(bool)),
	//}

	opts := rds.RestoreDBInstanceToPointInTimeInput{
		DBInstanceClass:         	aws.String(d.Get("instance_class").(string)),
		SourceDBInstanceIdentifier: aws.String(d.Get("source_db_instance_identifier").(string)),
		TargetDBInstanceIdentifier: aws.String(d.Get("target_db_instance_dentifier").(string)),
		UseLatestRestorableTime:	aws.Bool(d.Get("use_latest_restorable_time").(bool)),
		RestoreTime:				aws.Time(d.Get("restore_time").(time.Time)),
		AutoMinorVersionUpgrade: 	aws.Bool(d.Get("auto_minor_version_upgrade").(bool)),
		PubliclyAccessible:      	aws.Bool(d.Get("publicly_accessible").(bool)),
		Tags:                    	tags,
		CopyTagsToSnapshot:      	aws.Bool(d.Get("copy_tags_to_snapshot").(bool)),
	}

	if attr, ok := d.GetOk("name"); ok {
		// "Note: This parameter [DBName] doesn't apply to the MySQL, PostgreSQL, or MariaDB engines."
		// https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceToPointInTime.html
		switch strings.ToLower(d.Get("engine").(string)) {
		case "mysql", "postgres", "mariadb":
			// skip
		default:
			opts.DBName = aws.String(attr.(string))
		}
	}

	if attr, ok := d.GetOk("availability_zone"); ok {
		opts.AvailabilityZone = aws.String(attr.(string))
	}

	if attr, ok := d.GetOk("db_subnet_group_name"); ok {
		opts.DBSubnetGroupName = aws.String(attr.(string))
	}

	if attr, ok := d.GetOk("enabled_cloudwatch_logs_exports"); ok && len(attr.([]interface{})) > 0 {
		opts.EnableCloudwatchLogsExports = expandStringList(attr.([]interface{}))
	}

	if attr, ok := d.GetOk("engine"); ok {
		opts.Engine = aws.String(attr.(string))
	}

	if attr, ok := d.GetOk("iops"); ok {
		opts.Iops = aws.Int64(int64(attr.(int)))
	}

	if attr, ok := d.GetOk("license_model"); ok {
		opts.LicenseModel = aws.String(attr.(string))
	}

	if attr, ok := d.GetOk("multi_az"); ok {
		opts.MultiAZ = aws.Bool(attr.(bool))
	}

	if attr, ok := d.GetOk("option_group_name"); ok {
		opts.OptionGroupName = aws.String(attr.(string))
	}

	if attr, ok := d.GetOk("port"); ok {
		opts.Port = aws.Int64(int64(attr.(int)))
	}
	if attr, ok := d.GetOk("tde_credential_arn"); ok {
		opts.TdeCredentialArn = aws.String(attr.(string))
	}

	if attr, ok := d.GetOk("storage_type"); ok {
		opts.StorageType = aws.String(attr.(string))
	}

	//log.Printf("[DEBUG] DB Instance restore from snapshot configuration: %s", opts)
	//_, err := conn.RestoreDBInstanceFromDBSnapshot(&opts)
	//if err != nil {
	//	return fmt.Errorf("Error creating DB Instance: %s", err)
	//}

	log.Printf("[DEBUG] DB Instance restore to point in time configuration: %s", opts)
	_, err := conn.RestoreDBInstanceToPointInTime(&opts)
	if err != nil {
		return fmt.Errorf("Error creating DB Instance: %s", err)
	}

	var sgUpdate bool
	var passwordUpdate bool

	if _, ok := d.GetOk("password"); ok {
		passwordUpdate = true
	}

	if attr := d.Get("vpc_security_group_ids").(*schema.Set); attr.Len() > 0 {
		sgUpdate = true
	}
	if attr := d.Get("security_group_names").(*schema.Set); attr.Len() > 0 {
		sgUpdate = true
	}
	if sgUpdate || passwordUpdate {
		log.Printf("[INFO] DB is restoring to user requested point in time with default" +
			" security, but custom security should be set, " +
			"will now update after point in time restore is complete!")

		// wait for instance to get up and then modify security
		d.SetId(d.Get("target_db_instance_identifier").(string))

		log.Printf("[INFO] DB Instance ID: %s", d.Id())

		log.Println(
			"[INFO] Waiting for DB Instance to be available")

		stateConf := &resource.StateChangeConf{
			Pending:    resourceAwsDbInstanceCreatePendingStates,
			Target:     []string{"available", "storage-optimization"},
			Refresh:    resourceAwsDbInstanceStateRefreshFunc(d.Id(), conn),
			Timeout:    d.Timeout(schema.TimeoutCreate),
			MinTimeout: 10 * time.Second,
			Delay:      30 * time.Second, // Wait 30 secs before starting
		}

		// Wait, catching any errors
		_, err := stateConf.WaitForState()
		if err != nil {
			return err
		}
		err = resourceAwsDbInstanceUpdate(d, meta)
		if err != nil {
			return err
		}
	}
} 

My terragrunt plan is now failing as the terraform-aws-rds modules does not recognize the new parameters I introduced to support PITR and also complaining about the identifier that's not required for PIRT unless I replace target_db_instance_identifier as identifier.

`
terragrunt plan --terragrunt-source ../../../../../../../terraform-modules//rds/postgresql/restore/PITR
...
...
...
Initializing the backend...

Error: module "db": "source_db_instance_identifier" is not a valid argument

Error: module "db": "target_db_instance_identifier" is not a valid argument

Error: module "db": "use_latest_restorable_time" is not a valid argument

Error: module "db": missing required argument "identifier"
`
Looking forward to get the PITR support in terraform-aws-rds module (and also terraform-provider-aws ultimately which is a dependency for sure for the rds module to work).

Support for read replica in same region as source DB

Hi, I am using this module to create my source database and also would like to create a read replica of the database in the same region. Whilst cross region replica databases are supported, it appears that I can't create a read replica since AWS requires the DB_SUBNET_GROUP_NAME option to not be set when the read replica is created in the same region as the source database.

As I understand the problem is that we need to conditionally send the db_subnet_group_name variable to the aws_db_instance resource; I am not quite sure the best way to achieve this using the current HCL interpolation and conditional syntax in the current version of terraform and was wondering if you have any ideas and will you add support for that to this module?

rds cluster support?

Just wondering are there are any plans for rds cluster support? I'm not sure what's the point of single database instances, most of the time products requires to scale quite early so cluster is needed.

Would like to use db_subnet_group_name natively

I have another remote terraform state that I'm accessing to deploy RDS instances into - the VPC in that terraform deployment already has a DB Subnet Group. I'd like to reference it instead of creating a new one when I use this module.

Module tries to create db_option_group for postgres

After update to the latest version of this module (v1.17.0), it tries to create db_option_group for postgresql engine. But this operation is not supported by the AWS API: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithOptionGroups.html

Applying the changes required by the update ends with infinite loop of:

module.postgres_db.db_option_group.aws_db_option_group.this: Still creating... (30m10s elapsed)

The issue can be resolved by disabling option_group creation:

create_db_option_group = false

I think that the module should contain some logic that would know that option groups are not supported for Postgres engine.

What do you think?

final_snapshot_identifier has bad default

./modules/db_instance/variables.tf final_snapshot_identifier is defined as

variable "final_snapshot_identifier" {
  description = "The name of your final DB snapshot when this DB instance is deleted."
  default     = false
}

According to terraform docs false will convert to the string 0
https://www.terraform.io/docs/configuration/variables.html

Thus we are trying to to have a final snapshot with an identifier of 0. This however produces

* aws_db_instance.this: InvalidParameterValue: The parameter FinalDBSnapshotIdentifier is not a valid identifier. Identifiers must begin with a letter; must contain only ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens.

Add `count` like parameter to set a number of db_instances to create

Hi guys!

Would it make sense to enable the creation of several db-instances with a single call of the module? These instances will share subnet_groups and parameters_groups.

The use case I'm thinking of is when you have a RDS master and you want to create X slaves from it. Instead of repeating the module call for every slave, you specify a parameter so the module do it for you.
It is also convenient to do it this way instead of calling the module several times when you have different environments (or workspaces) and a different number of slaves per environment. For instance, for production I would like to have 4 slaves, but for a test environment it is enough with just 1 slave. Passing the number of slave using a variable makes its way easier to achieve this.

What do you think? I can make the changes if you think is a good idea. Also I would like to know what would be the better variable name for this (I would not use count as it can be a reserved word for modules in the future).

The main problem here will be the outputs for the submodule db_instance, they will be a list instead of a string, and this will break backward compatibility...

I guess this should be considered for a major version release.

Add a failover example?

I understand that AWS Aurora supports DB clusters- which are not part of this module. With "plain" MySQL it should still be possible to create a Multi-AZ deployment (I assume using read replicas?).

An example for such a setup would be highly appreciated.

Thoughts about a local-exec provisioner in aws_db_instance

I have to support an use case where I need to run immediately after the database is created a bunch of SQL script. I was thinking to use local-exec provisioner. Any objections if I create a PR to add to the aws_db_instance resource the local-exec provisioner. Of course it would be conditionally

how to reference internal modules in terragrunt

I am running terragrunt plan --terragrunt-source ~/terraform-aws-rds and getting the below errors for every output referenced using internal module. Here is the module code https://github.com/terraform-aws-modules/terraform-aws-rds

Error: output 'this_db_parameter_group_arn': reference to undefined module "db_parameter_group"
Error: output 'this_db_option_group_arn': reference to undefined module "db_option_group"
Error: output 'this_db_instance_endpoint': reference to undefined module "db_instance"

when I use terraform paln by using source as the module, plan works fine.
"Plan: 6 to add, 0 to change, 0 to destroy."

I am new to terragrunt and please help me

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.