Skip to content

Commit 35c1e96

Browse files
committed
refactor: update ecs_kong to new version of ecs module
1 parent 303f855 commit 35c1e96

File tree

8 files changed

+33
-80
lines changed

8 files changed

+33
-80
lines changed

README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,18 @@ This command will display the values of the stored parameters, ensuring they hav
7575

7676
| Name | Version |
7777
|------|---------|
78-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.59.0 |
78+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.60.0 |
7979

8080
## Modules
8181

8282
| Name | Source | Version |
8383
|------|--------|---------|
8484
| <a name="module_ecs_exec_role"></a> [ecs\_exec\_role](#module\_ecs\_exec\_role) | ./modules/iam | n/a |
85-
| <a name="module_ecs_kong"></a> [ecs\_kong](#module\_ecs\_kong) | github.com/infraspecdev/terraform-aws-ecs-deployment | v1.1.1 |
85+
| <a name="module_ecs_kong"></a> [ecs\_kong](#module\_ecs\_kong) | infraspecdev/ecs-deployment/aws | ~> 2.0.0 |
8686
| <a name="module_ecs_node_security_group"></a> [ecs\_node\_security\_group](#module\_ecs\_node\_security\_group) | terraform-aws-modules/security-group/aws | ~> 5.1.2 |
8787
| <a name="module_ecs_task_security_group"></a> [ecs\_task\_security\_group](#module\_ecs\_task\_security\_group) | terraform-aws-modules/security-group/aws | ~> 5.1.2 |
8888
| <a name="module_github_runner"></a> [github\_runner](#module\_github\_runner) | ./modules/github-runner | n/a |
89-
| <a name="module_internal_alb_kong"></a> [internal\_alb\_kong](#module\_internal\_alb\_kong) | github.com/infraspecdev/terraform-aws-ecs-deployment//modules/alb | v1.1.1 |
89+
| <a name="module_internal_alb_kong"></a> [internal\_alb\_kong](#module\_internal\_alb\_kong) | infraspecdev/ecs-deployment/aws//modules/alb | ~> 2.0.0 |
9090
| <a name="module_internal_alb_security_group"></a> [internal\_alb\_security\_group](#module\_internal\_alb\_security\_group) | terraform-aws-modules/security-group/aws | ~> 5.1.2 |
9191
| <a name="module_kong_internal_dns_record"></a> [kong\_internal\_dns\_record](#module\_kong\_internal\_dns\_record) | ./modules/route-53-record | n/a |
9292
| <a name="module_kong_public_dns_record"></a> [kong\_public\_dns\_record](#module\_kong\_public\_dns\_record) | ./modules/route-53-record | n/a |
@@ -98,6 +98,7 @@ This command will display the values of the stored parameters, ensuring they hav
9898

9999
| Name | Type |
100100
|------|------|
101+
| [aws_autoscaling_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/autoscaling_group) | data source |
101102
| [aws_ssm_parameter.ecs_node_ami](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
102103
| [aws_ssm_parameter.github](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
103104
| [aws_ssm_parameter.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
@@ -107,37 +108,32 @@ This command will display the values of the stored parameters, ensuring they hav
107108

108109
| Name | Description | Type | Default | Required |
109110
|------|-------------|------|---------|:--------:|
111+
| <a name="input_asg_name"></a> [asg\_name](#input\_asg\_name) | Name of the auto scaling group | `string` | `"default"` | no |
110112
| <a name="input_backup_retention_period"></a> [backup\_retention\_period](#input\_backup\_retention\_period) | The number of days to retain backups | `number` | `1` | no |
111113
| <a name="input_backup_window"></a> [backup\_window](#input\_backup\_window) | The daily time range (in UTC) during which automated backups are created if they are enabled | `string` | `null` | no |
112114
| <a name="input_base_domain"></a> [base\_domain](#input\_base\_domain) | Base domain | `string` | n/a | yes |
113-
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the cluster | `string` | n/a | yes |
115+
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the cluster | `string` | `"default"` | no |
114116
| <a name="input_container_image"></a> [container\_image](#input\_container\_image) | Container image for kong | `string` | `"kong:3.7.1-ubuntu"` | no |
115117
| <a name="input_cpu_for_kong_task"></a> [cpu\_for\_kong\_task](#input\_cpu\_for\_kong\_task) | CPU required for kong task definiton | `number` | `256` | no |
116118
| <a name="input_create_db_subnet_group"></a> [create\_db\_subnet\_group](#input\_create\_db\_subnet\_group) | Whether to create a DB subnet group | `bool` | `true` | no |
117119
| <a name="input_db_allocated_storage"></a> [db\_allocated\_storage](#input\_db\_allocated\_storage) | The amount of allocated storage in GBs | `number` | `20` | no |
118120
| <a name="input_db_max_allocated_storage"></a> [db\_max\_allocated\_storage](#input\_db\_max\_allocated\_storage) | The maximum amount of allocated storage in GBs | `number` | `100` | no |
119121
| <a name="input_deletion_protection"></a> [deletion\_protection](#input\_deletion\_protection) | Whether to enable deletion protection | `bool` | `false` | no |
120-
| <a name="input_desired_capacity"></a> [desired\_capacity](#input\_desired\_capacity) | Desired capacity of auto scaling group | `number` | `2` | no |
121122
| <a name="input_desired_count_for_kong_service"></a> [desired\_count\_for\_kong\_service](#input\_desired\_count\_for\_kong\_service) | Desired count for kong service | `number` | `1` | no |
122123
| <a name="input_force_new_deployment"></a> [force\_new\_deployment](#input\_force\_new\_deployment) | Whether to force new deployment | `bool` | `true` | no |
123-
| <a name="input_instance_type_for_kong"></a> [instance\_type\_for\_kong](#input\_instance\_type\_for\_kong) | Instance type for kong | `string` | `"t2.micro"` | no |
124-
| <a name="input_key_name_for_kong"></a> [key\_name\_for\_kong](#input\_key\_name\_for\_kong) | Key name for to SSH into kong instance | `string` | `null` | no |
125124
| <a name="input_kong_admin_sub_domain_names"></a> [kong\_admin\_sub\_domain\_names](#input\_kong\_admin\_sub\_domain\_names) | List of kong admin sub domain names | `list(any)` | n/a | yes |
126125
| <a name="input_kong_public_sub_domain_names"></a> [kong\_public\_sub\_domain\_names](#input\_kong\_public\_sub\_domain\_names) | List of kong public sub domain names | `list(any)` | n/a | yes |
127126
| <a name="input_log_configuration_for_kong"></a> [log\_configuration\_for\_kong](#input\_log\_configuration\_for\_kong) | Log configuration for kong | `any` | `null` | no |
128127
| <a name="input_maintenance_window"></a> [maintenance\_window](#input\_maintenance\_window) | The window to perform maintenance in.Syntax:ddd:hh24:mi-ddd:hh24:mi | `string` | `null` | no |
129128
| <a name="input_manage_master_user_password"></a> [manage\_master\_user\_password](#input\_manage\_master\_user\_password) | Whether to manage master user password | `bool` | `false` | no |
130129
| <a name="input_managed_scaling_status"></a> [managed\_scaling\_status](#input\_managed\_scaling\_status) | Mangaed scaling | `string` | `"ENABLED"` | no |
131-
| <a name="input_max_size"></a> [max\_size](#input\_max\_size) | Min size of auto scaling group | `number` | `2` | no |
132130
| <a name="input_maximum_scaling_step_size"></a> [maximum\_scaling\_step\_size](#input\_maximum\_scaling\_step\_size) | Maximum scaling step size | `number` | `2` | no |
133131
| <a name="input_memory_for_kong_task"></a> [memory\_for\_kong\_task](#input\_memory\_for\_kong\_task) | Memory required for kong task definiton | `number` | `256` | no |
134-
| <a name="input_min_size"></a> [min\_size](#input\_min\_size) | Min size of auto scaling group | `number` | `1` | no |
135132
| <a name="input_minimum_scaling_step_size"></a> [minimum\_scaling\_step\_size](#input\_minimum\_scaling\_step\_size) | Minimum scaling step size | `number` | `1` | no |
136133
| <a name="input_multi_az"></a> [multi\_az](#input\_multi\_az) | Specifies if the RDS instance is multi-AZ | `bool` | `false` | no |
137134
| <a name="input_performance_insights_enabled"></a> [performance\_insights\_enabled](#input\_performance\_insights\_enabled) | Whether to enable performance insights | `bool` | `true` | no |
138135
| <a name="input_performance_insights_retention_period"></a> [performance\_insights\_retention\_period](#input\_performance\_insights\_retention\_period) | The retention period for performance insights | `number` | `7` | no |
139136
| <a name="input_private_subnet_ids"></a> [private\_subnet\_ids](#input\_private\_subnet\_ids) | List of private subnet id | `list(string)` | n/a | yes |
140-
| <a name="input_protect_from_scale_in"></a> [protect\_from\_scale\_in](#input\_protect\_from\_scale\_in) | Whether to protect from scale in | `bool` | `true` | no |
141137
| <a name="input_public_subnet_ids"></a> [public\_subnet\_ids](#input\_public\_subnet\_ids) | List of public subnet id | `list(string)` | n/a | yes |
142138
| <a name="input_rds_db_tags"></a> [rds\_db\_tags](#input\_rds\_db\_tags) | List of tags | `map(string)` | `{}` | no |
143139
| <a name="input_rds_instance_class"></a> [rds\_instance\_class](#input\_rds\_instance\_class) | The instance class to use | `string` | `"db.t3.micro"` | no |
@@ -147,4 +143,4 @@ This command will display the values of the stored parameters, ensuring they hav
147143

148144
## Outputs
149145

150-
No outputs.
146+
No outputs.

data.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@ data "aws_ssm_parameter" "github" {
1717
name = "/github-action/${each.value}"
1818
with_decryption = true
1919
}
20+
21+
data "aws_autoscaling_group" "this" {
22+
name = var.asg_name
23+
}

locals.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ locals {
1212
port = 5432
1313
}
1414

15-
16-
1715
ecs = {
1816
user_data = <<EOF
1917
#!/bin/bash

main.tf

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ module "ecs_exec_role" {
194194
################################################################################
195195

196196
module "ecs_kong" {
197-
source = "github.com/infraspecdev/terraform-aws-ecs-deployment?ref=v1.1.1"
197+
source = "infraspecdev/ecs-deployment/aws"
198+
version = "~> 2.0.0"
199+
198200
vpc_id = var.vpc_id
199201
cluster_name = var.cluster_name
200202

@@ -248,31 +250,11 @@ module "ecs_kong" {
248250
]
249251
}
250252

251-
autoscaling_group = {
252-
name = local.kong.name
253-
vpc_zone_identifier = var.private_subnet_ids
254-
desired_capacity = var.desired_capacity
255-
min_size = var.min_size
256-
max_size = var.max_size
257-
protect_from_scale_in = var.protect_from_scale_in
258-
launch_template = {
259-
name = local.kong.launch_template_name
260-
image_id = local.kong.image_id
261-
instance_type = var.instance_type_for_kong
262-
vpc_security_group_ids = [module.ecs_node_security_group.security_group_id]
263-
key_name = var.key_name_for_kong
264-
user_data = local.ecs.user_data
265-
}
266-
267-
iam_role_name = local.kong.name
268-
iam_role_policy_attachments = local.kong.iam_role_policy_attachments
269-
iam_instance_profile_name = local.kong.name
270-
271-
}
272-
253+
capacity_provider_default_auto_scaling_group_arn = data.aws_autoscaling_group.this.arn
273254
capacity_providers = {
274255
kong = {
275-
name = local.kong.name
256+
name = local.kong.name
257+
managed_termination_protection = "DISABLED"
276258
managed_scaling = {
277259
maximum_scaling_step_size = var.maximum_scaling_step_size
278260
minimum_scaling_step_size = var.minimum_scaling_step_size
@@ -344,7 +326,9 @@ module "ecs_kong" {
344326
################################################################################
345327

346328
module "internal_alb_kong" {
347-
source = "github.com/infraspecdev/terraform-aws-ecs-deployment//modules/alb?ref=v1.1.1"
329+
source = "infraspecdev/ecs-deployment/aws//modules/alb"
330+
version = "~> 2.0.0"
331+
348332
name = "${local.kong.name}-internal"
349333
internal = true
350334
subnets_ids = var.private_subnet_ids

modules/github-runner/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ No requirements.
66

77
| Name | Version |
88
|------|---------|
9-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.53.0 |
9+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.60.0 |
1010

1111
## Modules
1212

@@ -33,4 +33,4 @@ No modules.
3333

3434
## Outputs
3535

36-
No outputs.
36+
No outputs.

modules/iam/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ No requirements.
66

77
| Name | Version |
88
|------|---------|
9-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.59.0 |
9+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.60.0 |
1010

1111
## Modules
1212

@@ -34,4 +34,4 @@ No modules.
3434
| Name | Description |
3535
|------|-------------|
3636
| <a name="output_role_arn"></a> [role\_arn](#output\_role\_arn) | The ARN of the IAM role |
37-
| <a name="output_role_name"></a> [role\_name](#output\_role\_name) | The name of the IAM role |
37+
| <a name="output_role_name"></a> [role\_name](#output\_role\_name) | The name of the IAM role |

modules/route-53-record/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ No requirements.
66

77
| Name | Version |
88
|------|---------|
9-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.59.0 |
9+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.60.0 |
1010

1111
## Modules
1212

@@ -34,4 +34,4 @@ No modules.
3434
| Name | Description |
3535
|------|-------------|
3636
| <a name="output_certificate_arn"></a> [certificate\_arn](#output\_certificate\_arn) | ARN of the base domain certificate |
37-
| <a name="output_zone_id"></a> [zone\_id](#output\_zone\_id) | ID of the Route 53 zone |
37+
| <a name="output_zone_id"></a> [zone\_id](#output\_zone\_id) | ID of the Route 53 zone |

variables.tf

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ variable "backup_retention_period" {
4646
variable "cluster_name" {
4747
description = "Name of the cluster"
4848
type = string
49+
default = "default"
50+
}
51+
52+
variable "asg_name" {
53+
description = "Name of the auto scaling group"
54+
type = string
55+
default = "default"
4956
}
5057

5158
variable "deletion_protection" {
@@ -141,24 +148,6 @@ variable "target_capacity" {
141148
default = 100
142149
}
143150

144-
variable "desired_capacity" {
145-
description = "Desired capacity of auto scaling group"
146-
type = number
147-
default = 2
148-
}
149-
150-
variable "min_size" {
151-
description = "Min size of auto scaling group"
152-
type = number
153-
default = 1
154-
}
155-
156-
variable "max_size" {
157-
description = "Min size of auto scaling group"
158-
type = number
159-
default = 2
160-
}
161-
162151
variable "container_image" {
163152
description = "Container image for kong"
164153
type = string
@@ -189,26 +178,8 @@ variable "desired_count_for_kong_service" {
189178
default = 1
190179
}
191180

192-
variable "key_name_for_kong" {
193-
description = "Key name for to SSH into kong instance"
194-
type = string
195-
default = null
196-
}
197-
198-
variable "protect_from_scale_in" {
199-
description = "Whether to protect from scale in"
200-
type = bool
201-
default = true
202-
}
203-
204181
variable "force_new_deployment" {
205182
description = "Whether to force new deployment"
206183
type = bool
207184
default = true
208185
}
209-
210-
variable "instance_type_for_kong" {
211-
description = "Instance type for kong"
212-
type = string
213-
default = "t2.micro"
214-
}

0 commit comments

Comments
 (0)