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

Want support for the provisioner feature #140

Open
askfongjojo opened this issue May 15, 2023 · 1 comment
Open

Want support for the provisioner feature #140

askfongjojo opened this issue May 15, 2023 · 1 comment
Labels

Comments

@askfongjojo
Copy link
Contributor

The provisioner feature in Terraform allows file upload to a newly created instance which is very useful for files such as key files or other large files that are too big to be included as user_data.

The feature will require also the support of $(self.external_ip) to return the IP address of the newly created instance. Here is an example of how it's used in the aws provider:

resource "aws_instance" "jumpbox" {

  ami                         = "ami-0fcf52bcf5db7b003"
  instance_type               = "m1.medium"
  key_name                    = "${var.key_name}"
  subnet_id                   = "${var.subnet_id}"
  associate_public_ip_address = true
  user_data                   = "${data.template_file.userdata.rendered}"
  vpc_security_group_ids      = ["${aws_security_group.jumpbox_sg.id}"]
  root_block_device {
    volume_type = "standard"
  }

  tags = {
    Name = "Jumpbox"
  }

    provisioner "file" {
    source      = "~/.ssh/aws.pem"
    destination = "/home/ubuntu/.ssh/id_rsa"

    connection {
      type         = "ssh"
      user         = "ubuntu"
      host         = "${self.public_ip}"
      agent        = false
      private_key  = "${file("~/.ssh/aws.pem")}"
    }
  }

}
@karencfv
Copy link
Collaborator

Currently the only way to retrieve external IPs is through the /v1/instances/instance/external-ips endpoint, which returns a list of IPs. This means that using that endpoint would require users to set the index of the IP to select a single one, which would be a pretty terrible experience.

Would using host_name not be enough? If it is, then this feature is already there :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants