Difference between revisions of "Error: Error in function call"
Jump to navigation
Jump to search
Line 11: | Line 11: | ||
* Solution: if your element if from type <code>[[list]]</code> make user provide values using proper format: <code>[value1, value2]</code> | * Solution: if your element if from type <code>[[list]]</code> make user provide values using proper format: <code>[value1, value2]</code> | ||
+ | |||
+ | |||
+ | ╷ | ||
+ | │ Error: Error in function call | ||
+ | │ | ||
+ | │ on .terraform/modules/vpc/main.tf line 1113, in resource "[[aws_route]]" "[[private_nat_gateway]]": | ||
+ | │ 1113: route_table_id = element(aws_route_table.private.*.id, count.index) | ||
+ | │ ├──────────────── | ||
+ | │ │ aws_route_table.private is empty tuple | ||
+ | │ │ count.index is 0 | ||
+ | │ | ||
+ | │ Call to function "element" failed: cannot use element function with an empty list. | ||
+ | ╵ | ||
+ | |||
+ | |||
╷ | ╷ |
Revision as of 11:28, 2 June 2022
│ Error: Error in function call │ │ on ../path/to/your/terraformodule.tf line 7, in resource "aws_instance" "this": │ 7: subnet_id = element(var.subnet_ids,count.index) │ ├──────────────── │ │ count.index is 0 │ │ var.subnet_ids is empty list of string │ │ Call to function "element" failed: cannot use element function with an empty list.
- Solution: if your element if from type
list
make user provide values using proper format:[value1, value2]
╷ │ Error: Error in function call │ │ on .terraform/modules/vpc/main.tf line 1113, in resource "aws_route" "private_nat_gateway": │ 1113: route_table_id = element(aws_route_table.private.*.id, count.index) │ ├──────────────── │ │ aws_route_table.private is empty tuple │ │ count.index is 0 │ │ Call to function "element" failed: cannot use element function with an empty list. ╵
╷ │ Error: Error in function call │ │ on .terraform/modules/your_module.tf line 34, in resource "aws_s3_bucket" "s3_buket": │ 34: for_each = var.s3_cors_vars ==null ? []:list(var.s3_cors_vars) │ ├──────────────── │ │ var.s3_cors_vars is object with 5 attributes │ │ Call to function "list" failed: the "list" function was deprecated in Terraform v0.12 and is no longer available; use tolist([ ... ]) syntax to │ write a literal list. ╵
Related terms
See also
Advertising: