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
5 years ago
0.2.2
5 years ago
0.1.21
5 years ago
0.1.22
5 years ago
0.1.20
5 years ago
0.1.19
5 years ago
0.1.18
5 years ago
0.1.17
5 years ago
0.1.16
5 years ago
0.1.15
5 years ago
0.1.13
5 years ago
0.1.14
5 years ago
0.1.12
5 years ago
0.1.11
5 years ago
0.1.10
5 years ago
0.1.9
5 years ago
0.1.8
5 years ago
0.1.7
5 years ago
0.1.6
5 years ago
0.1.5
5 years ago
0.1.4
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago