0.2.5 • Published 4 years ago

terraform-state-in-typescript v0.2.5

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

terraform-state-in-typescript

Define your Terraform state in Typescript

Usage

  1. 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"),
)
  1. Add a line to your package.json
// package.json

"scripts": {
    "build": "terraform-state-in-typescript ./src/my-infrastructure.ts ./my-infrastructure.tf",
    ...
  },
  1. 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

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.2

4 years ago

0.1.21

4 years ago

0.1.22

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.16

4 years ago

0.1.15

4 years ago

0.1.13

4 years ago

0.1.14

4 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago