我对terraform和ecs并不熟悉,我正在使用此示例https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/ecs-alb创建ECS EC2类型的集群,该集群将自动缩放并使用应用程序负载均衡器我的问题是:main.tf中的此代码段如何>>
--- resource "aws_ecs_service" "test" { name = "tf-example-ecs-ghost" cluster = "${aws_ecs_cluster.main.id}" task_definition = "${aws_ecs_task_definition.ghost.arn}" desired_count = "${var.service_desired}" iam_role = "${aws_iam_role.ecs_service.name}" load_balancer { target_group_arn = "${aws_alb_target_group.test.id}" container_name = "ghost" container_port = "2368" } depends_on = [ "aws_iam_role_policy.ecs_service", "aws_alb_listener.front_end", ] } ---
连接到资源“ aws_autoscaling_group”“ app”
resource "aws_autoscaling_group" "app" { name = "tf-test-asg" vpc_zone_identifier = ["${aws_subnet.main.*.id}"] min_size = "${var.asg_min}" max_size = "${var.asg_max}" desired_capacity = "${var.asg_desired}" launch_configuration = "${aws_launch_configuration.app.name}" }
ECS服务定义如何知道在哪里可以找到此自动伸缩组,因为ecs-service资源定义中没有指向资源自动伸缩组的插值变量。它引用了目标组,但是目标组未引用自动伸缩组-这就是为什么我很困惑,因为在资源“ ecs-service”和资源“ aws-autoscaling”之间没有明显的引用。还是代码缺少smth?请尽可能提供详尽的解释。在此先感谢您,并为我的格式设置感到抱歉,因为我不是一个经验丰富的stackoverflow用户。
我对terraform和ecs并不熟悉,我正在使用此示例https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/ecs-alb创建ECS EC2类型将自动缩放的群集...
不是。