Skip to content

Commit 54ee8c4

Browse files
committed
feat: allow setting container memory & cpu from task memory & cpu
fixes #168
1 parent 66484ba commit 54ee8c4

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ allow_github_webhooks = true
222222
| cloudwatch\_log\_retention\_in\_days | Retention period of Atlantis CloudWatch logs | `number` | `7` | no |
223223
| command | The command that is passed to the container | `list(string)` | `null` | no |
224224
| container\_depends\_on | The dependencies defined for container startup and shutdown. A container can contain multiple dependencies. When a dependency is defined for container startup, for container shutdown it is reversed. The condition can be one of START, COMPLETE, SUCCESS or HEALTHY | <pre>list(object({<br> containerName = string<br> condition = string<br> }))</pre> | `null` | no |
225+
| container\_cpu | The number of cpu units used by the atlantis container. If not specified ecs\_task\_cpu will be used | `number` | `null` | no |
226+
| container\_memory | The amount (in MiB) of memory used by the atlantis container. If not specified ecs\_task\_memory will be used | `number` | `null` | no |
225227
| container\_memory\_reservation | The amount of memory (in MiB) to reserve for the container | `number` | `128` | no |
226228
| create\_route53\_record | Whether to create Route53 record for Atlantis | `bool` | `true` | no |
227229
| custom\_container\_definitions | A list of valid container definitions provided as a single valid JSON document. By default, the standard container definition is used. | `string` | `""` | no |

main.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ module "container_definition_github_gitlab" {
448448
container_name = var.name
449449
container_image = local.atlantis_image
450450

451-
container_cpu = var.ecs_task_cpu
452-
container_memory = var.ecs_task_memory
451+
container_cpu = var.container_cpu != null ? var.container_cpu : var.ecs_task_cpu
452+
container_memory = var.container_memory != null ? var.container_memory : var.ecs_task_memory
453453
container_memory_reservation = var.container_memory_reservation
454454

455455
user = var.user
@@ -505,8 +505,8 @@ module "container_definition_bitbucket" {
505505
container_name = var.name
506506
container_image = local.atlantis_image
507507

508-
container_cpu = var.ecs_task_cpu
509-
container_memory = var.ecs_task_memory
508+
container_cpu = var.container_cpu != null ? var.container_cpu : var.ecs_task_cpu
509+
container_memory = var.container_memory != null ? var.container_memory : var.ecs_task_memory
510510
container_memory_reservation = var.container_memory_reservation
511511

512512
user = var.user

variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,18 @@ variable "ecs_task_memory" {
281281
default = 512
282282
}
283283

284+
variable "container_cpu" {
285+
description = "The number of cpu units used by the atlantis container. If not specified ecs\_task\_cpu will be used"
286+
type = number
287+
default = null
288+
}
289+
290+
variable "container_memory" {
291+
description = "The amount (in MiB) of memory used by the atlantis container. If not specified ecs\_task\_memory will be used"
292+
type = number
293+
default = null
294+
}
295+
284296
variable "container_memory_reservation" {
285297
description = "The amount of memory (in MiB) to reserve for the container"
286298
type = number

0 commit comments

Comments
 (0)