Comments (3)
Upgrading to v0.5.0 should fix your issue, as I added in the HCL parsing. Please let me know if that fix didn't solve your problem :)
from terragrunt-atlantis-config.
This is certainly an interesting bug! Thanks, @gmaghera for finding this
Why this bug happens
We currently follow this pseudocode:
files := find_all_terragrunt_files()
for file in files:
parsed := parseFile(file)
if the parsed file does not have a Terragrunt.Source value and --ignore-parent-terragrunt is on:
skip this file
else do all the dependency analysis stuff
The real life code is here: https://github.com/transcend-io/terragrunt-atlantis-config/blob/master/cmd/generate.go#L103-L112
The parseFile
in that pseudocode is actually using Terragrunt's parser, imported directly from their repo.
The error you are showing comes directly from the Terragrunt parser
Why it's hard to fix this bug
If we don't use the parser, we cannot easily tell if a file is a parent terragrunt file or not. And then we don't know to skip that top level terragrunt.hcl
file.
If we do use the Terragrunt parser, we get an error. This isn't so bad, except the error message is useless in this context. Terragrunt always parses locals
first, so even if we could detect exactly the error in your output, we still wouldn't know if the file was a parent file or not.
Workaround
As this fix may take a bit of time to create, here is a workaround: You could change the name of the top level terragrunt.hcl
file to anything else, such as parent.hcl
, and then update your child path = find_in_parent_folders()
expressions to be path = find_in_parent_folders("parent.hcl")
This works because this repo uses the FindConfigFilesInPath
directly from Terragrunt to determine which files are terraform modules: https://github.com/gruntwork-io/terragrunt/blob/24d9a82dd5c45aa0a08d56bafb95b3ffe8eb5a30/config/config.go#L237 and that function only looks for files named terragrunt.hcl
or terragrunt.hcl.json
: https://github.com/gruntwork-io/terragrunt/blob/24d9a82dd5c45aa0a08d56bafb95b3ffe8eb5a30/config/config.go#L22
At my company, we do this workaround, but not because we knew of the bug, but just because we have a few differently named parent config files we switch between based on infra environment.
Actual fix
I think the only good fix here is to determine if a terragrunt file is a parent, while not parsing it with Terragrunt's parser, which means we'll need to parse the HCL on our own. I haven't done this before, but it doesn't look too awful.
from terragrunt-atlantis-config.
Thank you David for the thoughtful analysis and the suggested workaround. They both make sense.
from terragrunt-atlantis-config.
Related Issues (20)
- Guidelines for multi-environment setup? HOT 2
- Support .terraform-version files (as tfenv) HOT 1
- example of atlantis config output HOT 2
- Is the project abandoned? HOT 14
- Is there is any command in atlantis which will be equivalent to terragrunt destroy? HOT 1
- `run_cmd` fail with options as first arg
- Grace handle of `/dev/null` when destroying modules HOT 2
- Support generating new depends_on key HOT 2
- tests fail when run in VSCode in Windows
- tristan-weil/ghaction-checksum-sign-artifact no longer exists HOT 1
- Invalid Release Checksum Format HOT 6
- Docker images are not published HOT 11
- Evaluating local relative paths
- bug: execution_order_group does not print 0 values when active HOT 4
- bug: execution_order_group does not work with a folder without *.hcl files in the file structure
- Generic artifact names in release archives
- broken release HOT 1
- execute atlantis operations using group tags on projects HOT 1
- Preserve allowed_regexp_prefixes repo level key
- README: Installation process HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terragrunt-atlantis-config.