Skip to content

Commit

Permalink
Remove subnet ids
Browse files Browse the repository at this point in the history
  • Loading branch information
amarouane-ABDELHAK committed May 31, 2024
1 parent 1a2890e commit e483536
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 3 additions & 10 deletions stacks/grafana.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,13 @@ def __init__(

vpc = ec2.Vpc.from_lookup(self, "vpc", vpc_id=settings.vpc_id)

private_subnet_ids = settings.private_subnet_ids

container_name = "grafana"

service = self.build_service(
vpc=vpc,
private_subnet_ids = private_subnet_ids,
container_name=container_name,
cluster_name=settings.grafana_stack_name,
subnet_cidr_mask=settings.grafana_alb_subnet_mask,

cluster_name=settings.grafana_stack_name
)

container = service.task_definition.find_container(container_name)
Expand Down Expand Up @@ -109,10 +105,8 @@ def __init__(
def build_service(
self,
vpc: ec2.Vpc,
private_subnet_ids: List[ec2.Subnet],
cluster_name: str,
container_name: str,
subnet_cidr_mask: int = 20
container_name: str
):
# Production has a public NAT Gateway subnet, which causes the
# default load balancer creation to fail with too many subnets
Expand All @@ -125,8 +119,7 @@ def build_service(
internet_facing=True,
vpc_subnets=ec2.SubnetSelection(
one_per_az=True,
subnet_type=ec2.SubnetType.PUBLIC,
#subnet_filters=[ec2.SubnetFilter.by_cidr_mask(subnet_cidr_mask)],
subnet_type=ec2.SubnetType.PUBLIC
),
)
service = ecs_patterns.ApplicationLoadBalancedFargateService(
Expand Down
4 changes: 1 addition & 3 deletions stacks/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ def stack_name(self,service: str) -> str:
@property
def grafana_stack_name(self) -> str:
return self.stack_name("grafana")
@property
def private_subnet_ids(self) -> list:
return [self.private_subnet_id1, self.private_subnet_id2]

@property
def otel_stack_name(self) -> str:
return self.stack_name("otel")
Expand Down

0 comments on commit e483536

Please sign in to comment.