Skip to content

Commit faa4e77

Browse files
authored
feat: allow setting container memory & cpu from task memory & cpu (#169)
1 parent 2bef68a commit faa4e77

File tree

7 files changed

+40
-24
lines changed

7 files changed

+40
-24
lines changed

README.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,20 @@ allow_github_webhooks = true
195195

196196
| Name |
197197
|------|
198-
| [aws_cloudwatch_log_group](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/resources/cloudwatch_log_group) |
199-
| [aws_ecs_service](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/resources/ecs_service) |
200-
| [aws_ecs_task_definition](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/data-sources/ecs_task_definition) |
201-
| [aws_ecs_task_definition](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/resources/ecs_task_definition) |
202-
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/data-sources/iam_policy_document) |
203-
| [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/resources/iam_role_policy_attachment) |
204-
| [aws_iam_role_policy](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/resources/iam_role_policy) |
205-
| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/resources/iam_role) |
206-
| [aws_lb_listener_rule](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/resources/lb_listener_rule) |
207-
| [aws_region](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/data-sources/region) |
208-
| [aws_route53_record](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/resources/route53_record) |
209-
| [aws_route53_zone](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/data-sources/route53_zone) |
210-
| [aws_ssm_parameter](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/resources/ssm_parameter) |
211-
| [random_id](https://registry.terraform.io/providers/hashicorp/random/2.0/docs/resources/id) |
198+
| [aws_cloudwatch_log_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) |
199+
| [aws_ecs_service](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_service) |
200+
| [aws_ecs_task_definition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecs_task_definition) |
201+
| [aws_ecs_task_definition](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_task_definition) |
202+
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) |
203+
| [aws_iam_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) |
204+
| [aws_iam_role_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) |
205+
| [aws_iam_role_policy_attachment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) |
206+
| [aws_lb_listener_rule](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_listener_rule) |
207+
| [aws_region](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) |
208+
| [aws_route53_record](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) |
209+
| [aws_route53_zone](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) |
210+
| [aws_ssm_parameter](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) |
211+
| [random_id](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) |
212212

213213
## Inputs
214214

@@ -254,7 +254,9 @@ allow_github_webhooks = true
254254
| cidr | The CIDR block for the VPC which will be created if `vpc_id` is not specified | `string` | `""` | no |
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 |
257+
| container\_cpu | The number of cpu units used by the atlantis container. If not specified ecs\_task\_cpu will be used | `number` | `null` | no |
257258
| 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 |
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/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ Go to https://eu-west-1.console.aws.amazon.com/ecs/home?region=eu-west-1#/settin
5151

5252
| Name |
5353
|------|
54-
| [aws_caller_identity](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/data-sources/caller_identity) |
55-
| [aws_elb_service_account](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/data-sources/elb_service_account) |
56-
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/data-sources/iam_policy_document) |
57-
| [aws_region](https://registry.terraform.io/providers/hashicorp/aws/2.68/docs/data-sources/region) |
54+
| [aws_caller_identity](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) |
55+
| [aws_elb_service_account](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/elb_service_account) |
56+
| [aws_iam_policy_document](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) |
57+
| [aws_region](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) |
5858

5959
## Inputs
6060

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

modules/github-repository-webhook/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ No Modules.
2222

2323
| Name |
2424
|------|
25-
| [github_repository_webhook](https://registry.terraform.io/providers/integrations/github/2.4.1/docs/resources/repository_webhook) |
25+
| [github_repository_webhook](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_webhook) |
2626

2727
## Inputs
2828

modules/gitlab-repository-webhook/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ No Modules.
2222

2323
| Name |
2424
|------|
25-
| [gitlab_project_hook](https://registry.terraform.io/providers/gitlabhq/gitlab/3.0/docs/resources/project_hook) |
25+
| [gitlab_project_hook](https://registry.terraform.io/providers/gitlabhq/gitlab/latest/docs/resources/project_hook) |
2626

2727
## Inputs
2828

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)