Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrsauravsahu/t2d2
Terraform Test Driven Development
https://github.com/mrsauravsahu/t2d2
aws azure gcp iac infrastructure tdd terraform tests
Last synced: 23 days ago
JSON representation
Terraform Test Driven Development
- Host: GitHub
- URL: https://github.com/mrsauravsahu/t2d2
- Owner: mrsauravsahu
- Created: 2022-01-19T18:48:19.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-09T12:28:03.000Z (over 2 years ago)
- Last Synced: 2024-10-01T16:17:54.848Z (about 1 month ago)
- Topics: aws, azure, gcp, iac, infrastructure, tdd, terraform, tests
- Language: TypeScript
- Homepage: https://www.npmjs.com/search?q=@t2d2
- Size: 6.06 MB
- Stars: 11
- Watchers: 3
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# t2d2
Terraform Test Driven Development
## Why?
Testing Terraform code currently requires knowledge of a new set of tools which make crossing the bridge from Application Development to Infrastructure quite difficult.
## How?
t2d2 helps bridge this gap by allowing you write your IaC tests with familiar JavaScript testing frameworks like [Jest](https://jestjs.io/), [Mocha](https://mochajs.org), [UVU](https://github.com/lukeed/uvu) etc.,.
## Getting Started
1. Create a starter jest project.
You can explore the sample test in [resources.ts](srv/test-template/__tests__/resources.ts)```bash
mkdir my-infra-project
cd my-infra-project
npm init @t2d2/jest-starter
```2. Customize the terraform workspace path in your tests' `beforeAll` hook, if required.
```typescript
...profile = await t2d2.init({
profileName: 'resources',
workspaceDir: './tf', # <--
})...
```3. Start your TDD cycles.
# Packages
## @t2d2/core
Main package in the t2d2 Suite, helps with:
- Setting up the Terraform workspace through code
- Functions to write unit tests## @t2d2/create-jest-starter
npm init package to setup a jest test project with t2d2
## @t2d2/jest-matchers
t2d2 core test helpers, supercharged as jest custom matchers