Я добавил поставщика файлов к ресурсу aws_launch_configuration и вижу тайм-ауты SSH.
1 error(s) occurred:
* module.dev-agooch.module.web.aws_launch_configuration.primary: timeout - last error: dial tcp :22: connect: connection refused
Я гарантировал, что созданная группа безопасности разрешает входящий трафик ssh.
Вот моя соответствующая конфигурация:
data "template_file" "pg_service_conf" {
template = "${file("${path.module}/pg_service_conf.tpl")}"
vars {
db_host = "${var.db_host}"
db_port = "${var.db_port}"
}
}
resource "aws_launch_configuration" "primary" {
name_prefix = "${var.cluster_name}"
image_id = "${var.ami}"
instance_type = "${var.instance_type}"
security_groups = ["${aws_security_group.backend.id}"]
key_name = "${var.key_name}"
user_data = <<-EOF
#!/bin/bash
apt-get install nginx -y
echo "Hello from primary `hostname`" > /var/www/html/index.html
EOF
lifecycle {
create_before_destroy = true
}
provisioner "file" {
content = "${data.template_file.pg_service_conf.rendered}"
destination = "/home/admin/.pg_service.conf"
}
}
resource "aws_autoscaling_group" "primary" {
name = "${var.cluster_name}-primary"
launch_configuration = "${aws_launch_configuration.primary.id}"
availability_zones = ["${data.aws_availability_zones.all.names}"]
target_group_arns = ["${aws_alb_target_group.frontend.arn}"]
desired_capacity = 1
min_size = 1
max_size = 1
}
resource "aws_security_group" "backend" {
name = "${var.cluster_name}-backend-sg"
lifecycle {
create_before_destroy = true
}
}
resource "aws_security_group_rule" "backend_allow_http_inbound" {
type = "ingress"
security_group_id = "${aws_security_group.backend.id}"
from_port = "${local.http_port}"
to_port = "${local.http_port}"
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
resource "aws_security_group_rule" "backend_allow_ssh_inbound" {
type = "ingress"
security_group_id = "${aws_security_group.backend.id}"
from_port = "${local.ssh_port}"
to_port = "${local.ssh_port}"
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
resource "aws_security_group_rule" "backend_allow_all_outbound" {
type = "egress"
security_group_id = "${aws_security_group.backend.id}"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
Я использую версию Terraform v0.11.7, provider.aws v1.25.0, provider.template v1.0.0.
Каков наилучший способ получить больше информации от Terraform о проблеме? Есть какие-то ошибки, о которых я не знаю?
Большое спасибо заранее!