-
-
Notifications
You must be signed in to change notification settings - Fork 620
feat: Remove empty containers (map/list) from container definition #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -311,13 +307,14 @@ variable "resourceRequirements" { | |||
variable "restartPolicy" { | |||
description = "Container restart policy; helps overcome transient failures faster and maintain task availability" | |||
type = object({ | |||
enabled = optional(bool) | |||
enabled = optional(bool, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to add this back for this logic to work https://github.com/terraform-aws-modules/terraform-aws-ecs/pull/336/files#diff-2495e85ca74f46479d907910afcb9c141838715fafd982408869e6e7a5e98bbcR71
name = var.name | ||
portMappings = var.portMappings != null ? [for p in var.portMappings : { for k, v in p : k => v if v != null }] : null | ||
privileged = local.is_not_windows ? var.privileged : null | ||
pseudoTerminal = var.pseudoTerminal | ||
readonlyRootFilesystem = local.is_not_windows ? var.readonlyRootFilesystem : null | ||
repositoryCredentials = var.repositoryCredentials | ||
resourceRequirements = var.resourceRequirements | ||
restartPolicy = { for k, v in var.restartPolicy : k => v if v != null } | ||
restartPolicy = local.trimmedRestartPolicy.enabled ? local.trimmedRestartPolicy : null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if enabled = false
then we don't send any configs for restartPolicy
to the Task Definition API call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it works, LGTM :)
## [6.2.0](v6.1.4...v6.2.0) (2025-08-07) ### Features * Remove empty containers (map/list) from container definition ([#336](#336)) ([24746cc](24746cc))
This PR is included in version 6.2.0 🎉 |
Description
Motivation and Context
relates to hashicorp/terraform-provider-aws#17988
Breaking Changes
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull requestDeploying the

complete
example frommaster
and then changing to this PR produces the following desired diff