How do I use the modules in terraform-aws-service-catalog if there is no example? #360
-
Some modules in |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There are a handful of modules in the Service Catalog that were developed for different use cases that are difficult to integrate into our Reference Architecture, and thus are omitted from the However, any and every module in the terraform {
source = "git::git@github.com:gruntwork-io/terraform-aws-security.git//modules/${local.path_to_module}?ref=${local.latest_version}"
}
include {
path = find_in_parent_folders()
}
# ---------------------------------------------------------------------------------------------------------------------
# Locals are named constants that are reusable within the configuration.
# ---------------------------------------------------------------------------------------------------------------------
locals {
# TODO: Set to specific module you are deploying, and its version.
path_to_module = ""
latest_version = ""
# Automatically load common variables that are useful in most configurations
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
name_prefix = local.common_vars.locals.name_prefix
account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
account_name = local.account_vars.locals.account_name
account_role = local.account_vars.locals.account_role
region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
aws_region = local.region_vars.locals.aws_region
path_to_account_root = dirname(find_in_parent_folders("account.hcl"))
path_to_region_root = dirname(find_in_parent_folders("region.hcl"))
}
# TODO: Add any dependency blocks that you need for deploying this module, like VPC.
# Example:
# dependency "vpc" {
# config_path = "${local.path_to_region_root}/${local.account_name}/networking/vpc"
# }
# ---------------------------------------------------------------------------------------------------------------------
# MODULE PARAMETERS
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above.
# ---------------------------------------------------------------------------------------------------------------------
inputs = {
# TODO: Go to the corresponding documentation for the module on
# https://docs.gruntwork.io/reference/services/intro/overview
# and find the module reference containing the input variables.
# For example, here is the page for the s3 bucket variables:
# https://docs.gruntwork.io/reference/services/data-storage/s-3-bucket#reference
# Using the reference page, go through the variables you want to configure and enter
# them in this map. You can reference any of the locals, and dependencies you defined above.
#
# Example (for s3):
# primary_bucket = "${local.name_prefix}-generic-s3-bucket-for-${local.account_name}"
# access_logging_bucket = "${local.name_prefix}-generic-access-logging"
} If instead you would like to deploy the component in every environment, you will want to follow the Here is a template: envcommon HCL terraform {
source = "${local.source_url}?ref=${local.latest_version}"
}
# ---------------------------------------------------------------------------------------------------------------------
# Locals are named constants that are reusable within the configuration.
# ---------------------------------------------------------------------------------------------------------------------
locals {
# TODO: Set to specific module you are deploying, and its version.
path_to_module = ""
latest_version = ""
source_url = "git::git@github.com:gruntwork-io/terraform-aws-security.git//modules/${local.path_to_module}"
# Automatically load common variables that are useful in most configurations
common_vars = read_terragrunt_config(find_in_parent_folders("common.hcl"))
name_prefix = local.common_vars.locals.name_prefix
account_vars = read_terragrunt_config(find_in_parent_folders("account.hcl"))
account_name = local.account_vars.locals.account_name
account_role = local.account_vars.locals.account_role
region_vars = read_terragrunt_config(find_in_parent_folders("region.hcl"))
aws_region = local.region_vars.locals.aws_region
path_to_account_root = dirname(find_in_parent_folders("account.hcl"))
path_to_region_root = dirname(find_in_parent_folders("region.hcl"))
}
# TODO: Add any dependency blocks that you need for deploying this module, like VPC.
# Example:
# dependency "vpc" {
# config_path = "${local.path_to_region_root}/${local.account_name}/networking/vpc"
# }
# ---------------------------------------------------------------------------------------------------------------------
# MODULE PARAMETERS
# These are the variables we have to pass in to use the module specified in the terragrunt configuration above.
# ---------------------------------------------------------------------------------------------------------------------
inputs = {
# TODO: Go to the corresponding documentation for the module on
# https://docs.gruntwork.io/reference/services/intro/overview
# and find the module reference containing the input variables.
# For example, here is the page for the s3 bucket variables:
# https://docs.gruntwork.io/reference/services/data-storage/s-3-bucket#reference
# Using the reference page, go through the variables you want to configure and enter
# them in this map. You can reference any of the locals, and dependencies you defined above.
#
# Example (for s3):
# primary_bucket = "${local.name_prefix}-generic-s3-bucket-for-${local.account_name}"
# access_logging_bucket = "${local.name_prefix}-generic-access-logging"
} child terragrunt.hcl config in each environment include "root" {
path = find_in_parent_folders()
}
include "envcommon" {
path = "${dirname(find_in_parent_folders())}/_envcommon/path/to/hclfile"
} |
Beta Was this translation helpful? Give feedback.
There are a handful of modules in the Service Catalog that were developed for different use cases that are difficult to integrate into our Reference Architecture, and thus are omitted from the
for-production
example. This doesn't mean that it is not designed for use with the Reference Architecture - it just means that it's hard for us to come up with a generic use case that is adaptable to a wide variety of customers, and thus we omit it from the example.However, any and every module in the
terraform-aws-service-catalog
is designed to be deployed with terragrunt. You can take any of the modules in the Service Catalog and create aterragrunt.hcl
that works well with the Reference Architec…