46 lines
No EOL
1.3 KiB
Text
46 lines
No EOL
1.3 KiB
Text
resource "aws_instance" "docker_host" {
|
|
ami = "ami-0c55b159cbfafe1f0"
|
|
instance_type = "t3.micro"
|
|
key_name = aws_key_pair.deployer.key_name
|
|
|
|
provisioner "file" {
|
|
source = "../install_docker.sh"
|
|
destination = "/home/ubuntu/install_docker.sh"
|
|
|
|
connection {
|
|
type = "ssh"
|
|
user = "ubuntu"
|
|
private_key = file(var.private_key_path)
|
|
host = self.public_ip
|
|
}
|
|
}
|
|
|
|
provisioner "file" {
|
|
source = "../setup.sh"
|
|
destination = "/home/ubuntu/setup.sh"
|
|
|
|
connection {
|
|
type = "ssh"
|
|
user = "ubuntu"
|
|
private_key = file(var.private_key_path)
|
|
host = self.public_ip
|
|
}
|
|
}
|
|
|
|
provisioner "remote-exec" {
|
|
inline = [
|
|
"chmod +x /home/ubuntu/install_docker.sh",
|
|
"sudo /home/ubuntu/install_docker.sh",
|
|
"chmod +x /home/ubuntu/setup.sh",
|
|
"sed -i '/^\s*read\b/ s/^/#/' /home/ubuntu/setup.sh",
|
|
"sudo VERSION=${var.version} ENVIRONMENT=${var.environment} HTTP_METHOD=${var.http_method} PUBLIC_URL=${var.public_url} default_language=${var.default_language} DOCKER_VOLUME_OWNER=${var.docker_volume_owner} /home/ubuntu/setup.sh"
|
|
]
|
|
|
|
connection {
|
|
type = "ssh"
|
|
user = "ubuntu"
|
|
private_key = file(var.private_key_path)
|
|
host = self.public_ip
|
|
}
|
|
}
|
|
} |