Difference between revisions of "Error: Error in function call"

From wikieduonline
Jump to navigation Jump to search
Line 23: Line 23:
 
  │ write a literal list.
 
  │ write a literal list.
 
  ╵
 
  ╵
 +
 +
== Related terms ==
 +
* [[Error: Invalid function argument]]
  
 
== See also ==
 
== See also ==

Revision as of 16:01, 29 September 2021

│ 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/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: