-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
parameter_group_name always shows a diff and causes apply to fail for aws_elasticache_cluster #2468
Comments
Update: this bug also affects |
One more update: it looks like the But the general pattern seems to be consistent: if you set various params to an empty string in Terraform, AWS fills in some default value itself, and you get a diff on the next run of |
Thanks for filing this @brikis98, and sorry for the delay in replying. The attribute This is, therefore, an inconsistency between Terraform's interpretation and the remote API's interpretation: Terraform considers the empty string to be an explicitly-provided value, while the API considers it to be equivalent to "unset" and it provides a default. Unfortunately I think properly fixing this will require waiting until we're further along with integrating the new config language parser/evaluator, since that introduces a first-class idea of "null" that will then allow us to distinguish between "unset" and "set to empty". As we currently stand, we can't change the diff behavior to treat empty string as unset because there are some resources for which empty string is a legitimate value. For now, omitting the attribute entirely is the only way to properly request the server-provided default in a way that Terraform will understand. I assume that in practice you're trying to omit it conditionally in a re-usable module, in which case unfortunately for now I think the only path -- until we have explicit support for parameter_group_name = "${var.parameter_group_name != "" ? var.parameter_group_name : "default.memcached1.4"}" In this particular case I think there is at least a predictable default to use. In other cases it's trickier because the server-provided default varies depending on other settings in the user's account, so this is indeed not a fully-general solution as the forthcoming support for # NOT YET IMPLEMENTED
parameter_group_name = var.parameter_group_name != "" ? var.parameter_group_name : null
# (or indeed perhaps the variable's own default is null and so the conditional isn't needed at all) |
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! |
Terraform Version
Terraform v0.10.8
Affected Resource(s)
Terraform Configuration Files
Note that this error happens with both redis and memcached.
Expected Behavior
After you run
apply
, there are no diffs in subsequentplan
.Actual Behavior
After you run
apply
, the nextplan
shows the following, even though nothing changed:Worse yet, if you run
apply
again, you get an error:Steps to Reproduce
terraform apply
terraform plan
terraform apply
Important Factoids
You can work around this by setting the parameter group explicitly:
The text was updated successfully, but these errors were encountered: