Skip to content

Commit

Permalink
Merge pull request #16 from Sanim16/feat-pr-update-readme1
Browse files Browse the repository at this point in the history
update README
  • Loading branch information
Sanim16 authored Nov 17, 2024
2 parents a12ce06 + df42f2d commit 4bcaa8d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ jobs:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
pytest
cdk bootstrap
cdk diff
cdk synth
- run: echo "🍏 This job's status is ${{ job.status }}."

Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ This project is set up like a standard Python project. The initialization proce
a virtualenv within the project, stored under the .venv directory. To create the virtualenv
it assumes that there is a `python3` executable in your path with access to the `venv` package.

```
$ python3 -m venv .venv
```

After the init process completes and the virtualenv is created, you can use the following
After the virtualenv is created, you can use the following
step to activate your virtualenv.

```
Expand Down Expand Up @@ -63,4 +66,14 @@ command.
* `cdk diff` compare deployed stack with current state
* `cdk docs` open CDK documentation

p.s: To deploy the infrastructure and the app:
* uncomment the `venv` step in the `deploy` job in `./.github/workflows/deploy.yml`
* comment out the `venv-teardown` step also.

## Cleanup
Remember to delete all AWS components afterwards to avoid unforseen bills.
To tear down the infrastructure and the app:
* comment out the `venv` step in the `deploy` job in `./.github/workflows/deploy.yml`
* uncomment the `venv-teardown` step in the `deploy` job in `./.github/workflows/deploy.yml`

Enjoy!
2 changes: 1 addition & 1 deletion cdk_new_app/cdk_new_app_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)

vpc = ec2.Vpc(
self, "CdkNewAppVpc", vpc_name="newvpc"
self, "CdkNewAppVpc", vpc_name="newvpc", ip_addresses=ec2.IpAddresses.cidr("10.0.0.0/16")
)

mySecurityGroup = ec2.SecurityGroup(self, "SecurityGroup", vpc=vpc,
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
aws-cdk-lib==2.166.0
constructs>=10.0.0,<11.0.0
aws-cdk.lambda-layer-kubectl-v31
pyyaml
pyyaml
pytest
29 changes: 24 additions & 5 deletions tests/unit/test_cdk_new_app_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,38 @@
from cdk_new_app.cdk_new_app_stack import CdkNewAppStack


def test_sqs_queue_created():
def test_ec2_vpc_created():
app = core.App()
stack = CdkNewAppStack(app, "cdk-new-app")
template = assertions.Template.from_stack(stack)

template.has_resource_properties("AWS::SQS::Queue", {
"VisibilityTimeout": 300
template.has_resource_properties("AWS::EC2::VPC", {
"CidrBlock": "10.0.0.0/16"
})

def test_ec2_vpc_named():
app = core.App()
stack = CdkNewAppStack(app, "cdk-new-app")
template = assertions.Template.from_stack(stack)

template.has_resource_properties("AWS::EC2::VPC", {
"Tags": [{"Key": "Name", "Value": "newvpc"}]
})

def test_eks_fargate_created():
app = core.App()
stack = CdkNewAppStack(app, "cdk-new-app")
template = assertions.Template.from_stack(stack)

def test_sns_topic_created():
template.has_resource_properties("Custom::AWSCDK-EKS-Cluster", {
"Config": {"name": "max-cluster"}
})

def test_eks_fargate_profile_selector():
app = core.App()
stack = CdkNewAppStack(app, "cdk-new-app")
template = assertions.Template.from_stack(stack)

template.resource_count_is("AWS::SNS::Topic", 1)
template.has_resource_properties("Custom::AWSCDK-EKS-FargateProfile", {
"Config": {"selectors": [{"namespace": "maxapp"}]}
})

0 comments on commit 4bcaa8d

Please sign in to comment.