CDKTN init
- 1. TerraConstructs - AWS Intro Workshop: not reached
- 2. Prerequisites: not reached
- 3. AWS CLI: not reached
- 4. AWS Account and User: not reached
- 5. Node.js: not reached
- 6. IDE for your programming language: not reached
- 7. CDKTN CLI Toolkit: not reached
- 8. Terraform CLI: not reached
- 9. TypeScript Workshop: not reached
- 10. New Project: not reached
- 11. CDKTN init: not reached (this page)
- 12. Project structure: not reached
- 13. TerraConstructs: not reached
- 14. CDKTN synth: not reached
- 15. CDKTN deploy: not reached
- 16. Hello, CDKTN!: not reached
- 17. Cleanup sample: not reached
- 18. Hello Lambda: not reached
- 19. Optional - Watch: not reached
- 20. API Gateway: not reached
- 21. Writing constructs: not reached
- 22. Define the HitCounter API: not reached
- 23. Hit counter handler: not reached
- 24. Define resources: not reached
- 25. Use the hit counter: not reached
- 26. CloudWatch Logs: not reached
- 27. Granting permissions: not reached
- 28. Test the hit counter: not reached
- 29. Using construct libraries: not reached
- 30. Learning about the Table Viewer construct: not reached
- 31. Installing the library: not reached
- 32. Add the table viewer to your app: not reached
- 33. Exposing our hit counter table: not reached
- 34. Deploying our app: not reached
- 35. Extra credit: not reached
- 36. Clean up: not reached
- 37. Advanced Topics: not reached
- 38. Testing Constructs: not reached
- 39. Assertion Tests: not reached
- 40. Congrats!: not reached
Create project directory
Create an empty directory on your system:
mkdir cdk-workshop && cd cdk-workshopCDKTN init
We will use cdktn init to create a new TypeScript CDKTN project:
cdktn init --template=typescript-pnpm --localThis workshop uses the pnpm project template. npm remains the default for
cdktn init; selecting typescript-pnpm makes the generated project use pnpm
and creates its pnpm workspace configuration.
Output should look like this (you can safely ignore warnings about initialization of a git repository, this probably means you don't have git installed, which is fine for this workshop):
Note: By supplying '--local' option you have chosen local storage mode
for storing the state of your stack. This means that your Terraform state
file will be stored locally on disk in a file 'terraform.<STACK NAME>.tfstate'
in the root of your project.
? Project Name (cdk-workshop)Confirm the prompts:
-
Project Name
↩ -
Project Description
↩ -
Do you want to start from an existing Terraform project?
↩ -
Do you want to send crash reports to the CDKTN team?
↩Refer to crash reporting for more information
-
Help us prioritize features and bolster regression tests: send anonymous usage telemetry?
YesIt covers which commands you run, your language, tooling versions and platform; never your code, paths or resource names. See telemetry.
-
What providers do you want to use?
↩(none)
========================================================================================================
Your CDKTN TypeScript project is ready!
cat help Print this message
Compile:
pnpm run get Import/update Terraform providers and modules (you should check-in this directory)
pnpm run compile Compile typescript code to javascript (or "pnpm run watch")
pnpm run watch Watch for changes and compile typescript in the background
pnpm run build Compile typescript
Synthesize:
cdktn synth [stack] Synthesize Terraform resources from stacks to cdktf.out/ (ready for 'terraform apply')
Diff:
cdktn diff [stack] Perform a diff (terraform plan) for the given stack
Deploy:
cdktn deploy [stack] Deploy the given stack
Destroy:
cdktn destroy [stack] Destroy the stack
Test:
pnpm run test Runs unit tests (edit __tests__/main-test.ts to add your own tests)
pnpm run test:watch Watches the tests and reruns them on change
Upgrades:
pnpm run upgrade Upgrade cdktn modules to latest version
pnpm run upgrade:next Upgrade cdktn modules to latest "@next" version (last commit)
Use Providers:
You can add prebuilt providers (if available) or locally generated ones using the add command:
cdktn provider add "aws@~>3.0" null kreuzwerker/docker
You can find all prebuilt providers on npm: https://www.npmjs.com/search?q=keywords:cdktn
You can also install these providers directly through pnpm:
pnpm add @cdktn/provider-aws
pnpm add @cdktn/provider-google
pnpm add @cdktn/provider-azurerm
pnpm add @cdktn/provider-docker
pnpm add @cdktn/provider-github
pnpm add @cdktn/provider-null
You can also build any module or provider locally. Learn more https://cdktn.io/docs/concepts/providers
========================================================================================================As you can see, it shows us a bunch of useful commands to get us started.