Skip to content

extra_container_definitions cpu reservation #168

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

Closed
apriljo opened this issue Dec 1, 2020 · 2 comments · Fixed by #169
Closed

extra_container_definitions cpu reservation #168

apriljo opened this issue Dec 1, 2020 · 2 comments · Fixed by #169

Comments

@apriljo
Copy link

apriljo commented Dec 1, 2020

Setting container_cpu in extra_container_definitions variable causes error.

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

  secrets = [
    {
      name      = "DD_API_KEY"
      valueFrom = "${local.atlantis_token_prefix}/datadog/api"
    }
  ]

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

module "atlantis" {
  source  = "terraform-aws-modules/atlantis/aws"
  version = "2.26.0"

  name = "atlantis"

  # DNS
  route53_zone_name = "example.com"

  # Atlantis
  atlantis_image              = "${aws_ecr_repository.atlantis.repository_url}:${local.atlantis_version}"
  extra_container_definitions = [module.datadog_fargate_container_definition.json_map_object]
  atlantis_github_user        = "atlantis"
  atlantis_github_user_token  = "${var.atlantis_github_user_token}"

  atlantis_hide_prev_plan_comments = "true"

  ecs_task_cpu    = 512
  ecs_task_memory = 1024

  allow_repo_config = "true"

  custom_environment_variables = [
  ]

  custom_environment_secrets = [
  ]

  tags = {
    Application = "atlantis"
    Env         = "dev"
  }
}
Error: ClientException: The sum of all container 'cpu' values cannot be greater than the value of the task 'cpu'.

Math might be hard here, perhaps atlantis_container_cpu could be separated from ecs_task_cpu to make the containers configurable separately from the fargate size?

@marcoceppi
Copy link
Contributor

I mentioned this in the PR when I added the extra_container_defintions I should have realized that this would be an issue sooner rather than later. I can open up a PR to extend this.

@github-actions
Copy link

github-actions bot commented Nov 9, 2022

I'm going to lock this issue 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 similar to this, 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 9, 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 a pull request may close this issue.

2 participants