terraform plan is giving the error : function call (function yamldecode)

Viewed 1438

Please find the GitLab repo for the terraform scripts which we are using. enter link description here Run in terraform plan gives the below error in an all-in-one.YAML file for the elastic search.

Error: Error in function call
 on kubernetes.tf line 49, in locals:
 49:   resource_list = yamldecode(file("${path. module}/all-in-one.yaml")).items
   |----------------
   | path.module is "."

Call to function `"yamldecode"` failed: on line 458, column 1: unexpected extra
content after value.

enter image description here

1 Answers

As is describe in the fine manual:

Only one YAML document is permitted. If multiple documents are present in the given string then this function will return an error.

and one can trivially reproduce your error message:

  content  = yamldecode("---\nhello: world\n---\ntoo: bad\n")
  on main.tf line 14, in resource "local_file" "example":
  14:   content  = yamldecode("---\nhello: world\n---\ntoo: bad\n")

Call to function "yamldecode" failed: on line 2, column 1: unexpected extra
content after value.
Related