Example Terraform Module to demonstrate TFC/TFE module publishing workflow into the Private Module Registry.
The module itself uses random_pet
, random_string
and local_file
resources. This example module demonstrate a simple collection of terraform resources that are grouped into a module. Publishing this module to the Private Module Registry
This module also demonstrate how templatefile()
function can be used for templating (eg index.html) which is useful passing in config/user data text files to infrastructure resources when required.
The local index.html
file created can be viewed locally and has a simple static site that cycles through images with the use of javascript. **Note: The statis site has nothing to do with
module "pet" {
source = "tfcarl.is.hashicorpdemo.com/hashicorp/pet/random"
version = "x.x.x"
string_length = 5
}
output "random_string_output" {
value = module.pet.random_string_output
}
output "random_pet_nickname" {
value = module.pet.random_pet_nickname
}
Name | Version |
---|---|
terraform | >= 0.12.0 |
local | >= 2.0.0 |
random | >= 3.0.0 |
Name | Version |
---|---|
local | >= 2.0.0 |
random | >= 3.0.0 |
No modules.
Name | Type |
---|---|
local_file.html | resource |
random_pet.nickname | resource |
random_string.random | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
string_length | The character length of the string. | number |
10 |
no |
Name | Description |
---|---|
random_pet_nickname | Random Pet Nickname generated |
random_string_output | Random String generated |
- Make index.html show pets instead of hashicorp coffee cups.
- Utilise a random number to be injected into javascript inside index.html