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 parameter group keeps being modified, even though I have applied many times #22028

Closed
shinchan79 opened this issue Dec 3, 2021 · 8 comments
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.

Comments

@shinchan79
Copy link

shinchan79 commented Dec 3, 2021

Description

I upgrade Terraform from v0.12 to v0.13, and encounter the following:

Terraform will perform the following actions:

  # aws_db_parameter_group.rds_parameter_group["rds_instance_001"] will be updated in-place
  ~ resource "aws_db_parameter_group" "rds_parameter_group" {
        id          = "my-web-rds-pg"
        name        = "my-web-rds-pg"
        tags        = {}
        # (4 unchanged attributes hidden)

      + parameter {
          + apply_method = "immediate"
          + name         = "time_zone"
          + value        = "asia/tokyo"
        }
      - parameter {
          - apply_method = "pending-reboot" -> null
          - name         = "time_zone" -> null
          - value        = "Asia/Tokyo" -> null
        }
        # (7 unchanged blocks hidden)
    }

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

My Terraform configuration file:

resource "aws_db_parameter_group" "rds_parameter_group" {
  for_each = var.rds_instances
  name     = "${each.value.instance_name}-pg"
  family   = each.value.family

  parameter {
    name  = "character_set_client"
    value = "utf8"
  }

  parameter {
    name  = "character_set_connection"
    value = "utf8"
  }

  parameter {
    name  = "character_set_database"
    value = "utf8"
  }

  parameter {
    name  = "character_set_filesystem"
    value = "utf8"
  }

  parameter {
    name  = "character_set_results"
    value = "utf8"
  }

  parameter {
    name  = "character_set_server"
    value = "utf8"
  }

  parameter {
    name  = "log_bin_trust_function_creators"
    value = "1"
  }

  parameter {
    name  = "time_zone"
    value = "asia/tokyo"
  }
}

Expected behavior:

After I ran terraform apply, the changes will disappear, Terraform show message "No changes. Your infrastructure matches the configuration."

Actual behaviour:

After I apply, I run terraform plan again and RDS parameter group keep being modified like above.

Steps to Reproduce

  1. terraform apply
  2. terraform plan
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/rds Issues and PRs that pertain to the rds service. labels Dec 3, 2021
@shinchan79 shinchan79 changed the title RDS parameter group keep being modified, even though I have apply many times RDS parameter group keep being modified, even though I have applied many times Dec 3, 2021
@shinchan79 shinchan79 changed the title RDS parameter group keep being modified, even though I have applied many times RDS parameter group keeps being modified, even though I have applied many times Dec 3, 2021
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 7, 2021
@andrewpage
Copy link
Contributor

Having the same problem here.

@Schnitzel
Copy link

got the same problem, time_zone is a dynamic setting in AWS:
Screen Shot 2021-12-29 at 11 26 26

so this should be apply_method = "immediate" but even setting this in terraform directly, somehow the state always thinks that it's apply_method = "pending-reboot" which would be a static setting and then shows a change in a plan.

This happens to us also with:

  • innodb_lock_wait_timeout
  • table_open_cache
  • table_definition_cache
  • key_buffer_size
    and many more.

@Schnitzel
Copy link

also setting apply_method = "pending-reboot" on the affected parameters removes the change in the next terraform apply, but I feel this is more a workaround as these parameters should not need pending-reboot

@matthewtckr
Copy link

I'm seeing this with v3.71.0 all the way back to v3.55.0. It does not occur in v3.54.0 or v3.46.0 (the version I was mainly using until trying to update the provider this week).

It looks like it may be caused by #18818, committed and merged starting in v3.55.0, but I'm not very familiar with the provider code.

@gclough
Copy link

gclough commented Apr 6, 2022

Dupe of #20660 ?

@james-valente-simplisafe
Copy link
Contributor

I believe this issue can be closed now.

See the merged PR #24737 for a demonstration of why this is a behavioral artifact of the AWS API and not Terraform itself. The PR adds a NOTE to the latest aws_db_parameter_group resource documentation, explaining why this is happening.

@justinretzolk
Copy link
Member

Hey y'all 👋 Based on the details @jvalente11 included in their PR -- which added some information around this to the resource documentation -- this looks to be an upstream issue with AWS. Since the behavior is now documented, we'll close this issue for now, but I'll also be following up with a support ticket to AWS to report the unexpected behavior.

@github-actions
Copy link

github-actions bot commented Sep 9, 2022

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 Sep 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

No branches or pull requests

7 participants