I seem to be confused about how external works. I tried:
data "external" "local_key" {
program = [
"ssh-keygen", "-y", "-f ~/.ssh/id_rsa"
]
}
This gives me:
failed to execute "ssh-keygen": ~/.ssh/id_rsa: No such file or directory
Which presumably happens because ~
expansion doesn't. ssh-keygen -y -f ~/.ssh/id_rsa
works normally. So instead I tried invoking bash like:
data "external" "local_key" {
program = [
"bash"
]
query {
"-c" = "ssh-keygen -y -f ~/.ssh/id_rsa"
}
}
I'm still getting the same issue. I realize I can just pass itthe output as a var to terraform from the outside, but I'm still curious what the solution is.