https://github.com/nitrictech/terraform-api-example
An example of putting cdktf behind an API
https://github.com/nitrictech/terraform-api-example
Last synced: 9 months ago
JSON representation
An example of putting cdktf behind an API
- Host: GitHub
- URL: https://github.com/nitrictech/terraform-api-example
- Owner: nitrictech
- Created: 2024-07-17T23:47:01.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-23T05:06:05.000Z (almost 2 years ago)
- Last Synced: 2025-01-07T19:12:28.687Z (over 1 year ago)
- Language: JavaScript
- Size: 57.6 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Terraform API Example
A simple CDKTF application behind an API interface, as a demonstration for a [blog post](https://nitric.io/blog).
## Requirements
- Node.js
- [Terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli)
- [CDKTF CLI](https://developer.hashicorp.com/terraform/tutorials/cdktf/cdktf-install)
## Installing dependencies
```bash
npm i
```
> Or your favorite alternative dependency manager
## Starting the dev server
```bash
npm run dev
```
This will server the API on `localhost:3000` by default.
## Testing the API
You can test the API by running:
```bash
curl -X POST -H "Content-Type: application/json" -d '{ "name": "my-stack", "buckets": ["test", "test1"] }' http://localhost:3000/generate > my-stack.zip
```
This should produce an output zip container a tf stack for deploying two s3 buckets named `test` and `test1`.