0.2.5 • Published 5 years ago
terraform-state-in-typescript v0.2.5
terraform-state-in-typescript
Define your Terraform state in Typescript
Usage
- Write a Terraform definition in Typescript, using your custom building blocks.
// my-infrastructure.ts
import { composite, resource } from "terraform-state-in-typescript";
// Define your custom building blocks
const domain = (id: string, name: string) =>
resource("aws_route53_zone", id, { name });
const storage = (id: string, name: string) =>
resource("aws_s3_bucket", id, { name });
const cdn = (id: string, domain: string) =>
resource("aws_cloudfront_distribution", id, { alias: [domain] });
const website = (id: string, address: string) =>
composite(
domain(id, address),
storage(id, address),
cdn(id, address)
);
// Export your infrastructure
export default composite(
website("my_primary_website", "example.com"),
website("my_customer_portal", "example2.com"),
)
- Add a line to your package.json
// package.json
"scripts": {
"build": "terraform-state-in-typescript ./src/my-infrastructure.ts ./my-infrastructure.tf",
...
},
- Transpile your Typescript infrastructure to Terraform and execute
// command window
> yarn build
> terraform apply
Done! You have deployed two websites in the cloud!
0.2.5
5 years ago
0.2.4
5 years ago
0.2.3
5 years ago
0.2.1
6 years ago
0.2.2
6 years ago
0.1.21
6 years ago
0.1.22
6 years ago
0.1.20
6 years ago
0.1.19
6 years ago
0.1.18
6 years ago
0.1.17
6 years ago
0.1.16
6 years ago
0.1.15
6 years ago
0.1.13
6 years ago
0.1.14
6 years ago
0.1.12
6 years ago
0.1.11
6 years ago
0.1.10
6 years ago
0.1.9
6 years ago
0.1.8
6 years ago
0.1.7
6 years ago
0.1.6
6 years ago
0.1.5
6 years ago
0.1.4
6 years ago
0.1.3
6 years ago
0.1.2
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago