From 5e4cde0f1ba46affa5a908fce8e615a78134ff5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20Stru=C3=9F?=
<31846129+applike-ss@users.noreply.github.com>
Date: Wed, 21 Feb 2024 12:16:00 +0100
Subject: [PATCH] feat: allow ecs service changes (e.g. image updates) (#39)
## Description
## Motivation and Context
## Breaking Changes
## How Has This Been Tested?
- [ ] I have updated at least one of the `examples/*` to demonstrate and
validate my change(s)
- [ ] I have tested and validated these changes using one or more of the
provided `examples/*` projects
- [ ] I have executed `pre-commit run -a` on my pull request
---
README.md | 1 +
main.tf | 15 ++++++++-------
variables.tf | 6 ++++++
3 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index e3f94ff..7408b99 100644
--- a/README.md
+++ b/README.md
@@ -51,6 +51,7 @@
| [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| [environment\_variables](#input\_environment\_variables) | The environment variables to pass to the container. This is a map of string: {key: value}. map\_environment overrides environment | `map(string)` | `null` | no |
| [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no |
+| [ignore\_changes\_task\_definition](#input\_ignore\_changes\_task\_definition) | Whether to ignore changes in container definition and task definition in the ECS service | `bool` | `false` | no |
| [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.
Does not affect keys of tags passed in via the `tags` input.
Possible values: `lower`, `title`, `upper`.
Default value: `title`. | `string` | `null` | no |
| [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.
Defaults to ["namespace", "environment", "stage", "name", "attributes"].
You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
| [label\_orders](#input\_label\_orders) | Overrides the `labels_order` for the different labels to modify ID elements appear in the `id` |
object({| `{}` | no | diff --git a/main.tf b/main.tf index ec7ff9e..6fad321 100644 --- a/main.tf +++ b/main.tf @@ -151,13 +151,14 @@ module "ecs_service_task" { source = "justtrackio/ecs-alb-service-task/aws" version = "1.0.0" - container_definition_json = "[${module.node_exporter_definition.json_map_encoded},${module.cadvisor_definition.json_map_encoded}]" - ecs_cluster_arn = var.ecs_cluster_arn - launch_type = "EC2" - scheduling_strategy = "DAEMON" - task_cpu = var.task_cpu - task_memory = var.task_memory - network_mode = "host" + container_definition_json = "[${module.node_exporter_definition.json_map_encoded},${module.cadvisor_definition.json_map_encoded}]" + ecs_cluster_arn = var.ecs_cluster_arn + ignore_changes_task_definition = var.ignore_changes_task_definition + launch_type = "EC2" + scheduling_strategy = "DAEMON" + task_cpu = var.task_cpu + task_memory = var.task_memory + network_mode = "host" docker_volumes = [ { host_path = "/" diff --git a/variables.tf b/variables.tf index 63dd427..eb3d6c0 100644 --- a/variables.tf +++ b/variables.tf @@ -39,6 +39,12 @@ variable "environment_variables" { default = null } +variable "ignore_changes_task_definition" { + type = bool + description = "Whether to ignore changes in container definition and task definition in the ECS service" + default = false +} + variable "label_orders" { type = object({ cloudwatch = optional(list(string)),
cloudwatch = optional(list(string)),
ecs = optional(list(string)),
iam = optional(list(string)),
vpc = optional(list(string))
})