Difference between revisions of "Error: Invalid function argument (no file exists)"

From wikieduonline
Jump to navigation Jump to search
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
  
 
  ╷
 
  ╷
  │ Error: Invalid function argument
+
  │ [[Error: Invalid function argument]]
 
  │
 
  │
 
  │  on [[main.tf]] line 626, in data "[[template_file]]" "buildspec":
 
  │  on [[main.tf]] line 626, in data "[[template_file]]" "buildspec":
Line 11: Line 11:
 
  ╵
 
  ╵
  
 +
 +
│ Error: Invalid function argument
 +
 +
│  on .terraform/modules/path_to_tffile.tf line 24, in resource "[[aws_s3_bucket]]" "s3_bucket":
 +
│  24:      for_each = var.s3_static_website_vars == null ? []:[[tolist]](var.s3_static_website_vars)
 +
│    ├────────────────
 +
│    │ var.s3_static_website_vars is object with 4 attributes
 +
 +
│ [[Invalid value for "v" parameter]]: [[cannot convert object to list of any single type]].
 +
 +
 +
 +
│ Error: Invalid function argument
 +
 +
│  on .terraform/modules/path/to/file.tf line 4, in resource "aws_s3_bucket" "s3_bucket":
 +
│    4:    [[for_each]] = [[toset]](var.[[s3_bucket_name]])
 +
│    ├────────────────
 +
│    │ var.s3_bucket_name is a string, [[known only after apply]]
 +
 +
│ Invalid value for "v" parameter: [[cannot convert string to set of any single type]].
  
 +
== Related terms ==
 +
* <code>[[splat]]</code>
  
 
== See also ==
 
== See also ==
 +
* {{template_file}}
 
* {{terraform plan}}
 
* {{terraform plan}}
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]

Latest revision as of 14:36, 4 October 2021

╷
│ Error: Invalid function argument
│
│   on main.tf line 626, in data "template_file" "buildspec":
│  626:   template = "${file("buildspec.yaml")}"
│
│ Invalid value for "path" parameter: no file exists at buildspec.yaml; this function works only with files that are distributed as part of the
│ configuration source code, so if this file will be created by a resource in this configuration you must instead obtain this result from an
│ attribute of that resource.
╵
╷
│ Error: Invalid function argument
│
│   on .terraform/modules/path_to_tffile.tf line 24, in resource "aws_s3_bucket" "s3_bucket":
│   24:      for_each = var.s3_static_website_vars == null ? []:tolist(var.s3_static_website_vars)
│     ├────────────────
│     │ var.s3_static_website_vars is object with 4 attributes
│
│ Invalid value for "v" parameter: cannot convert object to list of any single type.
╵


│ Error: Invalid function argument
│
│   on .terraform/modules/path/to/file.tf line 4, in resource "aws_s3_bucket" "s3_bucket":
│    4:     for_each = toset(var.s3_bucket_name)
│     ├────────────────
│     │ var.s3_bucket_name is a string, known only after apply
│
│ Invalid value for "v" parameter: cannot convert string to set of any single type.

Related terms[edit]

See also[edit]

Advertising: