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

Changelog doesn't reflect private_key path updates #9502

Closed
mlushpenko opened this issue Oct 21, 2016 · 3 comments
Closed

Changelog doesn't reflect private_key path updates #9502

mlushpenko opened this issue Oct 21, 2016 · 3 comments

Comments

@mlushpenko
Copy link

In terraform version 0.7.0 we could refer to private_key that is located in the working directory like:
private_key = "demo.pem"

In version 0.7.7 we need to change this to:
private_key = "${file("demo.pem")}"

I couldn't find this updated functionality in changelog since version 0.7.0.

I had to update all my connection blocks to make my repository https://github.com/mlushpenko/terraform-ansible work again. For instance, with version 0.7.0 this was working fine:

resource "null_resource" "ssh_copy" {
  provisioner "file" {
    source = "demo.pem"
    destination = "/home/ubuntu/demo.pem"
  }
  connection {
    user = "ubuntu"
    private_key = "demo.pem"
    host = "${aws_instance.ansible.public_ip}"
  }
}

In version 0.7.7 this connection block has to be changed to:

  connection {
    user = "ubuntu"
    private_key = "${file("demo.pem")}"
    host = "${aws_instance.ansible.public_ip}"
  }
@jbardin
Copy link
Member

jbardin commented Oct 21, 2016

Hi @mlushpenko,

Thanks for reporting this, and sorry you're having trouble with the issue. This was the confluence of a few mistakes on our part, and we're going to try and make these changes easier to find as we go forward. The private_key wasn't intended to take a path argument, which should have been pointed out better in the CHANGELOG, and also mention key_file to make the change easier to spot. This was is only documented fully in the connection docs.

To link everything together for completeness: private_key was added last year in the 0.6.x releases by #3846, which deprecated the key_file field. Unfortunately, even though the documentation stated that private_key should use the file function to get the key contents, it still accepted a path and read the file implicitly. A recent patch which broke the old behavior went unnoticed (#8577), until the 0.7.6 release. We remove the now broken and deprecated fields, and I added a backward incompatibility note about removing the removal. What I didn't realize was that the private_key field had this same undocumented behavior which was also now changed.

@mlushpenko
Copy link
Author

Hi @jbardin ,

thanks for the elaborate answer, I am just trying to make terraform better.

Cheers.

@ghost
Copy link

ghost commented Apr 21, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants