cloudposse/terraform-tls-ssh-key-pair

Output: chmod: /Users/me/.ssh/appcom: No such file or directory

J7mbo opened this issue · 1 comments

J7mbo commented

Hi! I'm trying to use your library for the first time. Very basic:

module "ssh_key_pair" {
  source                = "git::https://github.com/cloudposse/terraform-tls-ssh-key-pair.git?ref=master"
  name                  = var.DOMAIN
  ssh_public_key_path   = "~/.ssh"
}

When placing this in my main.tf and then running it, I get the following output in my terminal:

module.ssh_key_pair.tls_private_key.default: Creating...
module.ssh_key_pair.tls_private_key.default: Creation complete after 1s [id=89392b07bd2567d9926636d1ab88d22f31273ada]
module.ssh_key_pair.local_file.public_key_openssh: Creating...
module.ssh_key_pair.local_file.private_key_pem: Creating...
module.ssh_key_pair.local_file.private_key_pem: Creation complete after 0s [id=30585aed5f64364c67bdc55432968e6b79cced42]
module.ssh_key_pair.local_file.public_key_openssh: Creation complete after 0s [id=362961cceca44763b4e00dac76987935d740cf30]
module.ssh_key_pair.null_resource.chmod[0]: Creating...
module.ssh_key_pair.null_resource.chmod[0]: Provisioning with 'local-exec'...
module.ssh_key_pair.null_resource.chmod[0] (local-exec): Executing: ["/bin/sh" "-c" "chmod 600 ~/.ssh/appcom"]
module.ssh_key_pair.null_resource.chmod[0] (local-exec): chmod: /Users/me/.ssh/appcom: No such file or directory


Error: Error running command 'chmod 600 ~/.ssh/appcom': exit status 1. Output: chmod: /Users/me/.ssh/appcom: No such file or directory

Is my understanding and usage of this incorrect, or is this a bug?

J7mbo commented

Found the issue, it's with using the ~ in the path. I changed this to: "/Users/me/.ssh" and it worked.

I might leave this open in case you still consider it a bug, please close it if not. Thanks!