-
-
Notifications
You must be signed in to change notification settings - Fork 355
feat: allow for extra_container_definitions #162
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
2d60cdf
to
e43cdc5
Compare
e43cdc5
to
a9893c1
Compare
@antonbabenko any chance I could get some feedback on this? |
a9893c1
to
3803466
Compare
@marcoceppi I will look into this in detail and comment/merge on Friday. |
There is no need to have another variable just for this because there is already a variable you can use for this. Here is the example code: module "main_container_definition" {
source = "cloudposse/ecs-container-definition/aws"
version = "v0.40.0"
container_name = "atlantis"
container_image = "atlantis/atlantis:latest"
container_cpu = 1024
container_memory = 1024
container_memory_reservation = 512
port_mappings = [
{
containerPort = 4141
hostPort = 4141
protocol = "tcp"
},
]
}
module "sidecar_container_definition" {
source = "cloudposse/ecs-container-definition/aws"
version = "v0.40.0"
container_name = "sidecar"
container_image = "sidecar/sidecar:latest"
}
module "atlantis" {
source = "........"
#######
custom_container_definitions = "[${module.main_container_definition.json_map_encoded}, ${module.sidecar_container_definition.json_map_encoded}]"
#######
} |
I'm aware the option to override all container definitions. However, I don't think it's a very good configuration option - especially for this use case. First, it requires authors to understand how the atlantis ecs-definition was created - which I'd argue is the main allure to this module. It also means that users now need to track changes to the atlantis definition as subsequent upgrades / configurations / changes to this module that might fix bugs, address security concerns, or instrument newer best practices for running Atlantis would be lost because the user as forced to re-define the definition. Furthermore, the custom_container_definitions effectively nerfs a large portion of the existing configuration for this module, rendering them no-ops on the module and requiring users to re-instrument them outside of the module (managing source control secrets, environment variables, atlantis configuration flags, log configuration, etc). Hopefully you can see that these two options, while similar, produce a vastly different outcome. |
I agree that your arguments are very valid. v2.26.0 has been just released. |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Description
This expands the options by allowing users to add supplimentary container definitions in addition to the existing replacement of all container definitions.
The current limit is
var.ecs_task_cpu
is used for both the atlantis container definition and the task definition which means there's no room for any additional container definitions to use CPU. This is okay for me, as my sidecar exits 0 after writing files to the shared volume, but I may add avar.ecs_container_cpu
which will default toecs_task_cpu
if it's not set, but will allow an author to expand the task CPU limits and the container limits independently.Motivation and Context
This allows me, in particular, to provide additional sidecars while still using the recommended container definitions. It primarily addresses #133
Breaking Changes
This is a supplementary change and should not break compatibility
How Has This Been Tested?
This has been tested today using a very similar template below: