I want to fetch sshkey with digital ocean token with get_sshkey.sh script:
do_token=$1
curl -X GET -s -H "Authorization: Bearer ${do_token//\"}" "https://api.digitalocean.com/v2/account/keys?page=1" | jq -r --arg queryname "User's key" '.ssh_keys[] | select(.name == $queryname).public_key'
I have a declared variable of DO token var.do-token, I am trying to use $1 bash concept to pass parameter to get_sshkey.sh and run it in terraform data "external" in following:
data "external" "fetchssh" {
program = ["sh", "/input/get_sshkey.sh `echo "var.do-token" | terraform -chdir=/input console -var-file terraform.auto.tfvars`"]
}
but get the error: Expected a comma to mark the beginning of the next item.