terragrunt | thin wrapper for Terraform that provides extra tools | Infrastructure Automation library
kandi X-RAY | terragrunt Summary
kandi X-RAY | terragrunt Summary
Terragrunt is a thin wrapper for Terraform that provides extra tools for keeping your Terraform configurations DRY, working with multiple Terraform modules, and managing remote state.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of terragrunt
terragrunt Key Features
terragrunt Examples and Code Snippets
Community Discussions
Trending Discussions on terragrunt
QUESTION
I know it's possible to combine multiple providers in a single Terraform project.
Would it be possible though, to declare different statefile per provider? In our use-case we will be deploying infrastructure with its part in the client's cloud provider account and other part within our cloud provider account.
We'd like to keep the statefiles separated (client's TF state vs our TF state), in order to allow smoother future migrations of either our part of the infra or client's part of the infra.
We also know that this can be achieved using Terragrunt on top of Terraform, but for the moment we'd prefer to avoid introducing a new tool into our stack. Hence looking for a TF-only solution (if such exists).
...ANSWER
Answered 2022-Feb-21 at 16:01The simplest solution would be to use separate folders for your and your client's infrastructure.
Is there a specific reason why you would want to keep them in one folder? Even if you need to share some values, you can easily read them by using terraform_remote_state
QUESTION
I would like to have checkov scan terraform plan output but I am not getting any success with that.Below is my code in terragrunt.hcl,GitHub Actions workflow and the message I got when my workflow completed.I have tried few methods to have it work but I am still unable to configure it correctly so that checkov can analyse the Json output of terraform plan.I would appreciate any help that I can get on this.Thank you for your assistance inadvance
...ANSWER
Answered 2022-Feb-18 at 12:17I guess it doesn't support however you can try this
QUESTION
The expectation is that when running a terragrunt run-all apply
from the root directory, a provider.tf file will be created in the sub directories. I've verified my backend is able to talk to my azure storage account and it will create a terraform.tfstate file there. I expect a provider.tf file to appear under each "service#" folder. I'm extremely new to terragrunt. This is my first exercise with it. I am not actually trying to deploy any terraform resources. Just have the provider.tf file created in my sub directories. TF version is 1.1.5. Terragrunt version is 0.36.1.
my folder structure
...ANSWER
Answered 2022-Feb-04 at 02:23I got it to work, but the terragrunt run-all apply command doesn't work at all. Instead, at the root I have to run terragrunt apply. If you don't at the root, then all sub folders get grouped together rather than in a dev/prod sub folder. Then I have to go to every sub folder and run this again. It's the only way i've gotten it to work.
QUESTION
How do I go about appending the /*
to the end of an object using for_each
? The goal is to have Terraform to go through the list of resource_arns
and add /*
to the end. However, I'm currently getting the error, "invalid template interpolation value".
If I have resources = each.value.resource_arns
, then Terraform is able to create the resource, but it would just be without /*
, which is not desired.
The desired outcome would be to have the resource created as:
...ANSWER
Answered 2022-Jan-26 at 22:24You have to iterate over resource_arns
:
QUESTION
I have a two directories: in first one I'm keeping modules (basically terraform template configurations) in the second one I'm keeping terragrunt modules implementations. In the second one there is a terragrunt hcl file with inputs
inside (one for every particular project). So far I declared variables in modules directory (in variables.tf
) but I don't like that as variables change depending on the implementation (project). So keeping all variables (for all projects) in the modules dir seems to be not the best idea.
My question is: how can I declare those variables on the terragrunt (aka implementations) level? Is a generate
function way to go?
ANSWER
Answered 2021-Dec-30 at 18:17You can use HCL files to store you variables on Terragrunt level. For instance, keep you project level variables in config.hcl
:
QUESTION
I'm running a Jenkins pipeline job using Jenkinsfile
. The primary purpose is to run terraform
, based on the choice parameter to select either plan
or apply
, like this:
ANSWER
Answered 2021-Dec-29 at 17:33You can use terraform apply -auto-approve
within your Jenkins Job.
Tip: You can add condition in Jenkins stage() when a user choose parameter plan than there will be no -auto-approve option added automatically, else the command will append -auto-approve option.
QUESTION
I'm trying to iterate over a simple list of maps. Here's a segment of what my module code looks like:
...ANSWER
Answered 2021-Dec-08 at 22:45If you are using for_each
in dynamic blocks, you can't use each
. Instead, in your case, it should be set
:
QUESTION
Is it possible for a workflow to depend on another workflow?
I currently have 2 workflows for my test branch.The first is github_action_pull_test.yml that is triggered by a pull_request.When there is a pull_request on the test branch the workflow run to terragrunt plan.The second is github_action_push_test.yml that is triggered when there is a merge to my test branch,the workflow run terragrunt apply.
The current setup has one negative effect: my github_action_push_test.yml include all the steps in the github_action_pull_test.yml. Is there a way I can have one workflow that include all the steps but only run terragrunt apply after terragrunt plan has been reviewed and merged into the test branch so i can avoid duplications
...ANSWER
Answered 2021-Dec-07 at 10:41You can make first
trigger second
:
QUESTION
I am hoping someone can help me with an issue I am having with Terraform/Terragrunt. The versions of each that I am currently using are:
- Terragrunt v0.35.9
- Terraform v1.0.11
I am using Terragrunt to deploy project related infrastructure to GCP. I have two seperate Terragrunt projects to split out variables between a test and a production instance of the same GCP solution.
When I run the commands terragrunt init
or terragrunt plan -out tf.plan
using the test .hcl file, the process completes as expected. However when I run either of these commands using the production .hcl file, I get the following error:
ANSWER
Answered 2021-Dec-02 at 01:01You seem to have a latest state snapshot that was created with Terraform v0.12 or earlier. That would mean that it would be storing provider configuration references in an older form that Terraform v1.0 and later don't support anymore.
For your immediate work I'd suggest just figuring out which Terraform version this configuration's associated state was created by and using the latest patch release of that version to do your work, so you can avoid doing any immediate upgrade work. To do that, find your current Terraform state snapshot (refer to the backend configuration to see where it's stored), which will be a JSON data structure stored somewhere configured either in the Terraform configuration or in the Terragrunt configuration.
In that JSON object there will be a top-level property called terraform_version
which will map to a string like 0.11.2
, or 0.12.3
, or similar. Take the first two elements of that version number as the Terraform major release and then refer to the list of available versions and find the newest version with the same major release number. For example, if you found 0.11.2
in your state file then at the time of writing you'd select Terraform 0.11.15, because that's the newest release in the v0.11 series.
You should then be able to use that version of Terraform to work with your current Terraform configuration and state.
Once you know which version your configuration is currently expecting and you're ready to upgrade, you can consult the Terraform v1.0 upgrade guide to see the recommended steps to get from whatever version you are currently using to a version after the v1.0.0 release, after which you can select the latest v1.*.*
moving forward because they are all subject to compatibility promises after that point.
In particular, the v1.0 upgrade guide links to the earlier guide to move from v0.12 to v0.13, which includes steps to move beyond the error message you included in your question. (That is "the Terraform 0.13 upgrade process" that the error message is referring to.)
QUESTION
I am using terragrunt to call my terraform module.I have one terragrunt.hcl for my dev and another for testing environment.I would like to be able to attach AWS Managed policy(AdministratorAccess) to my Dev account and (AmazonEC2FullAccess) to my testing account using input variable so that I can remove the policy line in my aws_iam_role_policy section
...ANSWER
Answered 2021-Nov-23 at 12:41I'm not sure to fully understand your question. You cannot attach an IAM Policy
to an account. However, you can attach it to an IAM Role
which seems to be your goal here? If yes, you can use a data source
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install terragrunt
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page