Skip to content

feat: allow setting container memory & cpu from task memory & cpu #169

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

Merged
merged 1 commit into from
Mar 1, 2021

Conversation

marcoceppi
Copy link
Contributor

Description

With the addition of #162 if a user includes extra container definitions and those definitions require CPU/Memory allocations the deployment will fail as the atlantis container definition takes the entire task cpu and memory allocation.

Motivation and Context

This allows a user to optionally fine tune the allocations of cpu and memory for the atlantis container definition. Most users won't require this feature, unless they're using extra_container_definitions.

fixes #168

Breaking Changes

This does not break compatibility as by default the values are null and if null they will default to the ecs_task_* definitions, as it was before this change.

How Has This Been Tested?

module "datadog_fargate_container_definition" {
  source  = "cloudposse/ecs-container-definition/aws"
  version = "v0.41.0"

  container_name  = "datadog-agent"
  container_image = "datadog/agent:latest"

  container_memory_reservation = 256
  container_cpu                = 10

  essential = true

  environment = [
    {
      name  = "ECS_FARGATE"
      value = "true"
    }
  ]
}

module "atlantis" {
  source = "github.com/stacklet/terraform-aws-atlantis?ref=issue-168"

  name = "atlantis"

  # DNS
  route53_zone_name = "example.com"

  # Atlantis
  extra_container_definitions = [module.datadog_fargate_container_definition.json_map_object]
  atlantis_github_user           = "marcoceppi"
  atlantis_github_user_token     = data.aws_kms_secrets.atlantis.plaintext["github_user_token"]

  atlantis_hide_prev_plan_comments = "true"

  container_cpu    = 502
  container_memory = 768

  ecs_task_cpu    = 512
  ecs_task_memory = 1024

  allow_repo_config = "true"
}

@bryantbiggs
Copy link
Member

hi @marcoceppi - thanks for the PR. could you update the github-complete example project to reflect the changes here so that we can both capture how they are utilized as well as test the changes. thank you!

@marcoceppi
Copy link
Contributor Author

Can and will do!

@marcoceppi
Copy link
Contributor Author

@bryantbiggs I've rebased and updated github-complete with the new values

Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once the two changes to the escaping in the variable names are corrected, this should be all set. validated using examples/github-complete @antonbabenko 👍🏼

@marcoceppi
Copy link
Contributor Author

Thanks for the review @bryantbiggs I've updated the description strings and rebased on the latest in master and fixed the errors from pre-commit 0.14.7 check

Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me - @antonbabenko 👍🏼

@antonbabenko antonbabenko merged commit faa4e77 into terraform-aws-modules:master Mar 1, 2021
@antonbabenko
Copy link
Member

Thanks @marcoceppi !

v2.33.0 has been just released.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

extra_container_definitions cpu reservation
3 participants