Skip to content

Commit 7c9bf6c

Browse files
ztzxtjoe-nilandcloudpossebotNurumax-lobur
authoredFeb 25, 2025··
feat: rebase cloudposse (#10)
## 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 --> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Joe Niland <joe@originalmind.com.au> Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com> Co-authored-by: Nuru <Nuru@users.noreply.github.com> Co-authored-by: Max Lobur <max_lobur@outlook.com> Co-authored-by: Yunchi Luo <mightyguava@gmail.com> Co-authored-by: Jeremy White <jeremy.white@cloudposse.com> Co-authored-by: Veronika Gnilitska <30597968+gberenice@users.noreply.github.com> Co-authored-by: Lukas Deutz <5903157+lagerfeuer@users.noreply.github.com> Co-authored-by: Kevin Mahoney <kevin@icecube.dog> Co-authored-by: Michael Manganiello <adamantike@users.noreply.github.com> Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <erik@cloudposse.com> Co-authored-by: Cloud Posse Bot (CI/CD) <bot@cloudposse.com> Co-authored-by: max-lobur <max-lobur@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: readme-action 📖 <actions@github.com> Co-authored-by: Alex Kaplan <awkaplan@users.noreply.github.com> Co-authored-by: Alex Kaplan <akaplan@akiliinteractive.com> Co-authored-by: RoseSecurity <72598486+RoseSecurity@users.noreply.github.com> Co-authored-by: Markiian Slipets <53615853+mslipets@users.noreply.github.com> Co-authored-by: Dmitrij Nikitenko <dmitrij@nikitenko.lv> Co-authored-by: Roman Kulaiev <kulayev.roman@gmail.com>
1 parent ef14fca commit 7c9bf6c

File tree

6 files changed

+440
-58
lines changed

6 files changed

+440
-58
lines changed
 

‎README.md

+15-4
Large diffs are not rendered by default.

‎docs/terraform.md

Whitespace-only changes.

‎main.tf

+297-35
Large diffs are not rendered by default.

‎outputs.tf

+18-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
output "ecs_exec_role_policy_id" {
22
description = "The ECS service role policy ID, in the form of `role_name:role_policy_name`"
3-
value = join("", [
3+
value = one([
44
for k, v in aws_iam_role_policy.ecs_exec : v.id
55
])
66
}
77

88
output "ecs_exec_role_policy_name" {
99
description = "ECS service role name"
10-
value = join("", [
10+
value = one([
1111
for k, v in aws_iam_role_policy.ecs_exec : v.name
1212
])
1313
}
@@ -24,55 +24,60 @@ output "service_arn" {
2424

2525
output "service_role_arn" {
2626
description = "ECS Service role ARN"
27-
value = join("", aws_iam_role.ecs_service[*].arn)
27+
value = one(aws_iam_role.ecs_service[*]["arn"])
2828
}
2929

3030
output "task_exec_role_name" {
3131
description = "ECS Task role name"
32-
value = join("", aws_iam_role.ecs_exec[*].name)
32+
value = one(aws_iam_role.ecs_exec[*]["name"])
3333
}
3434

3535
output "task_exec_role_arn" {
3636
description = "ECS Task exec role ARN"
37-
value = length(local.task_exec_role_arn) > 0 ? local.task_exec_role_arn : join("", aws_iam_role.ecs_exec[*].arn)
37+
value = length(local.task_exec_role_arn) > 0 ? local.task_exec_role_arn : one(aws_iam_role.ecs_exec[*]["arn"])
3838
}
3939

4040
output "task_exec_role_id" {
4141
description = "ECS Task exec role id"
42-
value = join("", aws_iam_role.ecs_exec[*].unique_id)
42+
value = one(aws_iam_role.ecs_exec[*]["unique_id"])
4343
}
4444

4545
output "task_role_name" {
4646
description = "ECS Task role name"
47-
value = join("", aws_iam_role.ecs_task[*].name)
47+
value = one(aws_iam_role.ecs_task[*]["name"])
4848
}
4949

5050
output "task_role_arn" {
5151
description = "ECS Task role ARN"
52-
value = length(local.task_role_arn) > 0 ? local.task_role_arn : join("", aws_iam_role.ecs_task[*].arn)
52+
value = length(local.task_role_arn) > 0 ? local.task_role_arn : one(aws_iam_role.ecs_task[*]["arn"])
5353
}
5454

5555
output "task_role_id" {
5656
description = "ECS Task role id"
57-
value = join("", aws_iam_role.ecs_task[*].unique_id)
57+
value = one(aws_iam_role.ecs_task[*]["unique_id"])
5858
}
5959

6060
output "service_security_group_id" {
6161
description = "Security Group ID of the ECS task"
62-
value = join("", aws_security_group.ecs_service[*].id)
62+
value = one(aws_security_group.ecs_service[*]["id"])
6363
}
6464

6565
output "task_definition_family" {
6666
description = "ECS task definition family"
67-
value = join("", aws_ecs_task_definition.default[*].family)
67+
value = one(aws_ecs_task_definition.default[*]["family"])
6868
}
6969

7070
output "task_definition_revision" {
7171
description = "ECS task definition revision"
72-
value = join("", aws_ecs_task_definition.default[*].revision)
72+
value = one(aws_ecs_task_definition.default[*]["revision"])
7373
}
7474

7575
output "task_definition_arn" {
7676
description = "ECS task definition ARN"
77-
value = join("", aws_ecs_task_definition.default[*].arn)
77+
value = one(aws_ecs_task_definition.default[*]["arn"])
78+
}
79+
80+
output "task_definition_arn_without_revision" {
81+
description = "ECS task definition ARN without revision"
82+
value = one(aws_ecs_task_definition.default[*]["arn_without_revision"])
7883
}

‎variables.tf

+109-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ variable "ecs_load_balancers" {
1212
type = list(object({
1313
container_name = string
1414
container_port = number
15-
elb_name = string
15+
elb_name = optional(string)
1616
target_group_arn = string
1717
}))
1818
description = "A list of load balancer config objects for the ECS service; see [ecs_service#load_balancer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#load_balancer) docs"
@@ -276,6 +276,17 @@ variable "deployment_minimum_healthy_percent" {
276276
default = 100
277277
}
278278

279+
variable "availability_zone_rebalancing" {
280+
type = string
281+
description = "ECS automatically redistributes tasks within a service across Availability Zones (AZs) to mitigate the risk of impaired application availability due to underlying infrastructure failures and task lifecycle activities. The valid values are `ENABLED` and `DISABLED`."
282+
default = "DISABLED"
283+
284+
validation {
285+
condition = contains(["ENABLED", "DISABLED"], var.availability_zone_rebalancing)
286+
error_message = "The valid values are `ENABLED` and `DISABLED`."
287+
}
288+
}
289+
279290
variable "health_check_grace_period_seconds" {
280291
type = number
281292
description = "Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 7200. Only valid for services configured to use load balancers"
@@ -416,8 +427,47 @@ variable "service_registries" {
416427
`container_name = string`
417428
`container_port = number`
418429
EOT
430+
default = []
431+
}
419432

420-
default = []
433+
variable "service_connect_configurations" {
434+
type = list(object({
435+
enabled = bool
436+
namespace = optional(string, null)
437+
log_configuration = optional(object({
438+
log_driver = string
439+
options = optional(map(string), null)
440+
secret_option = optional(list(object({
441+
name = string
442+
value_from = string
443+
})), [])
444+
}), null)
445+
service = optional(list(object({
446+
client_alias = list(object({
447+
dns_name = string
448+
port = number
449+
}))
450+
timeout = optional(list(object({
451+
idle_timeout_seconds = optional(number, null)
452+
per_request_timeout_seconds = optional(number, null)
453+
})), [])
454+
tls = optional(list(object({
455+
kms_key = optional(string, null)
456+
role_arn = optional(string, null)
457+
issuer_cert_authority = object({
458+
aws_pca_authority_arn = string
459+
})
460+
})), [])
461+
discovery_name = optional(string, null)
462+
ingress_port_override = optional(number, null)
463+
port_name = string
464+
})), [])
465+
}))
466+
description = <<-EOT
467+
The list of Service Connect configurations.
468+
See `service_connect_configuration` docs https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service#service_connect_configuration
469+
EOT
470+
default = []
421471
}
422472

423473
variable "permissions_boundary" {
@@ -505,10 +555,64 @@ variable "ecs_service_role_enabled" {
505555

506556
variable "label_orders" {
507557
type = object({
508-
ecs = optional(list(string)),
509-
iam = optional(list(string)),
510-
vpc = optional(list(string))
558+
ecs = optional(list(string)),
559+
iam = optional(list(string)),
560+
service_connect = optional(list(string)),
561+
vpc = optional(list(string))
511562
})
512563
default = {}
513564
description = "Overrides the `labels_order` for the different labels to modify ID elements appear in the `id`"
514565
}
566+
567+
variable "ipc_mode" {
568+
type = string
569+
description = <<-EOT
570+
The IPC resource namespace to be used for the containers in the task.
571+
The valid values are `host`, `task`, and `none`. If `host` is specified,
572+
then all containers within the tasks that specified the `host` IPC mode on
573+
the same container instance share the same IPC resources with the host
574+
Amazon EC2 instance. If `task` is specified, all containers within the
575+
specified task share the same IPC resources. If `none` is specified, then
576+
IPC resources within the containers of a task are private and not shared
577+
with other containers in a task or on the container instance. If no value
578+
is specified, then the IPC resource namespace sharing depends on the
579+
Docker daemon setting on the container instance. For more information, see
580+
IPC settings in the Docker documentation."
581+
EOT
582+
default = null
583+
validation {
584+
condition = var.ipc_mode == null || contains(["host", "task", "none"], coalesce(var.ipc_mode, "null"))
585+
error_message = "The ipc_mode value must be one of host, task, or none."
586+
}
587+
}
588+
589+
variable "pid_mode" {
590+
type = string
591+
description = <<-EOT
592+
The process namespace to use for the containers in the task. The valid
593+
values are `host` and `task`. If `host` is specified, then all containers
594+
within the tasks that specified the `host` PID mode on the same container
595+
instance share the same process namespace with the host Amazon EC2 instanc
596+
. If `task` is specified, all containers within the specified task share
597+
the same process namespace. If no value is specified, then the process
598+
namespace sharing depends on the Docker daemon setting on the container
599+
instance. For more information, see PID settings in the Docker documentation.
600+
EOT
601+
default = null
602+
validation {
603+
condition = var.pid_mode == null || contains(["host", "task"], coalesce(var.pid_mode, "null"))
604+
error_message = "The pid_mode value must be one of host or task."
605+
}
606+
}
607+
608+
variable "track_latest" {
609+
type = bool
610+
description = "Whether should track latest task definition or the one created with the resource."
611+
default = false
612+
}
613+
614+
variable "enable_fault_injection" {
615+
type = bool
616+
description = "Enables fault injection and allows for fault injection requests to be accepted from the task's containers"
617+
default = false
618+
}

‎versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 4.40, != 5.71.0"
7+
version = ">= 5.85"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)
Please sign in to comment.