Questions tagged [terragrunt]
Terragrunt is a thin wrapper for Terraform that provides extra tools for working with multiple Terraform modules.
105
questions
0
votes
2answers
37 views
is it possible to call multiple terraform modules using terragrunt
I'm trying to call multiple modules from terragrunt. I understand that currently, terragrunt doesn't support multiple sources and we can only call one module at a time. So, I created a main.tf file to ...
0
votes
0answers
10 views
Using “terraform support null block” in terragrunt
So per this github comment https://github.com/hashicorp/terraform-provider-aws/issues/10304#issuecomment-613674851, trying to recreate this terraform syntax in terragrunt:
locals {
ttl = (var....
1
vote
0answers
16 views
error within if condition - 'encrypt' expected type 'bool', got unconvertible type 'string'
I'm trying to define a config block for two environments - local and cloud and I'm using the if/else condition but I got an error message for the encrypt attribute of the s3 bucket: 'encrypt' expected ...
0
votes
1answer
26 views
Terragrunt import resource created via for_each loop
I'm creating a GCP buckets with for_each loop, and wanted to import the existing buckets into my terraform state
An execution plan has been generated and is shown below.
Resource actions are indicated ...
0
votes
1answer
21 views
Terragrunt or Terraform define an object in variable with not known number of key/values
I have a list of objects (buckets) that I'd like to create with my module
buckets = [
{
name = "my_bucket",
location = "EU&...
0
votes
1answer
25 views
How to DRY S3 Buckets with different ACLs and global tags?
the following file structure:
.
├── account.hcl
├── prod
│ ├── env.hcl
│ └── s3
│ └── terragrunt.hcl
├── region.hcl
└── stage
├── env.hcl
└── s3
└── terragrunt.hcl
in prod ...
0
votes
0answers
20 views
How to set variables using terragrunt before_hook
I need to use some gcloud commands in order to create a Redis instance on GCP as terraform does not support some options that I need.
I'm trying this:
terraform {
# Before apply, run script.
...
0
votes
0answers
20 views
Access attribute in a nested map in terraform
I am trying to create route53 records using nested map variable, it looks like this
domains = {
"example.com" = {
records = {
"test.example.com" = {
...
0
votes
0answers
28 views
Create in terraform for loop beside another for loop
I'm creating GCP bucket module, for creating multiple buckets, all is going well, I took core of code from GCP prepared module and now having issue with assigning different labels to multiple buckets.
...
0
votes
2answers
36 views
Terraform state conflict between vpc and vpc-peering modules
I am using terraform and terragrunt for my companies aws infrastructure, general structure is like this, i have two main folder, one for modules, other one for environments and sourcing modules to ...
0
votes
1answer
57 views
Import Existing Resources in Terragrunt
I'm looking for a way to manage existing resources in my Terragrunt workflow without recreating them. Basic Terraform has the ability to import the remote state here but I don't see a way to do it in ...
0
votes
1answer
27 views
Unable to use variable count in terragrunt
First I created a lifecycle policy using terraform uisng this link https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/dlm_lifecycle_policy . Later I used terragrunt to create ...
2
votes
0answers
121 views
How to import to module using terragrunt?
So I'm having a hard time trying to import into module when using a third-party module via terragrunt.
My terragrunt.hcl file is as follows
locals {
environment_vars = read_terragrunt_config(...
0
votes
0answers
7 views
Terratest: Authenticate to K8s cluster from within the cluster
Is there a way to authenticate to a k8s cluster using the terratest library?
Currently I am running a Jenkins job that is on the cluster and would like to handle the auth from within using the service ...
0
votes
0answers
49 views
Error from Terragrunt while calling sops_decrypt_file()
I have configured SOPS with generator:
.sops.yaml
creation_rules:
- path_regex: \.dev\.yaml$
kms: *kms_arn*
aws_profile: dev
To generate a file
sops secrets.dev.yaml
It generates file with ...
0
votes
0answers
60 views
How to use -detailed-exitcode with terragrunt plan?
-detailed-exitcode - Return a detailed exit code when the command exits. When provided, this argument changes the exit codes and their meanings to provide more granular information about what the ...
0
votes
1answer
55 views
How to pass a list of string or strings to data template in terragrunt / terraform
I encounter this problem when i am trying to pass a list of values to data template in terraform.
I tried with different methods like
source_vpc_endpoints as a list and taking in ["vpce-xxx",...
1
vote
1answer
217 views
Unable to setup environment variable in terraform local-exec provisioner running through Atlantis (Terraform Pull Request Automation) tool
I have successfully deployed AKS Using Terragrunt through Atlantis, Now I want to set credentials to communicate with the Kubernetes API Server.
For that, I am setting up the KUBECONFIG Environment ...
1
vote
1answer
97 views
How To Have Terragrunt Auto Set “AWS_PROFILE” environment variable?
I cannot for the life of me get this to work. I need to have the AWS_PROFILE environment variable set to get terragrunt to run properly. If I run:
export AWS_PROFILE=myprofile; terragrunt plan
That ...
2
votes
2answers
45 views
how do i do a dynamic route in aws _route_table?
I am using terraform to create my aws route table and its routes.
I am referencing base on this:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table
resource "...
0
votes
1answer
39 views
Reduce Terragrunt console output
Terragrunt outputs hundreds of lines of text like:
[terragrunt] 2020/12/14 08:55:27 Setting download directory for module /module/name to /module/name/.terragrunt-cache
and
[terragrunt] [/module/name ...
0
votes
0answers
30 views
Terragrunt apply-all debug doesn't output a json tfvars file
According to this page:
https://terragrunt.gruntwork.io/docs/features/debugging/
terragrunt apply --terragrunt-debug outputs a file named terragrunt-debug.tfvars.json. However, when I do a terragrunt ...
6
votes
3answers
181 views
Best way to generate a list of non-Terraform created resources
For a couple of days I am working on a way to generate a list of non-terraform created resources. Currently I am using the tagging method but this means that AWS resources that can't be tagged should ...
0
votes
1answer
147 views
terragrunt cannot access module outputs
I'm struggling with Terragrunt (I'm still quite new).
I can describe my problem even using pure Terragrunt repo examples:
Looking here(https://github.com/gruntwork-io/terragrunt-infrastructure-live-...
0
votes
1answer
124 views
Terragrunt for_each value, can't retrieve data in other resources
I have an issue with my terragrunt/terraform code as below.
I don't know the right way to retrieve my both crawlers created by my for_each loop.
Normally I create it with for and count.
I can't ...
0
votes
0answers
39 views
Terragrunt not running built in functions when using .hcl.json files
I am relatively new to Terragrunt and running into an issue whereby I have a requirement to use hcl.json files and not simple .hcl files. The issue I am running into is I am getting an error:
json: ...
0
votes
1answer
71 views
How to make the Terraspace stack common for a few environments?
Please tell me if there is any way to make some Terraspace stack common for a few environments? For example, I have one AWS account for all non-production environments and I'd like to use the same VPC ...
0
votes
0answers
86 views
How to refer to other resources and outputs in Terragrunt?
I was following this tutorial for multi-env deployment with Terragrunt in GCP: https://harjot.me/blog/deploying-docker-containers-to-gke-using-terraform/
As you can see he didn't finish the gcp-sql ...
1
vote
1answer
325 views
Template for multiple environment terragrunt gcp project?
I want to start a new Terraform project that will deploy resources on a GCP account. I want to use Terragrunt to provision multiple environments (test,dev,prod).
Essentially each environment will be ...
0
votes
1answer
56 views
How do I make my data template file recognise a number in terraform
THe problem I am facing now is this. I am trying to make my policy more flexible. So I shifted them into a file instead of using EOF.
How to make the template file recognise a number value?
"${...
0
votes
1answer
44 views
Terragrunt dependency list output as inputs
I have two entrypoints: s3 and do_something.
s3 is a dependency for do_something and has the following code:
terragrunt.hcl
aws_regions = [ "us-east-1", "eu-east-1" ]
inputs = {
...
0
votes
0answers
18 views
How can I run Ephemeral environments using Terragrunt?
I've been using Terraform a lot, and am eyeing a move to Terragrunt, as it seems to address a lot of needs that are unanswered in "vanilla" Terraform.
What I am missing, or I don't ...
0
votes
0answers
39 views
Unable to fetch output from terragrunt output.tf in terratest Golang using terraform.Output(t,terraformOptions,variableName) function
I am able to initialize and apply terragrunt files from terratest Golang using terraform.TgApplyAll(t, terraformOptions)
But when i use below piece of code , I am unable to fetch value of output ...
0
votes
2answers
47 views
Move existing infra from terraform infra into terragrunt
I have my existing code in terraform and my infra is up and running in aws .Now I would liek to move to terragrunt , but can I move my terraform code into terragrunt ? similar to terraform mv command ...
-1
votes
1answer
193 views
How to call Terragrunt HCL files from Terratest Go script?
I have a terragrunt script which is working fine after running terragrunt apply-all command line but same thing i am not able to do/invoke form Go script. using TgApplyAll function
Below is my Go ...
0
votes
0answers
20 views
Terraform Dependancies between accounts [duplicate]
I'm running into an issue using the AWS SES service.
Ideally I'd like to setup the entire service using Terraform/Terragrunt. Unfortunately I can't seem to wrap my head around how to go about it.
To ...
1
vote
0answers
49 views
Terragrunt - How use outputs values in the same module
I am deploying different resources in terragrunt. I have a problem when in the same terragrunt.hcl I need access a ouputs generete in the same module.
CODE EXAMPLE:
# Include VPC outputs as this ...
1
vote
1answer
24 views
How to indicate custom configuration files for terragrunt modules?
I am trying to build Terragrunt script for deploying the infrastructure to Microsoft Azure cloud. Things are working fairly well but I am not able to figure out one thing.
The structure of setup looks ...
0
votes
0answers
60 views
Losing sync with state in TFC (local execution) when clearing terragrunt cache
I have an AWS ou/account/infra deployment automation pipeline I am working on that uses terragrunt, terraform, and terraform cloud to deploy accounts to an AWS org. I am using local execution in TF ...
2
votes
1answer
474 views
Take ECS Task Definition environment variables from Terraform input variables
I am trying to deploy ECS task definition with Terraform. Here is my ECS task definition resource code:
resource "aws_ecs_task_definition" "my_TD" {
family = &...
0
votes
1answer
58 views
Trouble with outputting vars with modules
I'm attempting to use modules to create several elements within Azure.
Directory structure looks like
.
├── azure-provider.tf
├── backend.tf
├── rg
│ ├── azure-provider.tf
│ ├── backend.tf
│ ├── ...
0
votes
2answers
274 views
Terragrunt - reusing modules more effectively
I've been trying to restructure my terraform modules in a way that things can be reused.
The issue I'm trying to resolve here is to avoid creating new tf modules with just one or two new attributes ...
0
votes
1answer
701 views
Terragrunt path resolution - locally referenced modules - splitting into multiple environments
For business-related reasons, I am not able to split my infrastructure using versioned modules. As it is still beneficial to split the environments, and I would like to avoid the copy/paste root ...
0
votes
1answer
78 views
Terragrunt plan-all auto-init doesn't seem to be working
I'm running into an issue where running terragrunt plan-all is requiring me to run a "terragrunt init" first .. reading https://terragrunt.gruntwork.io/docs/features/auto-init/#auto-init .. ...
0
votes
0answers
75 views
Atlantis multi step workflow terragrunt
i have a problem with atlantis workflow.
i must do that with atlantis but i don't find the best code for that
terragrunt plan --target=module.vpc
terragrunt apply --target=module.vpc
terragrunt ...
0
votes
2answers
164 views
Force Terraform to apply pending changes on AWS Elasticache Redis cluster
I am attempting to change the node type of Elasticache from older generation (cache.t2.) to newer generation (cache.t3.) using Terraform.
Able to modify the node types successfully for all of ...
1
vote
2answers
247 views
Benefits of Terragrunt DRY configuration over “Native” Terraform?
I just learned about Terragrunt. While I see some nice things, that are missing in Terraform, I do not fully understand the real benefit of the DRY configuration aspect (which seems to be the most ...
0
votes
0answers
56 views
how to inject a env variables in a common.tfvars
how to inject a env variables in a common.tfvars file
ex
export TF_VAR_ENV="test"
and use this in a common.tfvars
environment = "{get_env("TF_VAR_ENV", "")...
0
votes
0answers
114 views
terraform + atlantis + gitlab Ignoring unsupported event
I have a problem when I deploy atlantis in aws fargate .
I have configured my gitlab repository with webhook correctly.
For example if I modify a file named terragrunt.hcl in a directory code/infra
...
0
votes
1answer
253 views
How to access terragrunt variables in terraform code
I have terragrunt config where have declared the variables using locals as below at root level. In the child module , have declared the child terragrunt config file called (terragrunt.hcl).
parent ...