1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
data "aws_ami" "ubuntu_14_ami" {
most_recent = true
filter {
name = "owner-id"
values = ["099720109477"]
}
filter {
name = "name"
values = ["ubuntu/images/*/ubuntu-*-14.04-*-server-*"]
}
filter {
name = "architecture"
values = ["x86_64"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
filter {
name = "block-device-mapping.volume-type"
values = ["gp2"]
}
filter {
name = "image-type"
values = ["machine"]
}
}
resource "aws_instance" "mixlib_install_sh" {
count = 1
ami = "${data.aws_ami.ubuntu_14_ami.id}"
instance_type = "${var.aws_instance_type}"
key_name = "es-infrastructure"
associate_public_ip_address = true
subnet_id = "subnet-11ac0174" # Planet Releng Public Subnet
source_dest_check = false
vpc_security_group_ids = [
"sg-96274af3",
]
connection {
user = "ubuntu"
private_key = "${file("${var.connection_private_key}")}"
agent = "${var.connection_agent}"
timeout = "10m"
}
tags {
# ChefOps's AWS standard tags:
X-Dept = "EngServ"
X-Contact = "pwright"
X-Production = "false"
X-Environment = "acceptance"
X-Application = "mixlib-install"
}
provisioner "file" {
source = "../../.acceptance_data/ubuntu_install_command.sh"
destination = "/tmp/install.sh"
}
provisioner "remote-exec" {
inline = [
"chmod +x /tmp/install.sh",
"sudo bash /tmp/install.sh",
]
}
}
|