Skip to content

Commit

Permalink
Move developer role out of web stack
Browse files Browse the repository at this point in the history
It belongs separately from the Stack
  • Loading branch information
jonodrew committed Jun 5, 2023
1 parent 35cb54e commit 630cfe2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 8 additions & 3 deletions mentor_match_infra/mentor_match_infra/mentor_match_stack.py
Expand Up @@ -80,7 +80,7 @@ def connections(self):
return self._connections


class MentorMatchStack(cdk.Stack):
class MentorMatchWebStack(cdk.Stack):
def __init__(
self,
scope: Construct,
Expand All @@ -91,8 +91,6 @@ def __init__(
) -> None:
super().__init__(scope, construct_id, **kwargs)

DeveloperRole(self, "MentorDev")

vpc = ec2.Vpc(self, "MentorMatchVPC", max_azs=2) # default is all AZs in region

cluster = ecs.Cluster(self, "MentorMatchCluster", vpc=vpc)
Expand Down Expand Up @@ -161,3 +159,10 @@ def __init__(
celery_worker.connections, port_range=ec2.Port.tcp(6379)
)
backend.connections.allow_from_any_ipv4(port_range=ec2.Port.tcp(6379))


class MentorMatchSupportStack(cdk.Stack):
def __init__(self, scope: Construct, id_: str):
super().__init__(scope, id_)

DeveloperRole(self, "MentorDev")
6 changes: 4 additions & 2 deletions mentor_match_infra/mentor_match_infra/mentor_match_stage.py
Expand Up @@ -3,7 +3,7 @@
import aws_cdk as cdk
from constructs import Construct

from .mentor_match_stack import MentorMatchStack
from .mentor_match_stack import MentorMatchWebStack, MentorMatchSupportStack

Account = Literal["staging", "production"]

Expand All @@ -20,7 +20,9 @@ def __init__(
) -> None:
super().__init__(scope, construct_id, **kwargs)

self._service = MentorMatchStack(
self._support = MentorMatchSupportStack(self, "SupportStack")

self._service = MentorMatchWebStack(
self, "MentorMatchStack", **self.stage_env_vars[account]
)

Expand Down

0 comments on commit 630cfe2

Please sign in to comment.