Skip to content
Discussion options

You must be logged in to vote

Hi,
to reduce duplications, terraform block and default inputs can be extracted in HCL file in the root directory:

# root.hcl
# common terraform module
terraform {
  source = "${get_terragrunt_dir()}/../module"
}

# default input
inputs = {
  file = "${get_terragrunt_dir()}/file.txt"
}

# server1/terragrunt.hcl

include "root" {
  path = find_in_parent_folders("root.hcl")
}

inputs = {
  content = "server1"
}

# server2/terragrunt.hcl

include "root" {
  path = find_in_parent_folders("root.hcl")
}

inputs = {
  content = "server2"
}

Created simplified example in: https://github.com/denis256/terragrunt-tests/tree/master/common-module

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@GyroGearl00se
Comment options

Answer selected by GyroGearl00se
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment