New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Interpolation inside .terragrunt file #26
Comments
Agreed this may be a good feature to have to reduce duplication. However, the tricky bit is figuring out what exactly would
Having gone through this thought process, I'm honestly not convinced any of these options are inherently better than the simple, no-frills, no-magic, 100% declarative, WYSIWYG approach we have now. Yes, you have to do some copy/paste. But it's a one-time cost you do for each set of templates. Perhaps the real solution is to make even this act simpler by having Thoughts? |
I've got the same terragrunt use case as @robkinyon. Another option might be to make terragrunt capable of reading variables from a separate file (either its own, or
That would allow symlinking a 'shared' config like the one below into each directory while keeping the per-directory settings in a separate non-linked file. There'd still be the need to create that regular file for each directory, but it would make things a bit simpler. |
OK, I have a proposal. We add two new features to Terragrunt:
With the changes above, you could have the following folder structure:
Notice how there is only a single # Configure Terragrunt to use DynamoDB for locking
lock = {
backend = "dynamodb"
config {
state_file_id = "terragrunt-locks/${relative_path()}"
}
}
# Configure Terragrunt to automatically store tfstate files in S3
remote_state = {
backend = "s3"
config {
encrypt = "true"
bucket = "my-terraform-bucket"
key = "terraform-state/${relative_path()}"
region = "us-east-1"
}
} Now, let's say you want to make a change in the
Update: an alternative that's already supported today is to go into the
When you run this command, Terragrunt would:
This way, the folder layout of your state files in S3 and the names of your locks in DynamoDB will automatically match the folder layout of your Terraform templates. Of course, if you need to override it for some reason, such as when you rename a folder but want it to keep using the old state file, you could include a Thoughts? |
First, it's great we're discussing this. This solves a real issue I've encountered with multiple software teams. I generally like the idea but I have a few concerns. I'm going to think out loud here, so these thoughts might be a little messy:
Lots of ideas here, and still sorting through them myself, but right now I'm most attracted to |
As I mentioned above, you can actually run Terragrunt from the terraform folders themselves. You just need to provide a In fact, since there is really only one
This can't be an absolute path, and if it's a relative path, you have to tediously update it if you ever refactor your code and move files around.
What's the purpose of the "local" I think it's a better idea to only have local |
This sounds very good, especially when combined with I would change the As for multiple I do see a value in multiple
That said, if I don't set a Also, I would terminate the |
This is a great idea, but it makes me realize the end user may be left wondering when terragrunt stops searching for Another concern is what if there's a non-root |
I think this is solved by two actions:
I think this is a very logical extension and is almost simpler to code than the parent-child-only option. |
@josh-padnick and @robkinyon, please check out #59 and share your feedback! |
We have a bunch of different Terraform state files, each handling .tf files in different directories. There's a
.terragrunt
file in each directory that looks something like:I'd really like to be able to use a single .terragrunt file for all the directories and be able do something like:
That way, I can symlink to a common
.terragrunt
in the parent directory and be assured I'm not screwing anything up when I copy the.terragrunt
file into a new directory.The text was updated successfully, but these errors were encountered: