Skip to content

Latest commit

 

History

History
 
 

module_webserver_cluster

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Example: Webserver Cluster Module

IMPORTANT: This example only works with Terrascript releases up to 0.4.1.

This example is loosely based on an example from chapter 4 of the book Terraform: Up and Running by Yevgenij Brikman. The original code can be found in the book's Github repository.

This Terrascript adaption makes the following changes.

  • The webserver-cluster Terraform module is implemented as a Python function which accepts the inputs as arguments and returns some resources as a tuple.
  • The user_data of the launch_configuration is rendered with Python's format() method instead of Terraform's template_file data source. For more advanced scenarios one could even use Jinja2.
  • All code is contained in a single file. General purpose modules/functions should probably go into a separate Python module.
  • The backend database has been omitted.

The file main.tf.json was created by running main.py.