terramate icon indicating copy to clipboard operation
terramate copied to clipboard

[FEATURE] Do not insist that root config is at root of git repo

Open lanejlanej opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe. With release 0.1.13 a check was added that the root config should be at the top level of the hosting git repo. I would rather that (at least for configurations that do not use the git integration) the root config can be at the root of the terramate directory within the repo, which may not be the top level. eg. repo_root/ repo_root/terraform-modules repo_root/some-other-stuff repo_root/terramate/terramate.tm.hcl (which contains the config block)

Describe the solution you'd like A clear and concise description of what you want to happen. Revert to previous behaviour for deployments that do not use git-integration. eg. set a config value that says, git_integration=false, and if a file with that config setting is encountered at a lower level in the repo it is used for the config.

Describe alternatives you've considered For now I have put the config block at the root of the repo, but it messes up the semantics of the directory structure.

Additional context Add any other context or screenshots about the feature request here.

lanejlanej avatar Jul 12 '22 13:07 lanejlanej

Hi @lanejlanej,

thanks for reporting this. The reason for this change was that config on other levels than root was silently ignored so far.

We can definitely support your use case. To come up with a perfect solution could you answer the following questions:

  • Are you accessing the repo_root/terraform-modules directory from within repo_root/terramate?

  • Do you want execute terramate commands outside of repo_root/terramate e.g. while being in repo_root?

We will for now revert the check as it was breaking behavior, but be aware that the config on this level is not actually used.

mariux avatar Jul 12 '22 15:07 mariux

Hi Marius,

Thanks for the quick response.

I am accessing the repo_root/terraform-modules directory from a stack below repo_root/terramate/stacks/... from a module call in a generate_hcl block: source = "${terramate.stack.path.to_root}/terraform-modules/vpc"

(BTW longer term the terraform module code under terraform-modules will be housed in separate repos in github. This is just an evaluation setup at this point in time).

I don't have any requirement to execute terramate commands outside of repo_root/terramate.

lanejlanej avatar Jul 13 '22 10:07 lanejlanej

@lanejlanej we released Terramate just issuing a warning in case the config is not on root. So the blocking aspect is fixed for now.

In Addition we will recap how we might be able to support a Terramate Project inside of a git repository living inside of a sub-folder. This would also enable multi terramate projects inside a single repository.

Thanks for your input. We added this to the roadmap now. We will get back to you once details are known.

mariux avatar Jul 20 '22 12:07 mariux

I hit this issue today so I'd also like to see support for "multi terramate projects inside a single repository" which was what I was trying to do. Thanks!

antonosmond avatar May 10 '23 12:05 antonosmond