Skip to content

Commit 3b59206

Browse files
committed
Set launch type to FARGATE when use_fargate is true
1 parent 620510c commit 3b59206

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

service.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ resource "aws_ecs_service" "service" {
44
task_definition = var.always_use_latest_task_definition ? aws_ecs_task_definition.service.arn_without_revision : aws_ecs_task_definition.service.arn
55
desired_count = var.service_desired_count
66
iam_role = (!var.use_fargate && var.attach_to_load_balancer && var.service_task_network_mode != "awsvpc") ? var.ecs_cluster_service_role_arn : null
7+
launch_type = var.use_fargate ? "FARGATE" : null
78

89
deployment_maximum_percent = var.service_deployment_maximum_percent
910
deployment_minimum_healthy_percent = var.service_deployment_minimum_healthy_percent

spec/integration/fargate_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@
7676
.to(eq('REPLICA'))
7777
end
7878

79+
it 'has a launch type of "FARGATE"' do
80+
expect(ecs_service.launch_type)
81+
.to(eq('FARGATE'))
82+
end
83+
7984
# it 'has the correct load balancer' do
8085
# expect(ecs_service.load_balancers.first.load_balancer_name)
8186
# .to(eq(load_balancer_name))

spec/unit/service_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,12 @@
675675
.with_attribute_value(:iam_role, a_nil_value))
676676
end
677677

678+
it 'sets the launch type to "FARGATE"' do
679+
expect(@plan)
680+
.to(include_resource_creation(type: 'aws_ecs_service')
681+
.with_attribute_value(:launch_type, 'FARGATE'))
682+
end
683+
678684
# it 'configures VPC networking using the provided subnets' do
679685
# expect(@plan)
680686
# .to(include_resource_creation(type: 'aws_ecs_service')

0 commit comments

Comments
 (0)