#terragrunt (2022-05)

terragrunt

Terragrunt discussions

Archive: https://archive.sweetops.com/terragrunt/

2022-05-11

jmct avatar

Hello. I have a configuration that uses S3 remote states for our backend. I have one Github repository that builds something and another Github repository that builds something else. Both of these repositories create their own state files, but in the same S3 bucket.

How would I go about referencing the output of the other state file in the same bucket through terragrunt? Initially I thought through a dependency, but the remote terragrunt.hcl isn’t local to this repository (so the config_path isn’t valid). Appreciate the help.

loren avatar

you wouldn’t use terraform outputs or terragrunt’s dependencies. you’d need to push values to a central store in one config, like consul or aws ssm parameter store, and then read from that central store in the other config.

or you can use the data source terraform_remote_state. but typically these days some kind of parameter store is recommended over this data source

jmct avatar

I see, gotcha. That should work - thank you for the answer!

2022-05-19

Amit Karpe avatar
Amit Karpe

Hi,

How to reduce disk space for .terragrunt-cache? As of now for every tg config, .terragrunt-cache took 200-500 MB disk space.

I am using following configuration for TF/TG

❯ cat ~/.terraformrc
#plugin_cache_dir   = "$HOME/.terraform.d/plugin-cache"
disable_checkpoint = true
provider_installation {
  filesystem_mirror {
    path = "$HOME/.terraform.d/provider"
  }
}

Can someone guide me?

2022-05-24

Amit Karpe avatar
Amit Karpe

Looks like no need to set “provider_installation”. Once I remove it, overall things works as expected. And due to use of “plugin_cache” it was not downloading all plugin again and again.

Amit Karpe avatar
Amit Karpe

Anyone using terragrunt workspace? I have configure CI/CD pipeline for our infra, which is managed using TG. Found env0 and Atlantis, as potential solutions. Anyone would like to share their experience?

tim.davis.instinct avatar
tim.davis.instinct

Hey Amit, I am the devops advocate for env0. Would be glad to answer any questions or provide assistance if you need. I’ll give others a chance to chime in if they have input.

Amit Karpe avatar
Amit Karpe

thx for this gesture.

Amit Karpe avatar
Amit Karpe

I will give try and comeback with specific question. Meanwhile if you want to share any guide/video for quick start that will be great. my setup: AWS/EKS/TG/GitHub Also we are planning to go with “Multiple AWS Accounts with AWS Organizations”.

1
tim.davis.instinct avatar
tim.davis.instinct

Absolutely! We have a YouTube channel with a bunch of content, but specifically, I created an Admin Guide a while back with a series of short videos to walk you step by step through setting it up, and deploying: https://www.youtube.com/c/envZero/playlists?view=50&sort=dd&shelf_id=1

env0

env0 provides infrastructure as code automation for Terraform, Terragrunt and GitOps workflows. Leverage our remote-run workflows management for greater visibility, predictability and governance on your cloud deployments. Home of Quick Tech with env0’s DevOps Advocate, Tim Davis! env0 provides you with “Managed Self-Service” enabling you to design the controls and empower your teams with self-service cloud environments. Visit Us Here: https://www.env0.com/

1

2022-05-26

2022-05-28

MalluLuke avatar
MalluLuke

I’m new to terragrunt. Trying to create dynamic backend. I have key = "${path_relative_to_include()}/terraform.tfstate" in my top level terragrunt.hcl which is creating the s3 key as ./terraform.tfstate. Is there any way to remove the dot from that path?

2022-05-31

MalluLuke avatar
MalluLuke

Hello, I’m following this instruction to setup Atlantis with Terrgrunt. It looks like terragrunt is creating correct atlatis.yaml file. There are three projects in the atlantis.yaml file terragrunt created. However only one of them is running! Nothing in the Atlantis log indicating any issues! Any help would be appreciated

transcend-io/terragrunt-atlantis-config

Generate Atlantis config for Terragrunt projects.

1
David avatar

Could you paste the contents of the atlantis.yaml file and the tree output of your terragrunt directories?

Disclaimer: I wrote terragrunt-atlantis-config and that blog

transcend-io/terragrunt-atlantis-config

Generate Atlantis config for Terragrunt projects.

MalluLuke avatar
MalluLuke

Here is the atlantis.yaml file

automerge: false
parallel_apply: true
parallel_plan: true
projects:
- autoplan:
    enabled: true
    when_modified:
    - '*.hcl'
    - '*.tf*'
    - ../terragrunt.hcl
    - ../_env/common_variables.hcl
    - ../<company_name>.tfvars
    - <company_name>-private.tfvars
    - ../../_env/common_variables.hcl
  dir: discovery/build
- autoplan:
    enabled: true
    when_modified:
    - '*.hcl'
    - '*.tf*'
    - ../terragrunt.hcl
    - ../_env/common_variables.hcl
    - ../<company_name>.tfvars
    - <company_name>-private.tfvars
    - ../../_env/common_variables.hcl
  dir: discovery/compute
- autoplan:
    enabled: true
    when_modified:
    - '*.hcl'
    - '*.tf*'
    - ../terragrunt.hcl
    - ../_env/common_variables.hcl
    - ../<company_name>.tfvars
    - <company_name>-private.tfvars
    - ../../_env/common_variables.hcl
  dir: discovery/network
version: 3
MalluLuke avatar
MalluLuke
discovery
├── backend.tf
├── build
│   ├── default.tfplan
│   ├── ecr.tf
│   ├── outputs.tf
│   ├── remote_state.tf
│   └── terragrunt.hcl
├── compute
│   ├── ecs-service.tf
│   ├── ecs.tf
│   ├── jumphost.tf
│   ├── outputs.tf
│   ├── remote_state.tf
│   ├── sshkeys.tf
│   ├── terraform.tfstate
│   ├── terragrunt.hcl
│   └── variables.tf
── _env
│   └── common_variables.hcl
├── network
│   ├── outputs.tf
│   ├── peering.tf
│   ├── remote_state.tf
│   ├── terragrunt.hcl
│   ├── tgw.tf
│   ├── variables.tf
│   └── vpc.tf
├── terragrunt.hcl
David avatar

Moved convo to DMs

    keyboard_arrow_up