In this blog post under the section Promote immutable, versioned Terraform modules across environments he describes how Terragrunt allows you to use a separate git repo as the root module. I like that feature and want Pretf to support something similar.
How Terragrunt does it:
Specify source like github.com:foo/infrastructure-modules.git//app?ref=v0.0.1
Specify inputs (variable values)
When you run terragrunt apply, Terragrunt will download your app module into a temporary folder, run terraform apply in that folder, passing the module the input variables you specified in the inputs = {...} block
What I like about it:
You can have dev, staging and production each pointing to different version tags. This avoids situations like when you have applied a change to dev, are now testing it, but are not ready to apply it to staging or production. While this is happening, you avoid running Terraform against staging and production because the changes haven't been fully tested in dev yet. The code doesn't match the desired state of the infrastructure.
What I don't like about it:
It runs Terraform in a temporary directory.
Any files created by Terraform in that temporary directory will be lost, unless Pretf tracks files in that directory and does something with new files after Terraform finishes. Jinjaform uses a temporary directory and it caused problems. See https://github.com/claranet/jinjaform/issues/26 and https://github.com/claranet/jinjaform/issues/19. I don't know how Terragrunt deals with this, if at all.
This causes problems when working with relative paths because it uses the temporary directory as the working directory. To be fair, this is also an issue when using mirror_files() in Pretf, but it is slightly better as things must be relative to where you run pretf/terraform rather than a less obvious temporary directory.
In this blog post under the section
Promote immutable, versioned Terraform modules across environments
he describes how Terragrunt allows you to use a separate git repo as the root module. I like that feature and want Pretf to support something similar.How Terragrunt does it:
github.com:foo/infrastructure-modules.git//app?ref=v0.0.1
terragrunt apply
, Terragrunt will download your app module into a temporary folder, runterraform apply
in that folder, passing the module the input variables you specified in theinputs = {...}
blockWhat I like about it:
What I don't like about it:
mirror_files()
in Pretf, but it is slightly better as things must be relative to where you runpretf/terraform
rather than a less obvious temporary directory.