{"id":18907797,"url":"https://github.com/infraspecdev/terraform-aws-ecs-cluster-module","last_synced_at":"2026-02-16T01:37:59.248Z","repository":{"id":52215646,"uuid":"520841816","full_name":"infraspecdev/terraform-aws-ecs-cluster-module","owner":"infraspecdev","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-17T11:19:46.000Z","size":48,"stargazers_count":0,"open_issues_count":5,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-07-14T10:30:56.162Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/infraspecdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-03T10:49:58.000Z","updated_at":"2024-11-21T12:50:43.000Z","dependencies_parsed_at":"2025-02-20T18:35:41.233Z","dependency_job_id":"e41764a8-7253-4db1-bb98-f271ff9845e5","html_url":"https://github.com/infraspecdev/terraform-aws-ecs-cluster-module","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/infraspecdev/terraform-aws-ecs-cluster-module","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infraspecdev%2Fterraform-aws-ecs-cluster-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infraspecdev%2Fterraform-aws-ecs-cluster-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infraspecdev%2Fterraform-aws-ecs-cluster-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infraspecdev%2Fterraform-aws-ecs-cluster-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/infraspecdev","download_url":"https://codeload.github.com/infraspecdev/terraform-aws-ecs-cluster-module/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/infraspecdev%2Fterraform-aws-ecs-cluster-module/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29498021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T01:11:49.942Z","status":"ssl_error","status_checked_at":"2026-02-16T01:07:16.834Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T09:23:21.464Z","updated_at":"2026-02-16T01:37:59.220Z","avatar_url":"https://github.com/infraspecdev.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ECS Cluster Terraform Module\n\nTerraform module which creates Amazon ECS cluster with EC2 launch type\n\nThis module creates following resources:\n\n1. ECS cluster\n2. Capacity providers\n3. Autoscaling groups for EC2\n4. Launch configuration for EC2\n\n![](./diagram.svg)\n\n\n### Usage\n```hcl\nmodule \"app_cluster\" {\n  source       = \"git::https://github.com/gaussb-labs/terraform-aws-ecs-cluster-module.git?ref=v1.1.2\"\n  environment  = \"production\"\n  cluster_name = \"app_cluster\"\n  launch_configs = [\n    {\n      name                      = \"java_application\"\n      image_id                  = \"ami-040d909ea4e56f8f3\"\n      instance_type             = \"t3a.medium\"\n      user_data_base64          = \"\"\n      iam_instance_profile_name = \"ecs_agent_access_instance_profile\"\n      root_block_device = {\n        volume_type = \"gp3\"\n        volume_size = 30\n      }\n      security_group_ids = [\"sg-01\", \"sg-02\"]\n    },\n    {\n      name                      = \"rails_application\"\n      image_id                  = \"ami-040d909ea4e56f8f3\"\n      instance_type             = \"t3a.medium\"\n      user_data_base64          = \"\"\n      iam_instance_profile_name = \"ecs_agent_access_instance_profile\"\n      security_group_ids = [\"sg-03\", \"sg-04\"]\n    }\n  ]\n  asg = [\n    {\n      name                      = \"java_application\"\n      vpc_zone_identifier       = [\"subnet_id_1\", \"subnet_id_2\"]\n      health_check_type         = \"EC2\"\n      health_check_grace_period = 10\n      max_size                  = 3\n      min_size                  = 1\n      protect_from_scale_in     = true\n      additional_tags           = []\n    },\n    {\n      name                      = \"rails_application\"\n      vpc_zone_identifier       = [\"subnet_id_1\", \"subnet_id_2\"]\n      health_check_type         = \"EC2\"\n      health_check_grace_period = 10\n      max_size                  = 2\n      min_size                  = 0\n      protect_from_scale_in     = false\n      additional_tags           = []\n    }\n  ]\n  capacity_providers = [\n    {\n      name                           = \"java_application\"\n      target_capacity                = 100\n      managed_scaling_status         = \"ENABLED\"\n      managed_termination_protection = \"ENABLED\"\n    },\n    {\n      name                           = \"rails_application\"\n      target_capacity                = 100\n      managed_scaling_status         = \"ENABLED\"\n      managed_termination_protection = \"DISABLED\"\n    }\n  ]\n}\n```\n\n_NOTE:_\u003c/br\u003e\n_This module doesn't provide the ability to create ECS services and tasks.\nThis can be created separately and should be closer to the application deployments\nrather than the infrastructure deployments._\n\n### Configuration\n#### 1. asg\nasg is a list of auto-scaling group configuration. This module supports\nmultiple asg configurations per cluster. This is useful in scenarios where\nwe need different auto-scaling for different kind of workloads. \n`launch_config` is required for auto-scaling group.\n\n\n#### 2. launch_configs\nlaunch_configs is a list of launch configurations, used by the auto-scaling groups\nto spin up new EC2 instances. One launch configuration per auto-scaling group is\nsupported, although we can specify multiple launch configurations if there are multiple\nauto-scaling groups defined.\nThe launch configuration is linked to the auto-scaling group via the `name` attribute, \nso name has to same for both asg and launch configuration.\n\n_`iam_instance_profile_name` is expected by this module. The instance_profile should be created considering \nthe accesses needed by the ECS agent to interact with the ECS cluster and service._ \n\n\n#### 3. capacity_providers\nConfiguration block for defining capacity providers in the ECS cluster. \nThis is needed if you plan to use capacity provider strategy for ECS service.\n`asg` and `launch_config` are required for the capacity provider.\n\n\n## Requirements\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"requirement_terraform\"\u003e\u003c/a\u003e [terraform](#requirement\\_terraform) | \\\u003e= 1.2.0 |\n| \u003ca name=\"requirement_aws\"\u003e\u003c/a\u003e [aws](#requirement\\_aws) | ~\u003e 4.16 |\n| \u003ca name=\"requirement_cloudinit\"\u003e\u003c/a\u003e [cloudinit](#requirement\\_cloudinit) | \\\u003e=2.2.0 |\n\n## Providers\n\n| Name | Version |\n|------|---------|\n| \u003ca name=\"provider_aws\"\u003e\u003c/a\u003e [aws](#provider\\_aws) | ~\u003e 4.16 |\n\n## Modules\n\nNo modules.\n\n## Resources\n\n| Name | Type |\n|------|------|\n| [aws_autoscaling_group.ecs_cluster_asg](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/autoscaling_group) | resource |\n| [aws_ecs_capacity_provider.capacity_providers](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_capacity_provider) | resource |\n| [aws_ecs_cluster.ecs_cluster](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster) | resource |\n| [aws_ecs_cluster_capacity_providers.ecs_cluster_capacity_provider](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_cluster_capacity_providers) | resource |\n| [aws_launch_configuration.ecs_launch_config](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/launch_configuration) | resource |\n\n### Inputs\n\n| Name                                              \t| Description                                                                                                                                 \t| Type           \t| Default \t| Required \t|\n|---------------------------------------------------\t|---------------------------------------------------------------------------------------------------------------------------------------------\t|----------------\t|---------\t|----------\t|\n| environment                                       \t| The cluster deployment environment. environment is added as prefix to the resources generated by this module.                               \t| `string`       \t| n/a     \t| yes      \t|\n| cluster_name                                      \t| Name of ECS cluster. environment is not added to the cluster name.                                                                          \t| `string`       \t| n/a     \t| yes      \t|\n| capacity_providers                                \t| List of capacity provider configuration.                                                                                                    \t| `list(object)` \t| n/a     \t| yes      \t|\n| capacity_providers.name                           \t| Capacity provider name. This is used by the module to link auto-scaling group, launch configuration and capacity provider.                  \t| `string`       \t| n/a     \t| yes      \t|\n| capacity_providers.target_capacity                \t| Target utilisation for the capacity provider. A value between 1 and 100.                                                                    \t| `number`       \t| n/a     \t| yes      \t|\n| capacity_providers.managed_scaling_status         \t| Whether auto-scaling is managed by ECS. Valid values are `ENABLED` and `DISABLED`.                                                          \t| `string`       \t| n/a     \t| yes      \t|\n| capacity_providers.managed_termination_protection \t| Manage container-aware termination of instances in the auto scaling group when scale-in happens. Valid values are `ENABLED` and `DISABLED`. \t| `string`       \t| n/a     \t| yes      \t|\n| asg                                               \t| List of auto-scaling group configuration.                                                                                                   \t| `list(object)` \t| n/a     \t| yes      \t|\n| asg.name                                          \t| Name of auto-scaling group.                                                                                                                 \t| `string`       \t| n/a     \t| yes      \t|\n| asg.vpc_zone_identifier                           \t| List of subnet Ids to launch resources in.                                                                                                  \t| `list(string)` \t| n/a     \t| yes      \t|\n| asg.health_check_type                             \t| Controls how health check is done. Valid values are `EC2` and `ELB`.                                                                        \t| `string`       \t| n/a     \t| yes      \t|\n| asg.health_check_grace_period                     \t| Time in seconds after instance comes up and health check first kicks in.                                                                    \t| `number`       \t| n/a     \t| yes      \t|\n| asg.max_size                                      \t| The maximum capacity auto-scaling group can scale-out to.                                                                                   \t| `number`       \t| n/a     \t| yes      \t|\n| asg.min_size                                      \t| The minimum capacity auto-scaling group can scale-in to.                                                                                    \t| `number`       \t| n/a     \t| yes      \t|\n| asg.protect_from_scale_in                         \t| Indicates whether newly launched instances are automatically protected from termination by auto-scaling group when scaling in.              \t| `bool`         \t| n/a     \t| yes      \t|\n| asg.additional_tags                               \t| List of additional tags.                                                                                                                    \t| `list(object)` \t| n/a     \t| yes      \t|\n| asg.additional_tags.key                           \t| Key of the tag.                                                                                                                             \t| `string`       \t| n/a     \t| yes      \t|\n| asg.additional_tags.value                         \t| Value of the tag.                                                                                                                           \t| `string`       \t| n/a     \t| yes      \t|\n| asg.additional_tags.propagate_at_launch           \t| Indicates whether to propagate the tag to the newly launched EC2 instances.                                                                 \t| `bool`         \t| n/a     \t| yes      \t|\n| launch_configs                                    \t| List of launch configurations for auto-scaling groups.                                                                                      \t| `list(object)` \t| n/a     \t| yes      \t|\n| launch_configs.name                               \t| Name of the launch configuration. Should be same as corresponding auto-scaling group name.                                                  \t| `string`       \t| n/a     \t| yes      \t|\n| launch_configs.image_id                           \t| AMI Id of the image to use.                                                                                                                 \t| `string`       \t| n/a     \t| yes      \t|\n| launch_configs.instance_type                      \t| The type of EC2 instance to use. Eg: t3.small                                                                                               \t| `string`       \t| n/a     \t| yes      \t|\n| launch_configs.user_data_base64                   \t| Base64 encoded userdata.                                                                                                                    \t| `string`       \t| n/a     \t| yes      \t|\n| launch_configs.iam_instance_profile_name          \t| Name of the IAM instance profile to attach to the EC2 instance.                                                                             \t| `string`       \t| n/a     \t| yes      \t|\n| launch_configs.security_group_ids                 \t| List of security group ids to attach to the EC2 instance.                                                                                   \t| `list(string)` \t| n/a     \t| yes      \t|\n| launch_configs.root_block_device                   | root block device configuration\n\n### Outputs\nNo outputs.\n\n### License\nMIT Licensed. See [LICENSE](https://github.com/gaussb-labs/terraform-aws-ecs-cluster-module/blob/main/LICENSE) for full details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfraspecdev%2Fterraform-aws-ecs-cluster-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfraspecdev%2Fterraform-aws-ecs-cluster-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfraspecdev%2Fterraform-aws-ecs-cluster-module/lists"}