Skip to content

tf-libsonnet/infrastructure-live-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tf.libsonnet infrastructure-live example

This repository contains an example of how to use Jsonnet and tf.libsonnet to manage a multi-state Terraform project.

This represents a toy example of an AWS stack containing a VPC and MySQL database, that uses a fictional Terraform module to deploy each.

NOTE

The underlying module calls use null_resources to simulate the resources. However, the general pattern should be extensible to real world modules and use cases.

Refer to Comparison to Terraform HCL for the motivating example and a full walkthrough.

Usage

You can generate the Terraform code by using the base Jsonnet tool. To start, install jsonnet and jsonnet-bundler (aka jb):

Once you have jsonnet and jb installed, generate the code with the following commands:

$ jb install
$ jsonnet -J ./vendor -c -m out/ main.jsonnet

This will output all the Terraform code to the out directory, resulting in the following folder structure:

./out
├── prod
│   ├── mysql
│   │   └── main.tf.json
│   └── vpc
│       └── main.tf.json
└── stage
    ├── mysql
    │   └── main.tf.json
    └── vpc
        └── main.tf.json

Support

If you have any questions about how to use the tf.libsonnet libraries, ask in the Organization GitHub Discussion.

About

An example of using tf.libsonnet to manage your Terraform infrastructure.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published