From ccc6254ce8441f832cd8a74adf3bc0bef3e61514 Mon Sep 17 00:00:00 2001 From: Tim Hartmann Date: Tue, 6 Mar 2018 15:07:18 -0500 Subject: [PATCH] rename healthcheck to sidecar (#1) * rename healthcheck to sidecar Changed references to healthcheck to sidecar * Formatting * Update IAM Permissions Adding the correct IAM permissions for some of the checks in our sidecar --- README.md | 4 ++-- main.tf | 8 ++++++-- templates/consul.json | 8 ++++---- variables.tf | 8 ++++---- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 85e1201..94df8ac 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ This module - `consul_image` - Image to use when deploying consul, defaults to the hashicorp consul image - `consul_memory_reservation` - The soft limit (in MiB) of memory to reserve for the container, (defaults 32) - `definitions` - List of Consul Service and Health Check Definitions -- `healthcheck_image` - Image to use when deploying health check agent, defaults to fitnesskeeper/consul-healthchecks:latest image -- `healthcheck_memory_reservation` - The soft limit (in MiB) of memory to reserve for the container, defaults 32 +- `sidecar_image` - Image to use when deploying health check agent, defaults to fitnesskeeper/consul-sidecar:latest image +- `sidecar_memory_reservation` - The soft limit (in MiB) of memory to reserve for the container, defaults 32 - `iam_path` - IAM path, this is useful when creating resources with the same name across multiple regions. (Defaults to /) - `registrator_image` - Image to use when deploying registrator agent, defaults to the gliderlabs registrator:latest image - `registrator_memory_reservation` The soft limit (in MiB) of memory to reserve for the container, defaults 32 diff --git a/main.tf b/main.tf index ecc6269..dd66403 100644 --- a/main.tf +++ b/main.tf @@ -14,10 +14,10 @@ data "template_file" "consul" { definitions = "${join(" ", var.definitions)}" image = "${var.consul_image}" registrator_image = "${var.registrator_image}" - healthcheck_image = "${var.healthcheck_image}" + sidecar_image = "${var.sidecar_image}" consul_memory_reservation = "${var.consul_memory_reservation}" registrator_memory_reservation = "${var.registrator_memory_reservation}" - healthcheck_memory_reservation = "${var.healthcheck_memory_reservation}" + sidecar_memory_reservation = "${var.sidecar_memory_reservation}" awslogs_group = "consul-agent-${var.ecs_cluster}" awslogs_stream_prefix = "consul-agent-${var.ecs_cluster}" awslogs_region = "${data.aws_region.current.name}" @@ -31,6 +31,10 @@ data "aws_iam_policy_document" "consul_task_policy" { actions = [ "ec2:Describe*", "autoscaling:Describe*", + "cloudwatch:PutMetricData", + "ecs:DescribeClusters", + "ecs:UpdateContainerInstancesState", + "ecs:DescribeContainerInstances", ] resources = ["*"] diff --git a/templates/consul.json b/templates/consul.json index 2f63c23..ea7d0aa 100644 --- a/templates/consul.json +++ b/templates/consul.json @@ -22,7 +22,7 @@ ], "volumesFrom": [ { - "sourceContainer": "consul-healthchecks-${env}" + "sourceContainer": "consul-sidecar-${env}" } ], "portMappings": [ @@ -38,11 +38,11 @@ } }, { - "name": "consul-healthchecks-${env}", - "image": "${healthcheck_image}", + "name": "consul-sidecar-${env}", + "image": "${sidecar_image}", "essential": true, "cpu": 0, - "memoryReservation": ${healthcheck_memory_reservation}, + "memoryReservation": ${sidecar_memory_reservation}, "environment": [ { "name": "CHECKS", diff --git a/variables.tf b/variables.tf index c2ab4e8..8d42b00 100644 --- a/variables.tf +++ b/variables.tf @@ -18,12 +18,12 @@ variable "ecs_cluster" { description = "EC2 Container Service cluster in which the service will be deployed (must already exist, the module will not create it)." } -variable "healthcheck_image" { - default = "fitnesskeeper/consul-healthchecks" - description = "Image to use when deploying health check agent, defaults to fitnesskeeper/consul-healthchecks:latest image" +variable "sidecar_image" { + default = "fitnesskeeper/consul-sidecar" + description = "Image to use when deploying health check agent, defaults to fitnesskeeper/consul-sidecar:latest image" } -variable "healthcheck_memory_reservation" { +variable "sidecar_memory_reservation" { description = "The soft limit (in MiB) of memory to reserve for the container, defaults 32" default = "32" }