Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File provisioner ssh can't read private_key from parameter store #1628

Closed
ovedanner opened this issue Sep 9, 2017 · 3 comments
Closed

File provisioner ssh can't read private_key from parameter store #1628

ovedanner opened this issue Sep 9, 2017 · 3 comments
Labels
bug Addresses a defect in current functionality. service/ssm Issues and PRs that pertain to the ssm service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. upstream-terraform Addresses functionality related to the Terraform core binary.

Comments

@ovedanner
Copy link

Hi,

I'm trying to create an aws_instance with a few file provisioners. These provisioners have the following form:

provisioner "file" {
    source      = "/path/to/local/file"
    destination = "/path/to/instance/file"

    connection {
      type        = "ssh"
      user        = "ubuntu"
      private_key = "${data.aws_ssm_parameter.PRIVATE_KEY.value}"
    }
  }

When trying to create (and provision) the instance, terraform throws the following error:

1 error(s) occurred:

* Failed to read key <ACTUAL_PRIVATE_KEY>...

Where it says <ACTUAL_PRIVATE_KEY>, I can see the contents of my private key that reside in the parameter store, so it seems terraform is able to retrieve it. When I put the private key in a file and use the built-in file method to refer to it, everything works fine.

Terraform Version

v0.10.3

Affected Resource(s)

  • provisioner (file)

Terraform Configuration Files

provisioner "file" {
    source      = "/path/to/local/file"
    destination = "/path/to/instance/file"

    connection {
      type        = "ssh"
      user        = "ubuntu"
      private_key = "${data.aws_ssm_parameter.PRIVATE_KEY.value}"
    }
  }

Expected Behavior

The file provisioner should have been able to ssh into the machine

Actual Behavior

Terraform could not read the private key and throws the error:

1 error(s) occurred:

* Failed to read key <ACTUAL_PRIVATE_KEY>...
@Ninir Ninir added the bug Addresses a defect in current functionality. label Sep 18, 2017
@radeksimko radeksimko added upstream-terraform Addresses functionality related to the Terraform core binary. service/ssm Issues and PRs that pertain to the ssm service. labels Jan 28, 2018
@coffeepac
Copy link

I hit this issue tonight and stumbled across this bug: aws/aws-cli#2596

This may not be a terraform issue but may be an AWS Web Console issue. A workaround is provided in the linked issue.

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Mar 30, 2020
@ghost
Copy link

ghost commented May 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators May 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ssm Issues and PRs that pertain to the ssm service. stale Old or inactive issues managed by automation, if no further action taken these will get closed. upstream-terraform Addresses functionality related to the Terraform core binary.
Projects
None yet
Development

No branches or pull requests

4 participants