Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: match cdk file structure #3006

Open
1 task done
blimmer opened this issue Jul 13, 2023 · 1 comment
Open
1 task done

cli: match cdk file structure #3006

blimmer opened this issue Jul 13, 2023 · 1 comment
Labels
enhancement New feature or request help wanted Community contributions welcome as the core team is unlikely to work on this soon priority/awaiting-more-evidence Lowest priority. Unlikely to be worked on unless/until it gets a lot more upvotes. ux/configuration

Comments

@blimmer
Copy link
Contributor

blimmer commented Jul 13, 2023

Description

As an experienced CDK (CloudFormation) user, I was surprised that the layout of the CDKTF application was so "flat":

# CDKTF
> tree . -L 2 -I 'node_modules'
.
├── __tests__
│   └── main-test.ts
├── cdktf.json
├── help
├── jest.config.js
├── main.ts
├── package-lock.json
├── package.json
├── setup.js
└── tsconfig.json
# CDK
tree . -L 2 -I 'node_modules'
.
├── README.md
├── bin
│   └── test-cdk.ts
├── cdk.json
├── jest.config.js
├── lib
│   └── test-cdk-stack.ts
├── package-lock.json
├── package.json
├── test
│   └── test-cdk.test.ts
└── tsconfig.json

I think it'd be nice to emulate the exact same layout, as I believe there will be a good amount of crossover between CloudFormation CDK and CDKTF. Specifically:

  • move new App() to bin/{{app-name}}.ts
  • move initial stack to lib/{{app-name}}-stack.ts
  • rename __tests__ to test

References

https://github.com/aws/aws-cdk/tree/main/packages/aws-cdk/lib/init-templates/app/typescript

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@blimmer blimmer added enhancement New feature or request new Un-triaged issue labels Jul 13, 2023
@DanielMSchmidt DanielMSchmidt added help wanted Community contributions welcome as the core team is unlikely to work on this soon priority/awaiting-more-evidence Lowest priority. Unlikely to be worked on unless/until it gets a lot more upvotes. ux/configuration and removed new Un-triaged issue labels Jul 14, 2023
@fathom-parth
Copy link

We do something like this for cdktf python. Our folder structure looks like

terraform
├── README.md
├── environments
│   └── dev
│   │   └── main.py
│   └── prod
│   │   └── main.py
├── cdktf.json
├── constructs
│   └── network
│   │   └── __init__.py
│   │   └── test_network.py
├── stacks
│   └── network
│   │   └── __init__.py
│   │   └── test_network.py
└── common_apps.py

We then set PYTHONPATH to terraform and run

cdktf deploy '*' --app=environments/dev/main.py

for each environment to deploy.

Our constructs live in the constructs folder and our stacks live in the stacks folder. Our common multi-stack configurations live in common_apps.py.

So our new App lives in the main.py files.

Hope this helps someone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Community contributions welcome as the core team is unlikely to work on this soon priority/awaiting-more-evidence Lowest priority. Unlikely to be worked on unless/until it gets a lot more upvotes. ux/configuration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants