-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
aws db parameter group ... converts keys and values to lower case and fails 'apply' due to aws_db_parameter_group changes #297
Comments
can confirm this is till an issue. When you run |
As a workaround I was able to set it to the lower case value, which worked OK for setting
Aurora (MySQL 5.6) seemed to handle this being lower case, but this might not work correctly with other parameters. The provider would then retrieve the lower case value from the API, compare it against the resource which is also specifying lower case and not try to reapply the change. |
Hi @ebgc, thanks again for creating this issue and apologies you came across this confusing error! There have been a lot of relevant changes in the Terraform Core and Terraform AWS Provider codebases since this issue was originally reported so as a first step it might be best to try updating to recent versions of both and seeing if any of those updates may have resolved this issue. Attempting to troubleshoot these types of errors is very difficult in Terraform 0.11 and earlier as those versions will report this problem ( In Terraform 0.12 and later, the "value did not match" type of error can now be found with the newer That said, if the configuration does happen to reproduce the newer |
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! |
This issue was originally opened by @ebgc as hashicorp/terraform#9215. It was migrated here as part of the provider split. The original body of the issue is below.
Hi there,
Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.
Terraform Version
mac os x 10.12
Terraform v0.7.4
Affected Resource(s)
Terraform Configuration Files
Debug Output
1 error(s) occurred:
Please include the following information in your report:
Panic Output
n.a.
Expected Behavior
take what aws api returns without modification (dont use flattenParameters)
save what tf file defines at tfstate file without modification (dont use flattenParameters)
Actual Behavior
all keys and values will be down-cased on tfstate file even though on initial run they are set on aws as defined in tf file
Steps to Reproduce
have an aws_db_instance (postgres, 9.4.5) with resource_aws_db_parameter_group (postgres9.4) which sets 'lc_messages' to 'en_US.utf8', or 'timezone' to 'UTF'
even though we set 'en_US.utf8' in tf file (terraform during 'apply' will set 'en_US.utf8' on aws rds resource) - tfstate file will have 'en_us.utf8' set.
next run of terraform 'apply' will read resource from aws and convert it to lower case 'en_us.utf8' (see below 'flattenParameters' function) which will not fail compared to state file value (match). but because there is a diff with tf file (remember we set 'en_US.utf8') value it will try to modify the resource.
here another bug comes in play where terraform complains that db parameter group has a diff and reports: '* aws_db_parameter_group.default: diffs didn't match during apply.'
Important Factoids
---- terraform/builtin/providers/aws/resource_aws_db_parameter_group.go ----
func resourceAwsDbParameterGroupRead
...
d.Set("parameter", flattenParameters(describeParametersResp.Parameters))
...
---- terraform/builtin/providers/aws/resource_aws_db_parameter_group.go ----
func flattenParameters
...
r["name"] = strings.ToLower(_i.ParameterName)
...
r["value"] = strings.ToLower(_i.ParameterValue)
....
---- terraform/builtin/providers/aws/structure.go ----
---- terraform/builtin/providers/aws/structure.go ----
References
The text was updated successfully, but these errors were encountered: