Skip to content

Commit b14192c

Browse files
committed
feat: allow setting container memory & cpu from task memory & cpu
fixes #168
1 parent 2bef68a commit b14192c

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ allow_github_webhooks = true
255255
| cloudwatch\_log\_retention\_in\_days | Retention period of Atlantis CloudWatch logs | `number` | `7` | no |
256256
| command | The command that is passed to the container | `list(string)` | `null` | no |
257257
| 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 |
258+
| container\_cpu | The number of cpu units used by the atlantis container. If not specified ecs\_task\_cpu will be used | `number` | `null` | no |
259+
| 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 |
258260
| container\_memory\_reservation | The amount of memory (in MiB) to reserve for the container | `number` | `128` | no |
259261
| create\_route53\_record | Whether to create Route53 record for Atlantis | `bool` | `true` | no |
260262
| 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 |

examples/github-complete/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ module "atlantis" {
4040
ecs_task_cpu = 512
4141
ecs_task_memory = 1024
4242
container_memory_reservation = 256
43+
container_cpu = 512
44+
container_memory = 1024
4345

4446
entrypoint = ["docker-entrypoint.sh"]
4547
command = ["server"]

main.tf

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

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

456456
user = var.user
@@ -506,8 +506,8 @@ module "container_definition_bitbucket" {
506506
container_name = var.name
507507
container_image = local.atlantis_image
508508

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

513513
user = var.user

variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,18 @@ variable "ecs_task_memory" {
299299
default = 512
300300
}
301301

302+
variable "container_cpu" {
303+
description = "The number of cpu units used by the atlantis container. If not specified ecs_task_cpu will be used"
304+
type = number
305+
default = null
306+
}
307+
308+
variable "container_memory" {
309+
description = "The amount (in MiB) of memory used by the atlantis container. If not specified ecs_task_memory will be used"
310+
type = number
311+
default = null
312+
}
313+
302314
variable "container_memory_reservation" {
303315
description = "The amount of memory (in MiB) to reserve for the container"
304316
type = number

0 commit comments

Comments
 (0)