3

I am extremely confused on why this occurs when using Packer. What I want to do is move a local redis.conf file over to my AMI; however, it gives me an error as I do this. My Packer provisioner is like so:

  {
    "type": "file",
    "source": "../../path/to/file/redis.conf",
    "destination": "/etc/redis/redis.conf"
  }

And then it returns an error saying: scp /etc/redis/: Permission denied

Roma
  • 535
  • 6
  • 18

1 Answers1

8

What you need to do is copy the file to a location where you have write access (/tmp for example) and then use an inline provisioner to move it somewhere else.

I have something like:

provisioner "file" {
  source      = "some/path/to/file.conf"
  destination = "/tmp/file.conf
}

And then:

provisioner "shell" {
  inline = ["sudo mv /tmp/file.conf /etc/some_service/file.conf"]
}
boris quiroz
  • 373
  • 5
  • 11