Reputation: 31560
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
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