-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
terraform {
required_providers {
javascript = {
source = "apparentlymart/javascript"
# Until this provider has a stable release, always select an exact
# version to avoid adopting new releases that may have breaking changes.
version = "0.0.1"
}
}
}
data "javascript" "example" {
source = <<-EOT
{ x: "1", y: "2" }
EOT
vars = {
}
}
output "raw_schema" {
value = data.javascript.example.result
}
output "validated_schema" {
value = data.javascript.example.result
}
Returns plan error:
│ Error: JavaScript Syntax Error
│
│ with data.javascript.example,
│ on main.tf line 38, in data "javascript" "example":
│ 38: source = <<-EOT
│ 39: { x: "1", y: "2" }
│ 40: EOT
│
│ SyntaxError: (anonymous): Line 1:12 Unexpected token :
Any ideas what I am doing wrong?
However, if I just return one value in the object
{ x: "1" }
I get
Changes to Outputs:
+ raw_schema = "1"
+ validated_schema = "1"
Arrays are returned correctly. Just not objects.
Removing the comma causes it to succeed plan, but return the last value in the object.
source = <<-EOT
{ x: "1"
y : "2" }
EOT
returns:
+ raw_schema = "2"
+ validated_schema = "2"
Metadata
Metadata
Assignees
Labels
No labels