Я пытаюсь вставить ELB из моей службы ECS, используя этот файл terraform
Но его применение дает ошибку ниже. Есть идеи по поводу настройки, которые я ошибся?
$ terraform apply ...
aws_ecs_task_definition.beatthemarket-task: Refreshing state... (ID: beatthemarket)
aws_ecs_cluster.default: Refreshing state... (ID: arn:aws:ecs:us-west-1:186598327969:cluster/beatthemarket)
aws_iam_role.beathemarket-role: Refreshing state... (ID: beathemarket-role)
aws_elb.beathemarket-elb: Refreshing state... (ID: beathemarket-elb)
aws_ecs_service.beatthemarket_service: Creating...
cluster: "" => "arn:aws:ecs:us-west-1:186598327969:cluster/beatthemarket"
deployment_maximum_percent: "" => "200"
deployment_minimum_healthy_percent: "" => "100"
desired_count: "" => "1"
iam_role: "" => "arn:aws:iam::186598327969:role/beathemarket-role"
load_balancer.#: "" => "1"
load_balancer.2282006059.container_name: "" => "beatthemarket_service"
load_balancer.2282006059.container_port: "" => "8080"
load_balancer.2282006059.elb_name: "" => "beathemarket-elb"
name: "" => "beatthemarket-service"
task_definition: "" => "arn:aws:ecs:us-west-1:186598327969:task-definition/beatthemarket:2"
Error applying plan:
1 error(s) occurred:
* aws_ecs_service.beatthemarket_service: InvalidParameterException: The container beatthemarket_service does not exist in the task definition.
status code: 400, request id: 67ef4ee6-08e8-11e6-9b7a-95aa41386391
Панайотис Мустафеллос в #devopsengineers Slack channel действительно помог мне решить эту проблему. Оказывается, beatthemarket_service
контейнер не существует. (Смущенно) Это beatthemarket
задача название определения.
Я просто заменил
resource "aws_ecs_service" "beatthemarket_service" {
name = "beatthemarket-service"
cluster = "${aws_ecs_cluster.default.id}"
task_definition = "${aws_ecs_task_definition.beatthemarket-task.arn}"
desired_count = 1
iam_role = "${aws_iam_role.beatthemarket_role.arn}"
load_balancer {
elb_name = "${aws_elb.beathemarket-elb.name}"
container_name = "beatthemarket_service"
container_port = 8080
}
}
с участием
resource "aws_ecs_service" "beatthemarket_service" {
name = "beatthemarket-service"
cluster = "${aws_ecs_cluster.default.id}"
task_definition = "${aws_ecs_task_definition.beatthemarket-task.arn}"
desired_count = 1
iam_role = "${aws_iam_role.beatthemarket_role.arn}"
load_balancer {
elb_name = "${aws_elb.beathemarket-elb.name}"
container_name = "beatthemarket"
container_port = 8080
}
}