red888
red888

Reputation: 31560

What input does the external terraform datasource expect?

This command returns json: aws ec2 describe-instances --instance-ids i-xxxxx

But terraform complains:

data "external" "sdfsdfsdf" {
  program = ["bash", "-c", "aws ec2 describe-instances --instance-ids i-xxxxxx"]
}
# error
Error: command "bash" produced invalid JSON: json: cannot unmarshal array into Go value of type string

Upvotes: 1

Views: 892

Answers (1)

red888
red888

Reputation: 31560

This is a known issue: https://github.com/hashicorp/terraform/issues/12249

I needed to flatten the json passed to the datasource to have 1 level of keys.

Upvotes: 1

Related Questions