Skip to content

Commit

Permalink
feat: allow ecs service changes (e.g. image updates) (#39)
Browse files Browse the repository at this point in the history
## Description
<!--- Describe your changes in detail -->

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## Breaking Changes
<!-- Does this break backwards compatibility with the current major
version? -->
<!-- If so, please provide an explanation why it is necessary. -->

## 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
<!--- Users should start with an existing example as its written, deploy
it, then check their changes against it -->
<!--- This will highlight breaking/disruptive changes. Once you have
checked, deploy your changes to verify -->
<!--- Please describe how you tested your changes -->
- [ ] I have executed `pre-commit run -a` on my pull request
<!--- Please see
https://github.com/antonbabenko/pre-commit-terraform#how-to-install for
how to install -->
  • Loading branch information
applike-ss authored Feb 21, 2024
1 parent 5f9a5ad commit 5e4cde0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
| <a name="input_environment_variables"></a> [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 |
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
| <a name="input_ignore_changes_task_definition"></a> [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 |
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
| <a name="input_label_orders"></a> [label\_orders](#input\_label\_orders) | Overrides the `labels_order` for the different labels to modify ID elements appear in the `id` | <pre>object({<br> cloudwatch = optional(list(string)),<br> ecs = optional(list(string)),<br> iam = optional(list(string)),<br> vpc = optional(list(string))<br> })</pre> | `{}` | no |
Expand Down
15 changes: 8 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "/"
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down

0 comments on commit 5e4cde0

Please sign in to comment.