Giter VIP home page Giter VIP logo

Comments (7)

antonbabenko avatar antonbabenko commented on June 18, 2024 1

Hi there!

You need to start debugging from an internal directory and try to get it to work first:

cd terragrunt/staging/eu-central-1/vpc
terragrunt init
terragrunt apply

Then you can go one level up and try to run terragrunt apply-all.

I don't think I have simple+working Terragrunt code in the open-source where common.tfvars is used but maybe you can see how I write it in other places, too:
https://github.com/antonbabenko/modules.tf-demo
https://github.com/terraform-aws-modules/meta

In general, the questions related to the terragrunt are better to ask on the official repository as there are more users who may help you.

from terragrunt-reference-architecture.

antonbabenko avatar antonbabenko commented on June 18, 2024 1

Good that it works!

Yes, yamldecode is an option if you want to deal with YAML or have a lot of variables.

I usually prefer to deal with hcl files using read_terragrunt_config() as I have here - https://github.com/terraform-aws-modules/meta/blob/master/github/repositories/terraform-aws-modules/terraform-aws-appsync/terragrunt.hcl#L10

from terragrunt-reference-architecture.

sheldonhull avatar sheldonhull commented on June 18, 2024 1

That worked great and was much more intuitive as well. Thanks again as that helped unblocked me!

from terragrunt-reference-architecture.

sheldonhull avatar sheldonhull commented on June 18, 2024

For future reference I realized I misread the commands.

I needed terragrunt run-all plan for this to work correctly. Now my output is correct. I didn't realize I was nesting 2 layers of subcommands.

The other bit someone in sweetops slack community mentioned was deprecation of using tfvars.
Instead they said to use:

inputs = merge(
  # Configure Terragrunt to use common vars encoded as yaml to help you keep often-repeated variables (e.g., account ID)
  # DRY. We use yamldecode to merge the maps into the inputs, as opposed to using varfiles due to a restriction in
  # Terraform >=0.12 that all vars must be defined as variable blocks in modules. Terragrunt inputs are not affected by
  # this restriction.
  yamldecode(
    file("${find_in_parent_folders("region.yaml", "empty.yaml")}"),
  ),
  yamldecode(
    file("${find_in_parent_folders("env.yaml", "empty.yaml")}"),
  ),

due to the changes in the behavior that block the tfvars from being pulled in correctly, while yaml works fine in loading into TF inputs.

I'm still having a problem with it loading a parent file from a child, but will work from your example and see if I can get this to work then.

from terragrunt-reference-architecture.

sheldonhull avatar sheldonhull commented on June 18, 2024

It worked this time from parent directory! Woot Woot. 🎉

Thanks again for the help.

from terragrunt-reference-architecture.

sheldonhull avatar sheldonhull commented on June 18, 2024

Much better. Prefer to keep it terraform focused and not yaml. Will give that a try

from terragrunt-reference-architecture.

antonbabenko avatar antonbabenko commented on June 18, 2024

You are welcome.

Maybe I should have one more episode about Terragrunt during Your Weekly Dose of Terraform. Who knows :)

from terragrunt-reference-architecture.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.