From bcd7c637d00b19a6b08b26fcfe03a06bbbe533f5 Mon Sep 17 00:00:00 2001 From: Russell Maclean Date: Thu, 3 Mar 2016 19:39:13 +1100 Subject: [PATCH] ECS with ELB not possible due to https://github.com/hashicorp/terraform/issues/5442 --- ecs.tf | 108 ++++++++++++++++++++++++++++----------------------------- iam.tf | 4 +-- vpc.tf | 8 +++++ 3 files changed, 64 insertions(+), 56 deletions(-) diff --git a/ecs.tf b/ecs.tf index 9d2a7a6..b98fe22 100644 --- a/ecs.tf +++ b/ecs.tf @@ -48,66 +48,66 @@ resource "aws_ecs_service" "pdat-ecs-service" { cluster = "${aws_ecs_cluster.pdat-ecs-cluster.id}" task_definition = "${aws_ecs_task_definition.pdat-ecs-wordpress.arn}" desired_count = 1 - iam_role = "${aws_iam_role.pdat-ecs-role.id}" - - load_balancer { - elb_name = "${aws_elb.pdat-elb.id}" - container_name = "${var.container_name}" - container_port = 80 - } - - depends_on = ["aws_iam_role.pdat-ecs-role","aws_instance.pdat-ecs-instance"] - -} +// iam_role = "${aws_iam_role.pdat-ecs-role.arn}" +// +// load_balancer { +// elb_name = "${aws_elb.pdat-elb.id}" +// container_name = "${var.container_name}" +// container_port = 80 +// } +// depends_on = ["aws_elb.pdat-elb","aws_iam_role.pdat-ecs-role","aws_iam_role_policy.pdat-ecs-policy","aws_instance.pdat-ecs-instance"] - -// Create ELB - -resource "aws_s3_bucket" "pdat-elb-s3" { - bucket = "pdat-elb-logs" - acl = "private" - - tags { - Name = "pdat-elb-s3" - } } -resource "aws_elb" "pdat-elb" { - name = "pdat-elb" - availability_zones = [ - "us-east-1b"] - access_logs { - bucket = "elb-logs" - bucket_prefix = "pdat_" - interval = 60 - } - - listener { - instance_port = 80 - instance_protocol = "http" - lb_port = 80 - lb_protocol = "http" - } - - health_check { - healthy_threshold = 2 - unhealthy_threshold = 2 - timeout = 3 - target = "HTTP:80/" - interval = 30 - } - cross_zone_load_balancing = false - idle_timeout = 400 - connection_draining = false - - tags { - Name = "pdat_elb" - } -} +//// Create ELB +// +//resource "aws_s3_bucket" "pdat-elb-s3" { +// bucket = "pdat-elb-logs" +// acl = "private" +// +// tags { +// Name = "pdat-elb-s3" +// } +//} +// +//resource "aws_elb" "pdat-elb" { +// name = "pdat-elb" +// availability_zones = [ +// "us-east-1b"] +// +// access_logs { +// bucket = "elb-logs" +// bucket_prefix = "pdat_" +// interval = 60 +// } +// +// listener { +// instance_port = 8080 +// instance_protocol = "http" +// lb_port = 80 +// lb_protocol = "http" +// } +// +// health_check { +// healthy_threshold = 2 +// unhealthy_threshold = 2 +// timeout = 3 +// target = "HTTP:80/" +// interval = 30 +// } +// +// cross_zone_load_balancing = false +// idle_timeout = 400 +// connection_draining = false +// +// tags { +// Name = "pdat_elb" +// } +//} output "public EIP" { value = "${aws_instance.pdat-ecs-instance.public_ip}" -} +} \ No newline at end of file diff --git a/iam.tf b/iam.tf index 7b3ee30..764567c 100644 --- a/iam.tf +++ b/iam.tf @@ -8,7 +8,7 @@ resource "aws_iam_instance_profile" "pdat-ecs-profile" { resource "aws_iam_role_policy" "pdat-ecs-policy" { name = "pdat-ecs-policy" - role = "${aws_iam_role.pdat-ecs-role.id}" + role = "${aws_iam_role.pdat-ecs-role.name}" policy = <