Terraform v0.12.26
resource "aws_db_parameter_group" "postgres_10" {
name = "psql-pg-test-10"
family = "postgres10"
description = "Postgres parameter group test"
lifecycle {
create_before_destroy = true
}
parameter {
name = "rds.pg_stat_ramdisk_size"
value = 256
apply_method = "pending-reboot"
}
}
N/A
Parameter group value is updated
Parameter group remains the same
The plan output looks like this:
- parameter {
- apply_method = "pending-reboot" -> null
- name = "rds.pg_stat_ramdisk_size" -> null
- value = "0" -> null
}
+ parameter {
+ apply_method = "pending-reboot"
+ name = "rds.pg_stat_ramdisk_size"
+ value = "256"
}
Reading the code, it sees this a removal of an old parameter and the addition of a new parameter, and then modifies the parameter group with the new value, and then resets the old parameter back to the existing value. Even swapping the order of those two operations would likely fix this issue
rds.pg_stat_ramdisk_size = 256N/A
I've been running into the same issue and have been digging into the code. It looks like the problem is here:
(https://github.com/terraform-providers/terraform-provider-aws/blob/eb6594f20ba09ab8a831869dda32c2d0b63b4d84/aws/resource_aws_rds_cluster_parameter_group.go#L225)
Differences compares map keys without checking values and returns the set of values in the original state that aren't in the new state. Unfortunately, for parameter groups the keys for the map are hashes of the entire parameter (name, value, etc). Because of this, it never shows up as an update. It's always a removal and a re-add. Given the order of the operations (update, then reset), this doesn't ever work!
Changing the order would probably work, but it would still be a bit ugly. The best solution would be to replace the Differences function with something that was smart enough to only reset the values that have to be reset!
I'll try to put together a PR for this at some point, but wanted to leave this info just in case I don't get the chance or someone is able to beat me to it!
_EDIT_
I've got a first pass at a fix up here: https://github.com/terraform-providers/terraform-provider-aws/compare/master...kevincormier-toast:db_param_group_updates
I've got to think through edge cases around case and update the tests so that I'm creating new ones instead of extending existing ones. If you are comfortable compiling the provider and testing it yourself, you are welcome to try it, but I make no guarantees that this is safe to run!
If you're blocked by this and are OK giving up ability to reset params, you might try 2.44, which worked for me. I found it by looking for the latest version that didn't include https://github.com/terraform-providers/terraform-provider-aws/pull/11540 .
This appears to be a duplicate of #11846 which has an associated PR #12112 under review
This fix for this bug has been merged and will release with v3.3.0 of the Terraform AWS Provider, likely out this Thursday.
This has been released in version 3.3.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
This appears to be a duplicate of #11846 which has an associated PR #12112 under review