sikhlana / terraform-old

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CDK for Terraform on Steroids(!!)

Typescript Template


This is highly opinionated CDKTF template for Typescript that I use for myself to ease my IaaC development and have been using this in production environments without any hitch.

If you want to see a real-life example of how this template works, visit this repo.

Features

  • Control your Terraform Cloud / Enterprise resources within this codebase.
  • Autoload all the stacks and its resources and data instead of manually importing them from somewhere.
  • A minimal dependency injector:
    • Refer to stacks using the @Stack() decorator (usable within a TerraformStack class).
    • Refer to resources within the stack with the @Resource(id: string) decorator.
    • Refer to data within the stack with the @Data(id: string) decorator.
  • Define resource or datum metadata from a different method instead of the constructor(...) with the @Constructor() decorator.
  • Define Terraform Cloud workspace with the @Workspace(name: string, config?: WorkspaceConfig) decorator.

Requirements

  • Terraform: >=1.5
  • CDKTF: >=0.17
  • NodeJS: >=18.0
  • Typescript: >=5.1

Usage

  1. Create a template from this repo.
  2. Update the value for projectId inside the cdktf.json file. You can generate a random UUID from here.
  3. Install your required providers by running cdktf provider add <provider...>.
  4. Create your stacks.
  5. Run cdktf apply '*' --auto-approve.
  6. ???
  7. Profit.

Tests

Tests are for pussies. Directly raw-dog your infrastructure like a boss!

On a serious note, I didn't get the time to create tests for this project.
Hopefully in the near future?

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

License:MIT License


Languages

Language:TypeScript 97.3%Language:JavaScript 2.7%