Skip to content

Commit dbfb447

Browse files
committed
Use more consistent naming for variables
1 parent 3d1e803 commit dbfb447

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

spec/unit/infra/root/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ module "ecs_service" {
6767
ecs_cluster_id = data.terraform_remote_state.prerequisites.outputs.cluster_id
6868
ecs_cluster_service_role_arn = data.terraform_remote_state.prerequisites.outputs.service_role_arn
6969

70-
fargate = var.fargate
71-
cpu = var.cpu
72-
memory = var.memory
70+
use_fargate = var.use_fargate
71+
service_task_cpu = var.service_task_cpu
72+
service_task_memory = var.service_task_memory
7373
}

spec/unit/infra/root/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,17 @@ variable "wait_for_steady_state" {
143143
default = null
144144
}
145145

146-
variable "fargate" {
146+
variable "use_fargate" {
147147
type = bool
148148
default = null
149149
}
150150

151-
variable "cpu" {
151+
variable "service_task_cpu" {
152152
type = string
153153
default = null
154154
}
155155

156-
variable "memory" {
156+
variable "service_task_memory" {
157157
type = string
158158
default = null
159159
}

spec/unit/task_definition_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,13 @@
158158
end
159159
end
160160

161-
describe 'when task_type is fargate' do
161+
fdescribe 'when task_type is fargate' do
162162
before(:context) do
163163
@plan = plan(role: :root) do |vars|
164164
vars.attach_to_load_balancer = false
165-
vars.fargate = true
166-
vars.cpu = '256'
167-
vars.memory = '512'
165+
vars.use_fargate = true
166+
vars.service_task_cpu = '256'
167+
vars.service_task_memory = '512'
168168
end
169169
end
170170

@@ -191,8 +191,8 @@
191191
before(:context) do
192192
@plan = plan(role: :root) do |vars|
193193
vars.attach_to_load_balancer = false
194-
vars.cpu = '1234'
195-
vars.memory = '4567'
194+
vars.service_task_cpu = '1234'
195+
vars.service_task_memory = '4567'
196196
vars.service_task_container_definitions =
197197
'[{"cpu": ${cpu}, "memory": ${memory}}]'
198198
end

task_definition.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ locals {
1717
"$${port}", var.service_port),
1818
"$${region}", var.region),
1919
"$${log_group}", var.include_log_group ? aws_cloudwatch_log_group.service[0].name : ""),
20-
"$${cpu}", var.cpu),
21-
"$${memory}", var.memory)
20+
"$${cpu}", var.service_task_cpu),
21+
"$${memory}", var.service_task_memory)
2222
}
2323

2424
resource "aws_ecs_task_definition" "service" {
@@ -30,9 +30,9 @@ resource "aws_ecs_task_definition" "service" {
3030

3131
task_role_arn = var.service_role
3232

33-
requires_compatibilities = var.fargate ? ["FARGATE"] : null
34-
cpu = var.fargate ? var.cpu : null
35-
memory = var.fargate ? var.memory : null
33+
requires_compatibilities = var.use_fargate ? ["FARGATE"] : null
34+
cpu = var.use_fargate ? var.service_task_cpu : null
35+
memory = var.use_fargate ? var.service_task_memory : null
3636

3737
dynamic "volume" {
3838
for_each = var.service_volumes

variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,20 +256,20 @@ variable "always_use_latest_task_definition" {
256256
nullable = false
257257
}
258258

259-
variable "fargate" {
259+
variable "use_fargate" {
260260
description = "Whether or not to use Fargate for the service."
261261
type = bool
262262
default = false
263263
nullable = false
264264
}
265265

266-
variable "cpu" {
266+
variable "service_task_cpu" {
267267
description = "The number of CPU units to use for the service task when deployed using Fargate."
268268
type = string
269269
default = "256"
270270
nullable = false
271271
}
272-
variable "memory" {
272+
variable "service_task_memory" {
273273
description = "The amount of memory (in MiB) to use for the service task when deployed using Fargate."
274274
type = string
275275
default = "512"

0 commit comments

Comments
 (0)