Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDS shared_preload_libraries update inconsistent. #12025

Closed
AndrewNeudegg opened this issue Feb 13, 2020 · 12 comments
Closed

RDS shared_preload_libraries update inconsistent. #12025

AndrewNeudegg opened this issue Feb 13, 2020 · 12 comments
Labels
service/rds Issues and PRs that pertain to the rds service.

Comments

@AndrewNeudegg
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.11.14

Affected Resource(s)

RDS Parameter groups, shared_preload_libraries.

  • aws_XXXXX

Terraform Configuration Files

Using: https://github.com/terraform-aws-modules/terraform-aws-rds

module "db_1" {
  source = "terraform-aws-modules/rds/aws"
  version = "~> 1.0"
  
  identifier = "db_1"

  engine            = "postgres"
  engine_version    = "11.5"
  instance_class    = "${var.er_instance_type}"
  allocated_storage = "${var.er_storage}"
  storage_encrypted = true
  storage_type      = "gp2"
  performance_insights_enabled = true
  apply_immediately = true

  allow_major_version_upgrade = true

  name = "db_1"

  # NOTE: Do NOT use 'user' as the value for 'username' as it throws:
  # "Error creating DB Instance: InvalidParameterValue: MasterUsername
  # user cannot be used as it is a reserved word used by the engine"
  username = "er_admin"

  password = "${var.db_1_password}"
  port     = "5432"

  vpc_security_group_ids = ["${aws_security_group.databases.id}"]
  multi_az               = true

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

  # disable backups to create DB faster
  backup_retention_period = 7

  tags = {
    Owner = "chris.brook"
  }

  enabled_cloudwatch_logs_exports = ["postgresql", "upgrade"]

  # DB subnet group
  subnet_ids = ["${data.aws_subnet_ids.private.ids}"]

  # DB parameter group
  create_db_parameter_group = true

  # parameter_group_name = "db_1"
  parameter_group_description = "db_1 specific parameters"
  family                      = "postgres11"

  # note that the apply method must be determined from the parameter type. static parameters can only be
  # applied after reboot, whereas dynamic parameters can be applied immediately. the implicit default is
  # to apply immediately, so any static parameters must have an apply method of "pending-reboot". it's 
  # unclear why terraform can't infer this information when the apply method isn't specified - probably
  # something web-scale related..
  parameters = [
    {
      name = "random_page_cost"

      value = 1.1
    },    
    {
      name = "rds.force_ssl"

      value = 1
    },
    {
      name = "auto_explain.log_min_duration"

      value = 5000
    },
    {
      name = "auto_explain.log_nested_statements"

      value = 1
    },
    {
      name = "log_min_duration_statement"

      value = 5000
    },
    {
      name = "log_statement"

      value = "none"
    },
    {
      name = "pg_hint_plan.debug_print"

      value = "on"
    },
    {
      name = "pg_hint_plan.enable_hint"

      value = "on"
    },
    {
      name = "pg_stat_statements.max"

      value = 10000,

      apply_method = "pending-reboot"
    },
    {
      name = "pg_stat_statements.track"

      value = "all"
    },
    {
      name = "shared_preload_libraries"

      value = "${join(",", "${var.shared_preload_libraries}")}"

      apply_method = "pending-reboot"
    },
  ]

  use_parameter_group_name_prefix = true
  options                         = []

  major_engine_version = "11.5"

  # Snapshot name upon DB deletion
  final_snapshot_identifier = "db_1"

  # Database Deletion Protection
  deletion_protection = true

  copy_tags_to_snapshot = true

  create_monitoring_role              = false
  iam_database_authentication_enabled = true
  monitoring_interval                 = 5
  monitoring_role_arn                 = "${aws_iam_role.enhanced_monitoring.arn}"
}

With the configuration:

variable "shared_preload_libraries" {
  type    = "list"
  default = [ "pg_stat_statements", "auto_explain", "pg_hint_plan" ]
}

Debug Output

Panic Output

Expected Behavior

When values are added and removed from the configuration array, the changes should be properly reflected in shared_preload_libraries.

Actual Behavior

In the instance that the values in configuration diverge from the values in shared_preload_libraries the plan looks like it executes properly but shared_preload_libraries contains only the pg_stats_statements:
image

image

In the instance that the value pg_stats_statements is not in the configuration, the values in shared_preload_librariesupdate properly.

In the instance that the value of shared_preload_libraries is the same as the value in configuration -- no change occurs.

Steps to Reproduce

  1. Change the configuration from:
variable "shared_preload_libraries" {
  type    = "list"
  default = [ "pg_stat_statements", "pg_hint_plan" ]
}

to

variable "shared_preload_libraries" {
  type    = "list"
  default = [ "pg_stat_statements", "auto_explain", "pg_hint_plan" ]
}

And check the value of shared_preload_libraries.

Important Factoids

References

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 13, 2020
@DrFaust92 DrFaust92 added the service/rds Issues and PRs that pertain to the rds service. label May 21, 2020
@caleb15
Copy link

caleb15 commented Dec 17, 2020

This is also a issue with terraform version 0.12.29.

@caleb15
Copy link

caleb15 commented Dec 17, 2020

Our configuration is like so:

  parameter {
    name         = "shared_preload_libraries"
    value        = "pg_stat_statements,auto_explain"
    apply_method = "pending-reboot"
  }

@caleb15
Copy link

caleb15 commented Dec 17, 2020

Oh no, it looks like some other params might be affected too 😬

auto_explain.log_buffers, auto_explain.log_triggers, auto_explain.log_verbose, auto_explain.log_nested_statements, auto_explain.log_format, and auto_explain.log_min_duration all have the same problem in some of our VPC's.

@justinretzolk
Copy link
Member

Hi all 👋 Thank you for taking the time to file this issue, and for the discussion so far. Given that there's been a number of Terraform and AWS provider releases since the last update, can anyone confirm whether they're still experiencing this issue?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 27, 2021
@phil-hildebrand
Copy link

I'm seeing this issue in terraform version 0.15.3

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Mar 7, 2022
@justinretzolk
Copy link
Member

Hey @phil-hildebrand 👋 What version of the AWS Provider are you using where you're experiencing this?

@justinretzolk justinretzolk added the waiting-response Maintainers are waiting on response from community or contributor. label Mar 18, 2022
@phil-hildebrand
Copy link

The aws provider version was 2.70.0.

@github-actions github-actions bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Apr 1, 2022
@justinretzolk
Copy link
Member

Hey @phil-hildebrand 👋 Version 2.70.0 was released quite a while ago, and there've been many releases since. Are you able to test with a newer version of the provider to determine whether you experience the same issues?

@phil-hildebrand
Copy link

We are in the process of upgrading to 3.75.1, I'll test that this week and note if it addresses it.

@phil-hildebrand
Copy link

We are in the process of upgrading to 3.75.1, I'll test that this week and note if it addresses it.

We verified that upgrading fixed the issue

@justinretzolk
Copy link
Member

Thanks for the update! Given that it seems this was indeed fixed in later versions, I'll get this issue closed out. If anyone experiences this in the future, please open a fresh issue so we can take another look.

@github-actions
Copy link

github-actions bot commented Feb 5, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

No branches or pull requests

5 participants