File tree Expand file tree Collapse file tree 6 files changed +40
-10
lines changed Expand file tree Collapse file tree 6 files changed +40
-10
lines changed Original file line number Diff line number Diff line change 11resource "aws_ecs_cluster" "cluster" {
2- name = " ${ local . env } -cluster"
2+ name = " ${ local . env } -cluster"
3+ capacity_providers = [" FARGATE" , " FARGATE_SPOT" ]
34}
45
56module "ecs_task_execution_iam" {
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ resource "aws_ecs_service" "api" {
4747 cluster = aws_ecs_cluster. cluster . id
4848 task_definition = aws_ecs_task_definition. api . arn
4949 desired_count = 0 # desired_count will be updated by autoscaling
50- launch_type = " FARGATE"
5150
5251 load_balancer {
5352 target_group_arn = aws_lb_target_group. api_blue . arn
@@ -64,6 +63,17 @@ resource "aws_ecs_service" "api" {
6463 type = " CODE_DEPLOY"
6564 }
6665
66+ capacity_provider_strategy {
67+ capacity_provider = " FARGATE"
68+ weight = 2
69+ base = 1
70+ }
71+
72+ capacity_provider_strategy {
73+ capacity_provider = " FARGATE_SPOT"
74+ weight = 1
75+ }
76+
6777 lifecycle {
6878 # This parameter will be chaned by CodeDeploy
6979 ignore_changes = [
@@ -86,8 +96,8 @@ module "api_autoscaling" {
8696
8797 cluster_name = aws_ecs_cluster. cluster . name
8898 service_name = aws_ecs_service. api . name
89- min_capacity = 1
90- max_capacity = 1
99+ min_capacity = 3
100+ max_capacity = 6
91101 cpu_target_value = 60
92102 role_arn = data. terraform_remote_state . common . outputs . ecs_application_autoscaling_role_arn
93103}
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ resource "aws_ecs_service" "web" {
4747 cluster = aws_ecs_cluster. cluster . id
4848 task_definition = aws_ecs_task_definition. web . arn
4949 desired_count = 0 # desired_count will be updated by autoscaling
50- launch_type = " FARGATE"
5150
5251 load_balancer {
5352 target_group_arn = aws_lb_target_group. web_blue . arn
@@ -64,6 +63,17 @@ resource "aws_ecs_service" "web" {
6463 type = " CODE_DEPLOY"
6564 }
6665
66+ capacity_provider_strategy {
67+ capacity_provider = " FARGATE"
68+ weight = 2
69+ base = 1
70+ }
71+
72+ capacity_provider_strategy {
73+ capacity_provider = " FARGATE_SPOT"
74+ weight = 1
75+ }
76+
6777 lifecycle {
6878 # This parameter will be chaned by CodeDeploy
6979 ignore_changes = [
@@ -86,8 +96,8 @@ module "web_autoscaling" {
8696
8797 cluster_name = aws_ecs_cluster. cluster . name
8898 service_name = aws_ecs_service. web . name
89- min_capacity = 1
90- max_capacity = 1
99+ min_capacity = 3
100+ max_capacity = 6
91101 cpu_target_value = 60
92102 role_arn = data. terraform_remote_state . common . outputs . ecs_application_autoscaling_role_arn
93103}
Original file line number Diff line number Diff line change 11resource "aws_ecs_cluster" "cluster" {
2- name = " ${ local . env } -cluster"
2+ name = " ${ local . env } -cluster"
3+ capacity_providers = [" FARGATE" , " FARGATE_SPOT" ]
34}
45
56module "ecs_task_execution_iam" {
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ resource "aws_ecs_service" "api" {
4747 cluster = aws_ecs_cluster. cluster . id
4848 task_definition = aws_ecs_task_definition. api . arn
4949 desired_count = 0 # desired_count will be updated by autoscaling
50- launch_type = " FARGATE"
5150
5251 load_balancer {
5352 target_group_arn = aws_lb_target_group. api_blue . arn
@@ -64,6 +63,11 @@ resource "aws_ecs_service" "api" {
6463 type = " CODE_DEPLOY"
6564 }
6665
66+ capacity_provider_strategy {
67+ capacity_provider = " FARGATE_SPOT"
68+ weight = 100
69+ }
70+
6771 lifecycle {
6872 # This parameter will be chaned by CodeDeploy
6973 ignore_changes = [
Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ resource "aws_ecs_service" "web" {
4747 cluster = aws_ecs_cluster. cluster . id
4848 task_definition = aws_ecs_task_definition. web . arn
4949 desired_count = 0 # desired_count will be updated by autoscaling
50- launch_type = " FARGATE"
5150
5251 load_balancer {
5352 target_group_arn = aws_lb_target_group. web_blue . arn
@@ -64,6 +63,11 @@ resource "aws_ecs_service" "web" {
6463 type = " CODE_DEPLOY"
6564 }
6665
66+ capacity_provider_strategy {
67+ capacity_provider = " FARGATE_SPOT"
68+ weight = 100
69+ }
70+
6771 lifecycle {
6872 # This parameter will be chaned by CodeDeploy
6973 ignore_changes = [
You can’t perform that action at this time.
0 commit comments