{"id":327,"date":"2024-10-09T23:25:45","date_gmt":"2024-10-09T21:25:45","guid":{"rendered":"https:\/\/www.c-sautter.de\/?p=327"},"modified":"2024-11-23T15:44:34","modified_gmt":"2024-11-23T14:44:34","slug":"terragrunt-the-missing-terraform-part","status":"publish","type":"post","link":"https:\/\/www.c-sautter.de\/en\/terragrunt-the-missing-terraform-part\/","title":{"rendered":"Terragrunt \u2013 the missing Terraform Part"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img data-dominant-color=\"aec8cd\" data-has-transparency=\"false\" fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg\" alt=\"\" class=\"wp-image-449 not-transparent\" style=\"--dominant-color: #aec8cd; width:auto;height:200px\" srcset=\"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg 1024w, https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform-300x300.jpeg 300w, https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform-150x150.jpeg 150w, https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform-768x768.jpeg 768w, https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform-12x12.jpeg 12w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>Terraform is one of the top IaC (Infrastructure as Code) tools. With Terraform, developers can create, change and version infrastructure securely and efficiently. The desired state of a cloud-based or local infrastructure is described in the declarative configuration language HCL (HashiCorp Configuration Language). Terraform can then use this to create a plan to provide the infrastructure. Terraform has many advantages but has limitations in certain areas. Terragrunt extends Terraform by making it easier to reuse and organize Terraform configurations. It provides a unified structure for projects with multiple environments and improves the handling of remote states and modules. Terragrunt can also automatically resolve dependencies between multiple modules.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Terraform project structure<\/h2>\n\n\n\n<p>Simplified example of a project structure with two or more modules.<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-translation=\"\"><code data-no-translation=\"\">\u251c\u2500\u2500 environments\n\u2502   \u251c\u2500\u2500 dev\n\u2502   \u2502   \u251c\u2500\u2500 main.tf\n\u2502   \u2502   \u251c\u2500\u2500 outputs.tf\n\u2502   \u2502   \u251c\u2500\u2500 provider.tf\n\u2502   \u2502   \u2514\u2500\u2500 variables.tf\n\u2502   \u2514\u2500\u2500 prod\n\u2502       \u251c\u2500\u2500 main.tf\n\u2502       \u251c\u2500\u2500 outputs.tf\n\u2502       \u251c\u2500\u2500 provider.tf\n\u2502       \u2514\u2500\u2500 variables.tf\n\u2514\u2500\u2500 modules\n   \u251c\u2500\u2500 ec2\n   \u2502   \u251c\u2500\u2500 main.tf\n   \u2502   \u251c\u2500\u2500 outputs.tf\n   \u2502   \u2514\u2500\u2500 variables.tf\n   \u2514\u2500\u2500 network\n       \u251c\u2500\u2500 main.tf\n       \u251c\u2500\u2500 outputs.tf\n       \u2514\u2500\u2500 variables.tf<\/code><\/pre>\n\n\n\n<p class=\"translation-block\">In pure Terraform projects, a separate environment module (dev, prod) is created for each environment, into which the shared modules (ec2, network) are loaded. Since the different environments do not have a common code base except for the shared modules, deviations between the redundant code parts can easily arise. The files <code>(main.tf, outputs.tf, provider.tf, variables.tf)<\/code> are usually maintained twice or multiple times.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<h2 class=\"wp-block-heading\">Terragrunt project structure<\/h2>\n\n\n\n<p>Simplified project structure with two or more modules:<\/p>\n\n\n\n<pre class=\"wp-block-code\" data-no-translation=\"\"><code data-no-translation=\"\">|\u2500\u2500 live\n|    \u251c\u2500\u2500 terragrunt.hcl\n|    \u251c\u2500\u2500 _env\n|    \u2502   \u251c\u2500\u2500 ec2.hcl\n|    \u2502   \u251c\u2500\u2500 network.hcl\n|    \u2502   \u2514\u2500\u2500 provider.hcl\n|    \u251c\u2500\u2500 prod\n|    \u2502   \u251c\u2500\u2500 env.hcl\n|    \u2502   \u251c\u2500\u2500 app\n|    \u2502   \u2502   \u2514\u2500\u2500 terragrunt.hcl\n|    \u2502   \u2514\u2500\u2500 mysql\n|    \u2502       \u2514\u2500\u2500 terragrunt.hcl\n|    \u2514\u2500\u2500 dev\n|        \u251c\u2500\u2500 env.hcl\n|        \u251c\u2500\u2500 ec2\n|        \u2502   \u2514\u2500\u2500 terragrunt.hcl\n|        \u2514\u2500\u2500 network\n|            \u2514\u2500\u2500 terragrunt.hcl\n\u2514\u2500\u2500 modules\n   \u251c\u2500\u2500 ec2\n   \u2502   \u251c\u2500\u2500 main.tf\n   \u2502   \u251c\u2500\u2500 outputs.tf\n   \u2502   \u2514\u2500\u2500 variables.tf\n   \u2514\u2500\u2500 network\n       \u251c\u2500\u2500 main.tf\n       \u251c\u2500\u2500 outputs.tf\n       \u2514\u2500\u2500 variables.tf<\/code><\/pre>\n\n\n\n<p class=\"translation-block\">With Terragrunt, code duplicates between multiple environments can be avoided very effectively. The common code base is defined parameterized in the <code>_env<\/code> folder. The code modules from <code>_env<\/code> are then loaded into the environments (prod, dev) and configured with the environment-specific parameters from <code>\/env.hcl<\/code>.<\/p>\n<\/div>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Disadvantages of Terraform<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">reusability and modularity<\/h3>\n\n\n\n<p>Terraform offers the possibility to organize code in modules for reuse. However, managing and using many different modules in complex infrastructure environments with multiple stages, such as Dev, Test and Prod, becomes challenging.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">State File Management<\/h3>\n\n\n\n<p>Terraform stores the current status of the entire infrastructure in a common state file. In environments with multiple modules and teams, a central state file can cause problems. If multiple team members are working on different modules, race conditions can easily arise in which the state file is temporarily locked.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Code duplication and configuration of different environments<\/h3>\n\n\n\n<p>Terraform does not have native support for automatic configuration across environments (e.g. dev, staging, production). The developer has to build complex solutions with variables or other mechanisms themselves. When working in multiple environments, one tends to duplicate configurations because Terraform does not provide an out-of-the-box solution for dealing with multiple environments. This leads to redundant configurations and makes maintenance difficult.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Advantages of Terragrunt as a wrapper<\/h2>\n\n\n\n<p>Terragrunt is a wrapper around Terraform and addresses some of these weaknesses.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Management of environments and DRY principle<\/h3>\n\n\n\n<p>Terragrunt supports better structuring of Terraform code by promoting the DRY (\u201cDon\u2019t Repeat Yourself\u201d) principle. Instead of duplicating configurations for different environments, Terragrunt provides mechanisms to efficiently manage variables and infrastructure for different environments. It simplifies the handling of shared configurations by using a single configuration file and only overriding environment-specific values.<\/p>\n\n\n\n<p>Docs: <a href=\"https:\/\/terragrunt.gruntwork.io\/docs\/features\/keep-your-terraform-code-dry\/\">https:\/\/terragrunt.gruntwork.io\/docs\/features\/keep-your-terraform-code-dry\/<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Dependency Management<\/h3>\n\n\n\n<p>In complex Terraform setups, there are often dependencies between different modules (e.g. a network needs to be deployed before a database). In Terragrunt, dependencies between modules can be explicitly defined to automatically execute them in the correct order.<\/p>\n\n\n\n<p>Docs: <a href=\"https:\/\/terragrunt.gruntwork.io\/docs\/reference\/config-blocks-and-attributes\/#dependency\">https:\/\/terragrunt.gruntwork.io\/docs\/reference\/config-blocks-and-attributes\/#dependency<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Automated state management and provider configuration<\/h3>\n\n\n\n<p>Instead of duplicating the same state backend and provider configuration in each module, Terragrunt can inject this configuration automatically. This reduces redundant code in Terraform configuration files and simplifies administration.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">State Backend Configuration<\/h4>\n\n\n\n<p>Terragrunt supports automatic management of state files for different modules and environments. Terragrunt can isolate state files per environment and module, for example by automatically storing them in different S3 buckets (for AWS) or integrating them into suitable storage solutions such as Gitlab Remote State Backend.<\/p>\n\n\n\n<p>The following example defines a template for the Gitlab HTTP backend.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\" data-no-translation=\"\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">backend_http_gitlab.hcl<\/span><span role=\"button\" tabindex=\"0\" data-code=\"locals {  \/\/ read the env vars  env_locals        = read_terragrunt_config(find_in_parent_folders(&quot;${get_original_terragrunt_dir()}\/..\/env.hcl&quot;))  \/\/ evaluate the gitlab url  gitlab_url_eval   = can(local.env_locals.locals.gitlab_url) ? local.env_locals.locals.gitlab_url : &quot;https:\/\/gitlab.com&quot;  gitlab_project_id = local.env_locals.locals.gitlab_project_id}remote_state {  backend = &quot;http&quot;  generate = {    path      = &quot;backend_http_gitlab.tf&quot;    if_exists = &quot;overwrite_terragrunt&quot;  }  config = {    address        = &quot;${local.gitlab_url_eval}\/api\/v4\/projects\/${local.env_locals.locals.gitlab_project_id}\/terraform\/state\/${local.env_locals.locals.env}_${basename(get_original_terragrunt_dir())}&quot;    lock_address   = &quot;${local.gitlab_url_eval}\/api\/v4\/projects\/${local.env_locals.locals.gitlab_project_id}\/terraform\/state\/${local.env_locals.locals.env}_${basename(get_original_terragrunt_dir())}\/lock&quot;    unlock_address = &quot;${local.gitlab_url_eval}\/api\/v4\/projects\/${local.env_locals.locals.gitlab_project_id}\/terraform\/state\/${local.env_locals.locals.env}_${basename(get_original_terragrunt_dir())}\/lock&quot;    lock_method    = &quot;POST&quot;    unlock_method  = &quot;DELETE&quot;    retry_wait_min = 5    username       = &quot;${get_env(&quot;TF_HTTP_USERNAME&quot;)}&quot;    \/\/ the env variable TF_HTTP_PASSWORD is evaluated at runtime, i do not recommend to save it for security reasons  }}\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #B392F0\">locals<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #6A737D\">\/\/ read the env vars<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  env_locals<\/span><span style=\"color: #FFAB70\">        <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #79B8FF\">read_terragrunt_config<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">find_in_parent_folders<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">&quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #79B8FF\">get_original_terragrunt_dir<\/span><span style=\"color: #9ECBFF\">()<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">\/..\/env.hcl&quot;<\/span><span style=\"color: #E1E4E8\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #6A737D\">\/\/ evaluate the gitlab url<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  gitlab_url_eval<\/span><span style=\"color: #FFAB70\">   <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #79B8FF\">can<\/span><span style=\"color: #E1E4E8\">(local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">gitlab_url) <\/span><span style=\"color: #F97583\">?<\/span><span style=\"color: #E1E4E8\"> local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">gitlab_url : <\/span><span style=\"color: #9ECBFF\">&quot;https:\/\/gitlab.com&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  gitlab_project_id<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">gitlab_project_id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">remote_state<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  backend<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #9ECBFF\">&quot;http&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  generate<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    path      <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;backend_http_gitlab.tf&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    if_exists <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;overwrite_terragrunt&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  config<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    address        <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">gitlab_url_eval<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">\/api\/v4\/projects\/<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">gitlab_project_id<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">\/terraform\/state\/<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">_<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #79B8FF\">basename<\/span><span style=\"color: #9ECBFF\">(<\/span><span style=\"color: #79B8FF\">get_original_terragrunt_dir<\/span><span style=\"color: #9ECBFF\">())<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    lock_address   <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">gitlab_url_eval<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">\/api\/v4\/projects\/<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">gitlab_project_id<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">\/terraform\/state\/<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">_<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #79B8FF\">basename<\/span><span style=\"color: #9ECBFF\">(<\/span><span style=\"color: #79B8FF\">get_original_terragrunt_dir<\/span><span style=\"color: #9ECBFF\">())<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">\/lock&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    unlock_address <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">gitlab_url_eval<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">\/api\/v4\/projects\/<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">gitlab_project_id<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">\/terraform\/state\/<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">_<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #79B8FF\">basename<\/span><span style=\"color: #9ECBFF\">(<\/span><span style=\"color: #79B8FF\">get_original_terragrunt_dir<\/span><span style=\"color: #9ECBFF\">())<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">\/lock&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    lock_method    <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;POST&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    unlock_method  <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;DELETE&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    retry_wait_min <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">5<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    username       <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #79B8FF\">get_env<\/span><span style=\"color: #9ECBFF\">(&quot;TF_HTTP_USERNAME&quot;)<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #6A737D\">\/\/ the env variable TF_HTTP_PASSWORD is evaluated at runtime, i do not recommend to save it for security reasons<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Code: <a href=\"https:\/\/github.com\/csautter\/terragrunt-blueprint\/blob\/main\/deployments\/terraform\/backend_http_gitlab.hcl\">https:\/\/github.com\/csautter\/terragrunt-blueprint\/blob\/main\/deployments\/terraform\/backend_http_gitlab.hcl<\/a><\/p>\n\n\n\n<p>Docs: <a href=\"https:\/\/terragrunt.gruntwork.io\/docs\/reference\/config-blocks-and-attributes\/#remote_state\">https:\/\/terragrunt.gruntwork.io\/docs\/reference\/config-blocks-and-attributes\/#remote_state<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"translation-block\">The root <code>terragrunt.hcl<\/code> file loads the Terraform backend defined in <code>env.hcl<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-blur-enabled cbp-unblur-on-hover\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\" data-no-translation=\"\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">terragrunt.hcl<\/span><span role=\"button\" tabindex=\"0\" data-code=\"locals {  env_locals                = read_terragrunt_config(find_in_parent_folders(&quot;env.hcl&quot;))  tflint_hook_enabled       = get_env(&quot;DISABLE_TFLINT_HOOK&quot;, &quot;false&quot;) == &quot;true&quot; ? false : true  trivy_hook_enabled        = get_env(&quot;DISABLE_TRIVY_HOOK&quot;, &quot;false&quot;) == &quot;true&quot; ? false : true  backend_target_evaluation = can(local.env_locals.locals.state_backend) ? local.env_locals.locals.state_backend : &quot;local&quot;  backend_target            = contains([&quot;http_gitlab&quot;, &quot;local&quot;], local.backend_target_evaluation) ? local.backend_target_evaluation : &quot;local&quot;  backend_config            = read_terragrunt_config(find_in_parent_folders(&quot;backend_${local.backend_target}.hcl&quot;))}remote_state {  backend  = local.backend_config.remote_state.backend  config   = local.backend_config.remote_state.config  generate = local.backend_config.remote_state.generate}\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #B392F0\">locals<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line cbp-no-blur\"><span style=\"color: #E1E4E8\">  env_locals<\/span><span style=\"color: #FFAB70\">                <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #79B8FF\">read_terragrunt_config<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">find_in_parent_folders<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">&quot;env.hcl&quot;<\/span><span style=\"color: #E1E4E8\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  tflint_hook_enabled<\/span><span style=\"color: #FFAB70\">       <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #79B8FF\">get_env<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">&quot;DISABLE_TFLINT_HOOK&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;false&quot;<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">==<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;true&quot;<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">?<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">false<\/span><span style=\"color: #E1E4E8\"> : <\/span><span style=\"color: #79B8FF\">true<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  trivy_hook_enabled<\/span><span style=\"color: #FFAB70\">        <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #79B8FF\">get_env<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">&quot;DISABLE_TRIVY_HOOK&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;false&quot;<\/span><span style=\"color: #E1E4E8\">) <\/span><span style=\"color: #F97583\">==<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">&quot;true&quot;<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">?<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">false<\/span><span style=\"color: #E1E4E8\"> : <\/span><span style=\"color: #79B8FF\">true<\/span><\/span>\n<span class=\"line cbp-no-blur\"><span style=\"color: #E1E4E8\">  backend_target_evaluation<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #79B8FF\">can<\/span><span style=\"color: #E1E4E8\">(local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">state_backend) <\/span><span style=\"color: #F97583\">?<\/span><span style=\"color: #E1E4E8\"> local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env_locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">state_backend : <\/span><span style=\"color: #9ECBFF\">&quot;local&quot;<\/span><\/span>\n<span class=\"line cbp-no-blur\"><span style=\"color: #E1E4E8\">  backend_target<\/span><span style=\"color: #FFAB70\">            <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #79B8FF\">contains<\/span><span style=\"color: #E1E4E8\">([<\/span><span style=\"color: #9ECBFF\">&quot;http_gitlab&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;local&quot;<\/span><span style=\"color: #E1E4E8\">], local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">backend_target_evaluation) <\/span><span style=\"color: #F97583\">?<\/span><span style=\"color: #E1E4E8\"> local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">backend_target_evaluation : <\/span><span style=\"color: #9ECBFF\">&quot;local&quot;<\/span><\/span>\n<span class=\"line cbp-no-blur\"><span style=\"color: #E1E4E8\">  backend_config<\/span><span style=\"color: #FFAB70\">            <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #79B8FF\">read_terragrunt_config<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">find_in_parent_folders<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">&quot;backend_<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">backend_target<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">.hcl&quot;<\/span><span style=\"color: #E1E4E8\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line cbp-no-blur\"><span style=\"color: #B392F0\">remote_state<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line cbp-no-blur\"><span style=\"color: #E1E4E8\">  backend<\/span><span style=\"color: #FFAB70\">  <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">backend_config<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">remote_state<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">backend<\/span><\/span>\n<span class=\"line cbp-no-blur\"><span style=\"color: #E1E4E8\">  config<\/span><span style=\"color: #FFAB70\">   <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">backend_config<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">remote_state<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">config<\/span><\/span>\n<span class=\"line cbp-no-blur\"><span style=\"color: #E1E4E8\">  generate<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">backend_config<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">remote_state<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">generate<\/span><\/span>\n<span class=\"line cbp-no-blur\"><span style=\"color: #E1E4E8\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Code: <a href=\"https:\/\/github.com\/csautter\/terragrunt-blueprint\/blob\/main\/deployments\/terraform\/terragrunt.hcl\">https:\/\/github.com\/csautter\/terragrunt-blueprint\/blob\/main\/deployments\/terraform\/terragrunt.hcl<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">provider configuration<\/h4>\n\n\n\n<p class=\"translation-block\">Terragrunt enables simplified provider configurations in different environments and modules. The provider configurations can be generated automatically depending on the current environment.<br>In the example of <code>provider_aws_config.hcl<\/code>, an AWS provider configuration is generated. All parameters are loaded from the <code>env.hcl<\/code> file of the respective environment (dev, staging, prod).<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\" data-no-translation=\"\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">provider_aws_config.hcl<\/span><span role=\"button\" tabindex=\"0\" data-code=\"locals {  env = read_terragrunt_config(find_in_parent_folders(&quot;env.hcl&quot;))}generate &quot;aws&quot; {  path      = &quot;provider_aws.tf&quot;  if_exists = &quot;overwrite_terragrunt&quot;  contents  = &lt;&lt;-EOF     provider &quot;aws&quot; {        default_tags {          tags = {            Environment = &quot;${local.env.locals.env}&quot;          }        }        region  = &quot;${local.env.locals.region}&quot;        profile = &quot;${get_env(&quot;AWS_PROFILE&quot;, &quot;${local.env.locals.aws_profile}&quot;)}&quot;        allowed_account_ids = [&quot;${get_env(&quot;AWS_ACCOUNT_ID&quot;, &quot;${local.env.locals.aws_account_id}&quot;)}&quot;]     }  EOF}\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #B392F0\">locals<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  env<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #79B8FF\">read_terragrunt_config<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #79B8FF\">find_in_parent_folders<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">&quot;env.hcl&quot;<\/span><span style=\"color: #E1E4E8\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #B392F0\">generate<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">&quot;aws&quot;<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  path<\/span><span style=\"color: #FFAB70\">      <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #9ECBFF\">&quot;provider_aws.tf&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  if_exists<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #9ECBFF\">&quot;overwrite_terragrunt&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  contents<\/span><span style=\"color: #FFAB70\">  <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">&lt;&lt;-EOF<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">     provider &quot;aws&quot; {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">        default_tags {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">          tags = {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">            Environment = &quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">          }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">        region  = &quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">region<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">        profile = &quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #79B8FF\">get_env<\/span><span style=\"color: #9ECBFF\">(&quot;AWS_PROFILE&quot;, &quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">aws_profile<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">&quot;)<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">        allowed_account_ids = [&quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #79B8FF\">get_env<\/span><span style=\"color: #9ECBFF\">(&quot;AWS_ACCOUNT_ID&quot;, &quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">env<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">locals<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">aws_account_id<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">&quot;)<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">&quot;]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9ECBFF\">     }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">  EOF<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Code: <a href=\"https:\/\/github.com\/csautter\/terragrunt-blueprint\/blob\/main\/deployments\/terraform\/env\/_env\/provider_aws_config.hcl\">https:\/\/github.com\/csautter\/terragrunt-blueprint\/blob\/main\/deployments\/terraform\/env\/_env\/provider_aws_config.hcl<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>The AWS provider configuration can then be loaded into the modules using an include block.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\" data-no-translation=\"\"><span role=\"button\" tabindex=\"0\" data-code=\"include &quot;provider_vault_config&quot; {  path   = &quot;${get_terragrunt_dir()}\/..\/..\/_env\/provider_aws_config.hcl&quot;  expose = true}\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #B392F0\">include<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">&quot;provider_vault_config&quot;<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  path<\/span><span style=\"color: #FFAB70\">   <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #9ECBFF\">&quot;<\/span><span style=\"color: #F97583\">${<\/span><span style=\"color: #79B8FF\">get_terragrunt_dir<\/span><span style=\"color: #9ECBFF\">()<\/span><span style=\"color: #F97583\">}<\/span><span style=\"color: #9ECBFF\">\/..\/..\/_env\/provider_aws_config.hcl&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  expose<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #79B8FF\">true<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Code: <a href=\"https:\/\/github.com\/csautter\/terragrunt-blueprint\/blob\/main\/deployments\/terraform\/env\/dev\/aws_dummy\/terragrunt.hcl\">https:\/\/github.com\/csautter\/terragrunt-blueprint\/blob\/main\/deployments\/terraform\/env\/dev\/aws_dummy\/terragrunt.hcl<\/a><\/p>\n\n\n\n<p>Docs: <a href=\"https:\/\/terragrunt.gruntwork.io\/docs\/reference\/config-blocks-and-attributes\/#include\">https:\/\/terragrunt.gruntwork.io\/docs\/reference\/config-blocks-and-attributes\/#include<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">hooks<\/h3>\n\n\n\n<p>In Terragrunt, hooks can be defined that trigger trivy, tflint or terraform fmt every time terraform plan\/apply is executed. The immediate feedback during development can significantly increase code quality.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\" data-no-translation=\"\"><span role=\"button\" tabindex=\"0\" data-code=\"terraform {  before_hook &quot;terraform_fmt&quot; {    commands = [&quot;apply&quot;, &quot;plan&quot;]    execute  = [&quot;terraform&quot;, &quot;fmt&quot;, &quot;-recursive&quot;]  }  before_hook &quot;terragrunt_hclfmt&quot; {    commands = [&quot;apply&quot;, &quot;plan&quot;]    execute  = [&quot;terragrunt&quot;, &quot;hclfmt&quot;]  }  before_hook &quot;tflint&quot; {    commands = local.tflint_hook_enabled ? [&quot;apply&quot;, &quot;plan&quot;] : []    execute  = [&quot;tflint&quot;]  }  before_hook &quot;trivy&quot; {    commands = local.trivy_hook_enabled ? [&quot;apply&quot;, &quot;plan&quot;] : []    execute  = [&quot;trivy&quot;, &quot;config&quot;, &quot;.&quot;]  }}\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #B392F0\">terraform<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #B392F0\">before_hook<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">&quot;terraform_fmt&quot;<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    commands<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">[<\/span><span style=\"color: #9ECBFF\">&quot;apply&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;plan&quot;<\/span><span style=\"color: #E1E4E8\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    execute<\/span><span style=\"color: #FFAB70\">  <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">[<\/span><span style=\"color: #9ECBFF\">&quot;terraform&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;fmt&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;-recursive&quot;<\/span><span style=\"color: #E1E4E8\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #B392F0\">before_hook<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">&quot;terragrunt_hclfmt&quot;<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    commands<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">[<\/span><span style=\"color: #9ECBFF\">&quot;apply&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;plan&quot;<\/span><span style=\"color: #E1E4E8\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    execute<\/span><span style=\"color: #FFAB70\">  <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">[<\/span><span style=\"color: #9ECBFF\">&quot;terragrunt&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;hclfmt&quot;<\/span><span style=\"color: #E1E4E8\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #B392F0\">before_hook<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">&quot;tflint&quot;<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    commands<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">tflint_hook_enabled <\/span><span style=\"color: #F97583\">?<\/span><span style=\"color: #E1E4E8\"> [<\/span><span style=\"color: #9ECBFF\">&quot;apply&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;plan&quot;<\/span><span style=\"color: #E1E4E8\">] : []<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    execute<\/span><span style=\"color: #FFAB70\">  <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">[<\/span><span style=\"color: #9ECBFF\">&quot;tflint&quot;<\/span><span style=\"color: #E1E4E8\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #B392F0\">before_hook<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">&quot;trivy&quot;<\/span><span style=\"color: #E1E4E8\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    commands<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">local<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #E1E4E8\">trivy_hook_enabled <\/span><span style=\"color: #F97583\">?<\/span><span style=\"color: #E1E4E8\"> [<\/span><span style=\"color: #9ECBFF\">&quot;apply&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;plan&quot;<\/span><span style=\"color: #E1E4E8\">] : []<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    execute<\/span><span style=\"color: #FFAB70\">  <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #FFAB70\"> <\/span><span style=\"color: #E1E4E8\">[<\/span><span style=\"color: #9ECBFF\">&quot;trivy&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;config&quot;<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">&quot;.&quot;<\/span><span style=\"color: #E1E4E8\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Code: <a href=\"https:\/\/github.com\/csautter\/terragrunt-blueprint\/blob\/main\/deployments\/terraform\/terragrunt.hcl\">https:\/\/github.com\/csautter\/terragrunt-blueprint\/blob\/main\/deployments\/terraform\/terragrunt.hcl<\/a><\/p>\n\n\n\n<p>Docs: <a href=\"https:\/\/terragrunt.gruntwork.io\/docs\/features\/hooks\">https:\/\/terragrunt.gruntwork.io\/docs\/features\/hooks<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Terraform is a very powerful tool for managing infrastructure, but it has limitations when it comes to handling state files, modularity, and managing environments. Terragrunt was developed to address these weaknesses, particularly through improvements in reusability, state management, and dependency handling. By using Terragrunt in my projects, I was able to significantly increase code quality and reduce complexity.<\/p>","protected":false},"excerpt":{"rendered":"<p>Terraform is one of the top IaC (Infrastructure as Code) tools. With Terraform, developers can create, change and version infrastructure safely and efficiently. The declarative configuration language HCL (HashiCorp Configuration Language) describes the desired state of a cloud-based or local infrastructure. Terraform can then use this to create a plan to deploy the infrastructure. Terraform has many advantages...<\/p>\n<p><a class=\"read-more\" href=\"https:\/\/www.c-sautter.de\/en\/terragrunt-the-missing-terraform-part\/\">Read More<\/a><\/p>","protected":false},"author":1,"featured_media":449,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[45,41],"tags":[50,51],"class_list":["post-327","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-infrastructure-as-code","category-terraform","tag-terraform","tag-terragrunt"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Terragrunt - the missing Terraform Part - Carl-Christian Sautter<\/title>\n<meta name=\"description\" content=\"Terragrunt \u2665 Terraform? Umsetzung einer optimierten Terraform Projekt Struktur mit Terragrunt inkl. Code Beispielen.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.c-sautter.de\/en\/terragrunt-the-missing-terraform-part\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Terragrunt - the missing Terraform Part - Carl-Christian Sautter\" \/>\n<meta property=\"og:description\" content=\"Terragrunt \u2665 Terraform? Umsetzung einer optimierten Terraform Projekt Struktur mit Terragrunt inkl. Code Beispielen.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.c-sautter.de\/en\/terragrunt-the-missing-terraform-part\/\" \/>\n<meta property=\"og:site_name\" content=\"Carl-Christian Sautter\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-09T21:25:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-23T14:44:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"chris\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"chris\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/\"},\"author\":{\"name\":\"chris\",\"@id\":\"https:\/\/www.c-sautter.de\/#\/schema\/person\/358bfdbce75a7762072fd564be80419d\"},\"headline\":\"Terragrunt &#8211; the missing Terraform Part\",\"datePublished\":\"2024-10-09T21:25:45+00:00\",\"dateModified\":\"2024-11-23T14:44:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/\"},\"wordCount\":948,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.c-sautter.de\/#\/schema\/person\/358bfdbce75a7762072fd564be80419d\"},\"image\":{\"@id\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg\",\"keywords\":[\"terraform\",\"terragrunt\"],\"articleSection\":[\"Infrastructure as Code\",\"Terraform\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/\",\"url\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/\",\"name\":\"Terragrunt - the missing Terraform Part - Carl-Christian Sautter\",\"isPartOf\":{\"@id\":\"https:\/\/www.c-sautter.de\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg\",\"datePublished\":\"2024-10-09T21:25:45+00:00\",\"dateModified\":\"2024-11-23T14:44:34+00:00\",\"description\":\"Terragrunt \u2665 Terraform? Umsetzung einer optimierten Terraform Projekt Struktur mit Terragrunt inkl. Code Beispielen.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#primaryimage\",\"url\":\"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg\",\"contentUrl\":\"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg\",\"width\":1024,\"height\":1024,\"caption\":\"Terragrunt and Terraform\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.c-sautter.de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Terragrunt &#8211; the missing Terraform Part\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.c-sautter.de\/#website\",\"url\":\"https:\/\/www.c-sautter.de\/\",\"name\":\"Carl-Christian Sautter\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.c-sautter.de\/#\/schema\/person\/358bfdbce75a7762072fd564be80419d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.c-sautter.de\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.c-sautter.de\/#\/schema\/person\/358bfdbce75a7762072fd564be80419d\",\"name\":\"chris\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.c-sautter.de\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2023\/09\/P1100639-Bearbeitet-Kopie.jpg\",\"contentUrl\":\"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2023\/09\/P1100639-Bearbeitet-Kopie.jpg\",\"width\":1657,\"height\":1657,\"caption\":\"chris\"},\"logo\":{\"@id\":\"https:\/\/www.c-sautter.de\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/www.c-sautter.de\",\"https:\/\/www.linkedin.com\/in\/carl-christian-sautter\/\"],\"url\":\"https:\/\/www.c-sautter.de\/en\/author\/chris\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Terragrunt - the missing Terraform Part - Carl-Christian Sautter","description":"Terragrunt \u2665 Terraform? Umsetzung einer optimierten Terraform Projekt Struktur mit Terragrunt inkl. Code Beispielen.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.c-sautter.de\/en\/terragrunt-the-missing-terraform-part\/","og_locale":"en_US","og_type":"article","og_title":"Terragrunt - the missing Terraform Part - Carl-Christian Sautter","og_description":"Terragrunt \u2665 Terraform? Umsetzung einer optimierten Terraform Projekt Struktur mit Terragrunt inkl. Code Beispielen.","og_url":"https:\/\/www.c-sautter.de\/en\/terragrunt-the-missing-terraform-part\/","og_site_name":"Carl-Christian Sautter","article_published_time":"2024-10-09T21:25:45+00:00","article_modified_time":"2024-11-23T14:44:34+00:00","og_image":[{"width":1024,"height":1024,"url":"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg","type":"image\/jpeg"}],"author":"chris","twitter_card":"summary_large_image","twitter_misc":{"Written by":"chris","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#article","isPartOf":{"@id":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/"},"author":{"name":"chris","@id":"https:\/\/www.c-sautter.de\/#\/schema\/person\/358bfdbce75a7762072fd564be80419d"},"headline":"Terragrunt &#8211; the missing Terraform Part","datePublished":"2024-10-09T21:25:45+00:00","dateModified":"2024-11-23T14:44:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/"},"wordCount":948,"commentCount":0,"publisher":{"@id":"https:\/\/www.c-sautter.de\/#\/schema\/person\/358bfdbce75a7762072fd564be80419d"},"image":{"@id":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#primaryimage"},"thumbnailUrl":"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg","keywords":["terraform","terragrunt"],"articleSection":["Infrastructure as Code","Terraform"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/","url":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/","name":"Terragrunt - the missing Terraform Part - Carl-Christian Sautter","isPartOf":{"@id":"https:\/\/www.c-sautter.de\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#primaryimage"},"image":{"@id":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#primaryimage"},"thumbnailUrl":"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg","datePublished":"2024-10-09T21:25:45+00:00","dateModified":"2024-11-23T14:44:34+00:00","description":"Terragrunt \u2665 Terraform? Umsetzung einer optimierten Terraform Projekt Struktur mit Terragrunt inkl. Code Beispielen.","breadcrumb":{"@id":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#primaryimage","url":"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg","contentUrl":"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2024\/10\/Terragrunt_and_Terraform.jpeg","width":1024,"height":1024,"caption":"Terragrunt and Terraform"},{"@type":"BreadcrumbList","@id":"https:\/\/www.c-sautter.de\/terragrunt-the-missing-terraform-part\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.c-sautter.de\/"},{"@type":"ListItem","position":2,"name":"Terragrunt &#8211; the missing Terraform Part"}]},{"@type":"WebSite","@id":"https:\/\/www.c-sautter.de\/#website","url":"https:\/\/www.c-sautter.de\/","name":"Carl-Christian Sautter","description":"","publisher":{"@id":"https:\/\/www.c-sautter.de\/#\/schema\/person\/358bfdbce75a7762072fd564be80419d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.c-sautter.de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.c-sautter.de\/#\/schema\/person\/358bfdbce75a7762072fd564be80419d","name":"chris","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.c-sautter.de\/#\/schema\/person\/image\/","url":"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2023\/09\/P1100639-Bearbeitet-Kopie.jpg","contentUrl":"https:\/\/www.c-sautter.de\/wp-content\/uploads\/2023\/09\/P1100639-Bearbeitet-Kopie.jpg","width":1657,"height":1657,"caption":"chris"},"logo":{"@id":"https:\/\/www.c-sautter.de\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.c-sautter.de","https:\/\/www.linkedin.com\/in\/carl-christian-sautter\/"],"url":"https:\/\/www.c-sautter.de\/en\/author\/chris\/"}]}},"_links":{"self":[{"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/posts\/327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/comments?post=327"}],"version-history":[{"count":35,"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/posts\/327\/revisions"}],"predecessor-version":[{"id":464,"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/posts\/327\/revisions\/464"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/media\/449"}],"wp:attachment":[{"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/media?parent=327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/categories?post=327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.c-sautter.de\/en\/wp-json\/wp\/v2\/tags?post=327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}