How do I add a module to my Reference Architecture? #670
-
I have a Reference Architecture that only uses the modules it was deployed with. However, there are many other Gruntwork, open-source, and custom modules I also need to deploy. Do you know how I can do that? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Deploy a new module in the Reference ArchitectureThere are several ways you can accomplish this. I'll start from the most basic form, then extend that basic structure to be fully "DRY" by following the TL;DRWe must create a new
Where we create this new directory matters. The filesystem path dictates where in AWS the infrastructure will be deployed, e.g.,
Since each deployed instance of Terraform module will have its own directory, you should give meaningful names to them like
Once you've created your module directory and # Create a directory and file in your Reference Architecture, something like:
# development/us-east-2/development/services/demo-eks-cluster/terragrunt.hcl
# Define the Terraform module you want to deploy
terraform {
source = "[email protected]:example-org/your-modules-here.git//modules/eks-cluster?ref=v0.0.1"
}
# Include the `terragrunt.hcl` located in the root of our Reference Architecture's
# repository because this file contains all the templating required to make our
# Terraform state and AWS provider DRY.
include "root" {
path = find_in_parent_folders()
}
# Your module will expect some inputs. This is how to pass in values for those inputs:
inputs = {
name = "development-eks-cluster"
vpc_id = "vpc-85556dc"
}
BackgroundIf we want to follow the already deployed modules' pattern, we'll first need a new directory and a
Each of those # development/us-east-2/development/services/team-e-ecs/terragrunt.hcl
# This is where we tell Terragrunt what Terraform module we want to deploy.
terraform {
source = "[email protected]:gruntwork-io/terraform-aws-service-catalog.git//modules/services/ecs-cluster?ref=v0.0.1"
}
# This is where we provide the input values to the Terraform module we want to deploy.
inputs = {
cluster_name = "Team E"
cluster_instance_type = "t2.micro"
}
How to add a module using a new
|
Beta Was this translation helpful? Give feedback.
Deploy a new module in the Reference Architecture
There are several ways you can accomplish this. I'll start from the most basic form, then extend that basic structure to be fully "DRY" by following the
_envcommon
pattern used here at Gruntwork.TL;DR
We must create a new
terragrunt.hcl
file that points to the location of the Terraform module we want to deploy. This new Terragrunt file will live in its own directory, separate from the other modules inside your Reference Architecture's repository.