Skip to content

Commit 20434bf

Browse files
Deploy a cluster in dev (#27)
<!-- CURSOR_SUMMARY --> > [!NOTE] > **Medium Risk** > Creates/changes real AWS infrastructure (VPC, NAT, ALB with public ingress, ECS cluster), which can incur cost and expose resources if misconfigured. Most files are generated, but reviewers should validate networking, tagging lookups, and security group rules. > > **Overview** > Introduces a new Terramate `BundleInstance` (`ecs-fargate-dev-dev.tm.yml`) to deploy the `tf-aws-complete-ecs-fargate-cluster` bundle in the `dev` environment with VPC CIDR `10.0.0.0/16`. > > Adds Terramate-generated Terraform stacks under `stacks/dev/ecs-clusters/ecs-fargate-dev/` to provision a VPC (3 AZs, public/private subnets, single NAT), an ECS cluster with a mixed `FARGATE`/`FARGATE_SPOT` capacity provider strategy, and an internet-facing ALB with port 80 open and egress scoped to the VPC CIDR; all stacks use a local Terraform backend and tag resources with the bundle UUID/alias. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 53d1f2d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
2 parents 43cc2d7 + 53d1f2d commit 20434bf

13 files changed

Lines changed: 235 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: terramate.io/cli/v1
2+
kind: BundleInstance
3+
metadata:
4+
name: ecs-fargate-dev-dev
5+
uuid: 8d3d9fdc-e259-4a5c-80fe-cde16193fc6a
6+
spec:
7+
source: /bundles/example.com/tf-aws-complete-ecs-fargate-cluster/v1
8+
inputs:
9+
10+
# A list of available environments to create the ECS cluster in.
11+
env: dev
12+
13+
# The name for the ECS Fargate Cluster, Load Balancer, and VPC.
14+
name: ecs-fargate-dev
15+
16+
# CIDR block for the VPC (e.g., 10.0.0.0/16)
17+
vpc_cidr: 10.0.0.0/16
18+
19+
# AWS Resource tags to attach to all created resources. Additional internal tags will be added by default.
20+
tags: {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT
2+
3+
terraform {
4+
backend "local" {
5+
}
6+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT
2+
3+
resource "null_resource" "initial_deployment_trigger" {
4+
}
5+
data "aws_vpc" "vpc_by_tags" {
6+
depends_on = [
7+
null_resource.initial_deployment_trigger,
8+
]
9+
filter {
10+
name = "tag:example.com/tf-aws-complete-ecs-fargate-cluster/v1/bundle-uuid"
11+
values = [
12+
"8d3d9fdc-e259-4a5c-80fe-cde16193fc6a",
13+
]
14+
}
15+
}
16+
data "aws_subnets" "public" {
17+
filter {
18+
name = "vpc-id"
19+
values = [
20+
data.aws_vpc.vpc_by_tags.id,
21+
]
22+
}
23+
filter {
24+
name = "tag:Name"
25+
values = [
26+
"*-public-*",
27+
]
28+
}
29+
}
30+
locals {
31+
security_group_egress_rules = { for k, v in {
32+
all = {
33+
cidr_ipv4 = "10.0.0.0/16"
34+
ip_protocol = "-1"
35+
}
36+
} : k => merge(v, {
37+
cidr_ipv4 = v.cidr_ipv4 != null ? v.cidr_ipv4 : local.vpc_cidr_block_value
38+
}) }
39+
subnets_value = data.aws_subnets.public.ids
40+
vpc_cidr_block_value = data.aws_vpc.vpc_by_tags.cidr_block
41+
vpc_id_value = data.aws_vpc.vpc_by_tags.id
42+
}
43+
module "alb" {
44+
enable_deletion_protection = false
45+
listeners = {
46+
http = {
47+
fixed_response = {
48+
content_type = "text/plain"
49+
status_code = "200"
50+
}
51+
port = 80
52+
protocol = "HTTP"
53+
rules = {}
54+
}
55+
}
56+
load_balancer_type = "application"
57+
name = "ecs-fargate-dev-dev"
58+
security_group_egress_rules = {
59+
all = {
60+
cidr_ipv4 = "10.0.0.0/16"
61+
ip_protocol = "-1"
62+
}
63+
}
64+
security_group_ingress_rules = {
65+
all_http = {
66+
cidr_ipv4 = "0.0.0.0/0"
67+
from_port = 80
68+
ip_protocol = "tcp"
69+
to_port = 80
70+
}
71+
}
72+
source = "terraform-aws-modules/alb/aws"
73+
subnets = local.subnets_value
74+
tags = {
75+
"example.com/tf-aws-complete-ecs-fargate-cluster/v1/bundle-alias" = "ecs-fargate-dev-dev"
76+
"example.com/tf-aws-complete-ecs-fargate-cluster/v1/bundle-uuid" = "8d3d9fdc-e259-4a5c-80fe-cde16193fc6a"
77+
}
78+
target_groups = {}
79+
version = "10.4.0"
80+
vpc_id = local.vpc_id_value
81+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
stack {
2+
id = "de8f108a-7cdb-4e07-8d19-7ed0a482ad04"
3+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT
2+
3+
terraform {
4+
required_version = "1.14.1"
5+
}
6+
terraform {
7+
required_providers {
8+
aws = {
9+
source = "hashicorp/aws"
10+
version = "6.25.0"
11+
}
12+
null = {
13+
source = "hashicorp/null"
14+
version = "3.2.0"
15+
}
16+
}
17+
}
18+
provider "aws" {
19+
region = "us-east-1"
20+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT
2+
3+
terraform {
4+
backend "local" {
5+
}
6+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT
2+
3+
module "ecs_cluster" {
4+
cluster_name = "ecs-fargate-dev-dev"
5+
default_capacity_provider_strategy = {
6+
FARGATE = {
7+
base = 20
8+
weight = 50
9+
}
10+
FARGATE_SPOT = {
11+
weight = 50
12+
}
13+
}
14+
source = "terraform-aws-modules/ecs/aws"
15+
tags = {
16+
"example.com/tf-aws-complete-ecs-fargate-cluster/v1/bundle-alias" = "ecs-fargate-dev-dev"
17+
"example.com/tf-aws-complete-ecs-fargate-cluster/v1/bundle-uuid" = "8d3d9fdc-e259-4a5c-80fe-cde16193fc6a"
18+
}
19+
version = "6.1.0"
20+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
stack {
2+
id = "f0f27568-8b93-405d-b0b3-8b6ffda0bd3f"
3+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT
2+
3+
terraform {
4+
required_version = "1.14.1"
5+
}
6+
terraform {
7+
required_providers {
8+
aws = {
9+
source = "hashicorp/aws"
10+
version = "6.25.0"
11+
}
12+
null = {
13+
source = "hashicorp/null"
14+
version = "3.2.0"
15+
}
16+
}
17+
}
18+
provider "aws" {
19+
region = "us-east-1"
20+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// TERRAMATE: GENERATED AUTOMATICALLY DO NOT EDIT
2+
3+
terraform {
4+
backend "local" {
5+
}
6+
}

0 commit comments

Comments
 (0)