From f110c4f0727fe5ffb1b98eac4db3c5abaafa2959 Mon Sep 17 00:00:00 2001 From: Alexander Simmerl Date: Mon, 27 Mar 2017 14:51:31 +0200 Subject: [PATCH] Fix callback url --- cmd/terraformer/terraformer.go | 1 - infrastructure/terraform/template/platform.tf | 10 ++++++++++ infrastructure/terraform/template/scheduling.tf | 9 ++++++++- infrastructure/terraform/template/variables.tf | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cmd/terraformer/terraformer.go b/cmd/terraformer/terraformer.go index 86039e6..84cf443 100644 --- a/cmd/terraformer/terraformer.go +++ b/cmd/terraformer/terraformer.go @@ -179,7 +179,6 @@ func main() { } args = []string{ - argState, stateFile, planFile, } diff --git a/infrastructure/terraform/template/platform.tf b/infrastructure/terraform/template/platform.tf index ee241eb..4d3c5e3 100644 --- a/infrastructure/terraform/template/platform.tf +++ b/infrastructure/terraform/template/platform.tf @@ -15,6 +15,16 @@ data "template_file" "domain_canonical" { } } +data "template_file" "domain_full" { + template = "$${sub}.$${root}.$${tld}" + + vars { + root = "${element(split(".", var.domain), length(split(".", var.domain)) - 2)}" + sub = "${element(split(".", var.domain), length(split(".", var.domain)) - 3)}" + tld = "${element(split(".", var.domain), length(split(".", var.domain)) - 1)}" + } +} + resource "aws_elb" "console" { connection_draining = true connection_draining_timeout = 10 diff --git a/infrastructure/terraform/template/scheduling.tf b/infrastructure/terraform/template/scheduling.tf index ad3eb18..13eb3ea 100644 --- a/infrastructure/terraform/template/scheduling.tf +++ b/infrastructure/terraform/template/scheduling.tf @@ -9,8 +9,15 @@ resource "aws_ecs_service" "console" { deployment_maximum_percent = 200 deployment_minimum_healthy_percent = 50 desired_count = 2 + iam_role = "${aws_iam_role.ecs-scheduler.arn}" name = "console" task_definition = "${aws_ecs_task_definition.console.arn}" + + load_balancer { + container_name = "console" + container_port = 8084 + elb_name = "${aws_elb.console.id}" + } } resource "aws_ecs_task_definition" "console" { @@ -22,7 +29,7 @@ resource "aws_ecs_task_definition" "console" { "command": [ "./console", "-env", "${var.env}", - "-google.callback", "https://console-${var.env}-${var.region}.${data.template_file.domain_canonical.rendered}/oauth2callback", + "-google.callback", "https://console-${var.env}-${var.region}.${data.template_file.domain_full.rendered}/oauth2callback", "-google.client.id", "${var.google_client_id}", "-google.client.secret", "${var.google_client_secret}", "-postgres.url", "postgres://${var.pg_username}:${var.pg_password}@${aws_route53_record.service-master.fqdn}:5432/${var.pg_db_name}?connect_timeout=5&sslmode=require", diff --git a/infrastructure/terraform/template/variables.tf b/infrastructure/terraform/template/variables.tf index 0424835..def28b1 100644 --- a/infrastructure/terraform/template/variables.tf +++ b/infrastructure/terraform/template/variables.tf @@ -123,6 +123,7 @@ variable "pg_password" { variable "version" { default = { + "console" = "289" "gateway-http" = "259" "sims" = "259" }