Difference between revisions of "Terragrunt.hcl"

From wikieduonline
Jump to navigation Jump to search
 
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
  
https://terragrunt.gruntwork.io/docs/reference/built-in-functions/#find_in_parent_folders
+
Blocks
[[find_in_parent_folders]]
+
* <code>[[terraform]]</code>
 +
* <code>[[Terragrunt block: remote state|remote_state]]</code>
 +
* <code>[[include]]</code>
 +
* <code>[[locals]]</code>
 +
* <code>[[dependency]]</code>
 +
* <code>[[dependencies]]</code>
 +
* <code>[[generate]]</code>
 +
 
 +
* [[Terragrunt functions]]: [[find_in_parent_folders]] <ref>https://terragrunt.gruntwork.io/docs/reference/built-in-functions/#find_in_parent_folders
 +
</ref>
  
  
Line 11: Line 20:
 
  }
 
  }
 
   
 
   
<pre>
+
 
generate "remote_states" {
+
[[generate]] "[[remote_states]]" {
  path      = "tg_remote_states.tf"
+
  path      = "tg_remote_states.tf"
  if_exists = "overwrite"
+
  if_exists = "overwrite"
  contents = templatefile("../../../remote-states.tmpl",
+
  contents = [[templatefile]]("../../../remote-states.tmpl",
  {
+
  {
    remote_states = [
+
    remote_states = [
      {
+
      {
        "name" = "vpc"
+
        "name" = "vpc"
        "bucket" = "${get_env("AWS_SESSION_NAME")}-state-storage"
+
        "bucket" = "${get_env("AWS_SESSION_NAME")}-state-storage"
        "key" = "terraform/${get_env("AWS_SESSION_NAME")}/${get_env("AWS_ENV")}-vpc"
+
        "key" = "terraform/${get_env("AWS_SESSION_NAME")}/${get_env("AWS_ENV")}-vpc"
      }
+
      }
    ]
+
    ]
  })
+
  })
}
+
}
</pre>
 
  
 
== See also ==
 
== See also ==
 +
* {{terragrunt.hcl}}
 
* {{terragrunt}}
 
* {{terragrunt}}
  
 
[[Category:Terragrunt]]
 
[[Category:Terragrunt]]

Latest revision as of 15:25, 20 June 2023

Blocks


Examples[edit]

include {
  path = find_in_parent_folders()
}

generate "remote_states" {
  path      = "tg_remote_states.tf"
  if_exists = "overwrite"
  contents = templatefile("../../../remote-states.tmpl",
  {
    remote_states = [
      {
        "name" = "vpc"
        "bucket" = "${get_env("AWS_SESSION_NAME")}-state-storage"
        "key" = "terraform/${get_env("AWS_SESSION_NAME")}/${get_env("AWS_ENV")}-vpc"
      }
    ]
  })
}

See also[edit]

  • https://terragrunt.gruntwork.io/docs/reference/built-in-functions/#find_in_parent_folders
  • Advertising: