-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Provider produced inconsistent final plan #7987
Comments
dynamic "tag" {
for_each = local.tags
content {
key = tag.key
value = tag.value
propagate_at_launch = true
}
} according to hashiCorps example, the above dynamic block configuration should work, but it doesn't in my case, the error is the same as with my previous code |
While I haven't reproduced this exactly, the root cause here is likely hashicorp/terraform#20517, which causes the dynamic block to be updated with the incorrect values. |
In terraform 0.12.0 beta2 also facing the similar issue. In my case it is google provider where I'm trying to add attached disk using dynamic block and getting similar error. Terraform Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Panic OutputN/A Expected Behaviorgoogle_compute_instance should be created with list of attached_disks during first time terraform apply itself Actual Behaviorgoogle_compute_instance is getting created with list of attached_disks during second time terraform apply only. Steps to Reproduce
|
This is still relevant with aws provider version 2.11 and terraform 0.12.0-rc1. |
Running into the same issue with aws provider 2.14.0 and terraform 0.12.1. @theTranqu, did you ever find a workaround? @apparentlymart, should've hashicorp/terraform#21193 fixed this issue here as well? |
There is not really a workaround that I know of. Before TF12, i used my own self-made null-resource tag-generator to serve this purpose, sadly that was not possible anymore with TF12. Essentially, there is not a good way that I have found at this time. |
I found that the following works well in this case: resource "aws_autoscaling_group" "asg" {
...
tags = [
for k, v in local.asg_tags :
{
key = k
value = v
propagate_at_launch = true
}
]
} |
@manfredlift what type is local.asg_tags in this case? is it a map with multiple keys/values as might be expected from the context?
Error: ccp-9ff71c3c-7d01-6f3c-6fe6-7e069cf21832: invalid tag attributes: value missing |
It is a locals {
asg_tags = {
Foo = "foo"
Bar = "bar"
}
} |
That is awkward. I have the tags created as map outside of the module, and feed them as a map(string) to the module.
var.environment_tags is just a explicitly created map(string), var.tags is a variable of type map(string) with default={}. The module can be fed with additional tags this way, but doesnt have to. EDIT: I tried to remove var.tags, as it is just an empty map so that might cause problems, but that did not change anything for me/terraform |
Hmm, maybe try to test with less tags that definitely have a value. Also, which phase do you get the error in? Can you try to run Also I am not sure how this for-expression interacts with explicitly defined |
I did indeed find the culprit, an environment variable was not set so one of the tags(build_uri) got populated with an empty string during our pipeline runs. Thank you @manfredlift for the workaround, it does work perfectly. I tried to use the dynamic block again, just for good measure with a valid map(string), but i does indeed still fail with the same old error-message. But now we can go with the tags being created in this for expression, which is great! |
Hi, I'm experiencing a similar issue with dynamic load balancers being linked to an ECS Service:
This is inside sub-module - The initial plan shows a single load_balancer block with unknown values, and the apply fails with:
Any help would be greatly appreciated :) |
Some additional information, the culprit in my case is the filter I'm applying to
Using the var.target_groups variable directly works as expected. I was in need of that filter for modularization purposes but I'm reworking my pipeline to be less modularized in the meantime. |
For that, see #9049. |
Hi folks 👋 The original issue reported here should be resolved as of Terraform CLI 0.12.28 and Terraform AWS Provider 2.70.0 (potentially much sooner in both). If you are still experiencing issues with |
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! |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
This is part of a bigger module, I will try to copy out all the relevant parts
Debug Output
Panic Output
Expected Behavior
the following block:
Should have iterated through each key-value-pair of the local.tags map and create a tag-block for each one, including the "propagate_at_launch=true" key-value-pair.
Actual Behavior
10:49:57 Error: Provider produced inconsistent final plan
10:49:57
10:49:57 When expanding the plan for module.application.aws_autoscaling_group.elb[0] to
10:49:57 include new values learned so far during apply, provider "aws" produced an
10:49:57 invalid new value for .tag: block set length changed from 1 to 12.
10:49:57
10:49:57 This is a bug in the provider, which should be reported in the provider's own
10:49:57 issue tracker.
Steps to Reproduce
terraform apply
Important Factoids
Am I misunderstanding maps, when I assumed they would be iterable per each key-value-pair?
References
The text was updated successfully, but these errors were encountered: