Difference between revisions of "Error: Error in function call"
Jump to navigation
Jump to search
(5 intermediate revisions by 2 users not shown) | |||
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 ec2.tf line 39, in resource "aws_instance" "vadd_server": | ||
+ | │ 39: subnet_id = element([[data.]]aws_subnets.all_private.ids, 0) | ||
+ | │ ├──────────────── | ||
+ | │ │ while calling element(list, index) | ||
+ | │ │ data.aws_subnets.all_private.ids is empty list of string | ||
+ | │ | ||
+ | │ Call to function "element" failed: cannot use element function with an | ||
+ | │ empty list. | ||
+ | ╵ | ||
+ | |||
+ | ╷ | ||
+ | │ 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. | ||
+ | ╵ | ||
Line 26: | Line 52: | ||
╵ | ╵ | ||
− | + | == Related terms == | |
− | + | * [[Error: Invalid function argument]] | |
+ | * [[splat]] | ||
+ | * [[The state file is empty. No resources are represented]] | ||
== See also == | == See also == |
Latest revision as of 11:28, 23 March 2023
│ 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 ec2.tf line 39, in resource "aws_instance" "vadd_server": │ 39: subnet_id = element(data.aws_subnets.all_private.ids, 0) │ ├──────────────── │ │ while calling element(list, index) │ │ data.aws_subnets.all_private.ids is empty list of string │ │ Call to function "element" failed: cannot use element function with an │ empty list. ╵
╷ │ 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[edit]
See also[edit]
Advertising: