Skip to content

Commit 300dadf

Browse files
committed
refactor: fetch cluster from data source and remove asg
1 parent 706e6e3 commit 300dadf

File tree

5 files changed

+9
-69
lines changed

5 files changed

+9
-69
lines changed

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ This command will display the values of the stored parameters, ensuring they hav
7979

8080
| Name | Version |
8181
|------|---------|
82-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.59.0 |
82+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.60.0 |
8383

8484
## Modules
8585

@@ -101,7 +101,7 @@ This command will display the values of the stored parameters, ensuring they hav
101101

102102
| Name | Type |
103103
|------|------|
104-
| [aws_autoscaling_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/autoscaling_group) | data source |
104+
| [aws_ecs_cluster.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ecs_cluster) | data source |
105105
| [aws_ssm_parameter.github](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
106106
| [aws_ssm_parameter.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | data source |
107107
| [aws_vpc.vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
@@ -110,10 +110,8 @@ This command will display the values of the stored parameters, ensuring they hav
110110

111111
| Name | Description | Type | Default | Required |
112112
|------|-------------|------|---------|:--------:|
113-
| <a name="input_asg_name"></a> [asg\_name](#input\_asg\_name) | Name of the auto scaling group | `string` | `"default"` | no |
114113
| <a name="input_backup_retention_period"></a> [backup\_retention\_period](#input\_backup\_retention\_period) | The number of days to retain backups | `number` | `1` | no |
115114
| <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 |
116-
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the cluster | `string` | `"default"` | no |
117115
| <a name="input_container_image"></a> [container\_image](#input\_container\_image) | Container image for kong | `string` | `"kong:3.7.1-ubuntu"` | no |
118116
| <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 |
119117
| <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 |
@@ -127,10 +125,7 @@ This command will display the values of the stored parameters, ensuring they hav
127125
| <a name="input_log_configuration_for_kong"></a> [log\_configuration\_for\_kong](#input\_log\_configuration\_for\_kong) | Log configuration for kong | `any` | `null` | no |
128126
| <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 |
129127
| <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 |
130-
| <a name="input_managed_scaling_status"></a> [managed\_scaling\_status](#input\_managed\_scaling\_status) | Mangaed scaling | `string` | `"ENABLED"` | no |
131-
| <a name="input_maximum_scaling_step_size"></a> [maximum\_scaling\_step\_size](#input\_maximum\_scaling\_step\_size) | Maximum scaling step size | `number` | `2` | no |
132128
| <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 |
133-
| <a name="input_minimum_scaling_step_size"></a> [minimum\_scaling\_step\_size](#input\_minimum\_scaling\_step\_size) | Minimum scaling step size | `number` | `1` | no |
134129
| <a name="input_multi_az"></a> [multi\_az](#input\_multi\_az) | Specifies if the RDS instance is multi-AZ | `bool` | `false` | no |
135130
| <a name="input_performance_insights_enabled"></a> [performance\_insights\_enabled](#input\_performance\_insights\_enabled) | Whether to enable performance insights | `bool` | `true` | no |
136131
| <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 |
@@ -139,7 +134,6 @@ This command will display the values of the stored parameters, ensuring they hav
139134
| <a name="input_rds_db_tags"></a> [rds\_db\_tags](#input\_rds\_db\_tags) | List of tags | `map(string)` | `{}` | no |
140135
| <a name="input_rds_instance_class"></a> [rds\_instance\_class](#input\_rds\_instance\_class) | The instance class to use | `string` | `"db.t3.micro"` | no |
141136
| <a name="input_ssl_policy"></a> [ssl\_policy](#input\_ssl\_policy) | (Optional) Name of the SSL Policy for the listener. | `string` | `"ELBSecurityPolicy-2016-08"` | no |
142-
| <a name="input_target_capacity"></a> [target\_capacity](#input\_target\_capacity) | Target Capacity for managed scaling | `number` | `100` | no |
143137
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | The ID of the VPC | `string` | n/a | yes |
144138

145139
## Outputs

main.tf

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,16 @@ module "ecs_exec_role" {
188188
# ECS Kong
189189
################################################################################
190190

191-
data "aws_autoscaling_group" "this" {
192-
name = var.asg_name
191+
data "aws_ecs_cluster" "default" {
192+
cluster_name = "default"
193193
}
194194

195195
module "ecs_kong" {
196196
source = "infraspecdev/ecs-deployment/aws"
197197
version = "~> 2.0.0"
198198

199199
vpc_id = var.vpc_id
200-
cluster_name = var.cluster_name
200+
cluster_name = data.aws_ecs_cluster.default.cluster_name
201201

202202
service = {
203203
name = local.kong.service_name
@@ -251,26 +251,7 @@ module "ecs_kong" {
251251
]
252252
}
253253

254-
capacity_provider_default_auto_scaling_group_arn = data.aws_autoscaling_group.this.arn
255-
capacity_providers = {
256-
kong = {
257-
name = local.kong.name
258-
managed_termination_protection = "DISABLED"
259-
managed_scaling = {
260-
maximum_scaling_step_size = var.maximum_scaling_step_size
261-
minimum_scaling_step_size = var.minimum_scaling_step_size
262-
status = var.managed_scaling_status
263-
target_capacity = var.target_capacity
264-
}
265-
}
266-
}
267-
default_capacity_providers_strategies = [
268-
{
269-
capacity_provider = local.kong.name
270-
base = 0
271-
weight = 1
272-
}
273-
]
254+
create_capacity_provider = false
274255

275256
load_balancer = {
276257
name = "${local.kong.name}-public"

modules/github-runner/README.md

Lines changed: 2 additions & 1 deletion
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

@@ -18,6 +18,7 @@ No modules.
1818
|------|------|
1919
| [aws_instance.github_runner](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) | resource |
2020
| [aws_security_group.github_runner](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
21+
| [aws_vpc.vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
2122

2223
## Inputs
2324

modules/iam/README.md

Lines changed: 1 addition & 1 deletion
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

variables.tf

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,6 @@ variable "backup_retention_period" {
4343
default = 1
4444
}
4545

46-
variable "cluster_name" {
47-
description = "Name of the cluster"
48-
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"
56-
}
57-
5846
variable "deletion_protection" {
5947
description = "Whether to enable deletion protection"
6048
type = bool
@@ -119,30 +107,6 @@ variable "kong_admin_domain_name" {
119107
type = string
120108
}
121109

122-
variable "maximum_scaling_step_size" {
123-
description = "Maximum scaling step size"
124-
type = number
125-
default = 2
126-
}
127-
128-
variable "minimum_scaling_step_size" {
129-
description = "Minimum scaling step size"
130-
type = number
131-
default = 1
132-
}
133-
134-
variable "managed_scaling_status" {
135-
description = "Mangaed scaling"
136-
type = string
137-
default = "ENABLED"
138-
}
139-
140-
variable "target_capacity" {
141-
description = "Target Capacity for managed scaling"
142-
type = number
143-
default = 100
144-
}
145-
146110
variable "container_image" {
147111
description = "Container image for kong"
148112
type = string

0 commit comments

Comments
 (0)