You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
│ Error: Error in function call
│
│ on local.tf line 37, in locals:
│ 37: cidr_nats_map = zipmap(["nat_a", "nat_b", "nat_c"], local.cidr_nats_list)
│ ├────────────────
│ │ local.cidr_nats_list is tuple with 1 element
│
│ Call to function "zipmap" failed: number of keys (3) does not match number of values (1).
Debug Output (Cherry Picked)
terraform refresh
[DEBUG] ReferenceTransformer: "local.cidr_nats_map (expand)" references: [local.cidr_nats_list (expand)]
[DEBUG] ReferenceTransformer: "local.public_access_cidrs (expand)" references: [local.cidr_list_office (expand) local.cidr_nats_map (expand)]
[DEBUG] ReferenceTransformer: "local.cidr_nats_list (expand)" references: [data.terraform_remote_state.network2]
...
╷
│ Error: Error in function call
│
│ on local.tf line 38, in locals:
│ 38: cidr_nats_map = zipmap(["nat_a", "nat_b", "nat_c"], local.cidr_nats_list)
│ ├────────────────
│ │ local.cidr_nats_list is tuple with 1 element
│
│ Call to function "zipmap" failed: number of keys (3) does not match number of values (1).
╵
2021-08-10T09:37:16.779-0700 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2021-08-10T09:37:16.782-0700 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.53.0/darwin_amd64/terraform-provider-aws_v3.53.0_x5 pid=20768
2021-08-10T09:37:16.782-0700 [DEBUG] provider: plugin exited
It says expand... /shrug
Expected Behavior
Terraform functions should work the same in Terraform console as compile/refresh-plan-apply.
Actual Behavior
The function logic works fine in Terraform Console, but fails on compile. It seems like zipmap is not expanding the variable and just reading it as a string. I'm guessing there is a different way or added syntax to make it work which would be great to know, but I still say the terraform console should respond the same as a run with terraform functions.
Steps to Reproduce
Setup .tf similar as above. Be sure to use all the same functions. formatlist, zipmap seem to be the area I'm seeing and issue.
terraform init
terraform refresh
Run terraform console with those same .tf files and see it work just fine.
References
I didn't find anything similar in my search...
The text was updated successfully, but these errors were encountered:
zipmap is showing that the argument is already a container with a single item. It seems the culprit here is formatlist, which is taking a dynamic value and converting it into a list with a single unknown value.
A simpler example:
variable "any" {
type = any
}
locals {
formatted = formatlist("%s", var.any)
result = zipmap(["a", "b", "c"], local.formatted)
}
jbardin
changed the title
zipmap function doesn't seem to be expanding variables on run but works in consoleformatlist returns a list with a single unknown value when given a DynamicValue
Aug 10, 2021
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.
Terraform Version
Providers
Terraform Configuration Files
Console Output (Fake IPs)
Loading up the .tf files in Terraform Console works correctly.
Terraform CLI (Refresh) Error
Debug Output (Cherry Picked)
terraform refresh
It says expand... /shrug
Expected Behavior
Terraform functions should work the same in Terraform console as compile/refresh-plan-apply.
Actual Behavior
The function logic works fine in Terraform Console, but fails on compile. It seems like zipmap is not expanding the variable and just reading it as a string. I'm guessing there is a different way or added syntax to make it work which would be great to know, but I still say the terraform console should respond the same as a run with terraform functions.
Steps to Reproduce
Setup .tf similar as above. Be sure to use all the same functions. formatlist, zipmap seem to be the area I'm seeing and issue.
terraform init
terraform refresh
Run terraform console with those same .tf files and see it work just fine.
References
I didn't find anything similar in my search...
The text was updated successfully, but these errors were encountered: