-
Notifications
You must be signed in to change notification settings - Fork 1
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
Remote(s) data source within a TF module #314
Comments
Hi, can you try to use https://developer.hashicorp.com/terraform/language/functions/abspath ? The provider kinda works like the CLI (but uses a different git implementation), however it needs a directory to work from and the name of the remote (origin in your case). So something like this might work: data "git_remote" "remote" {
directory = abspath(path.root)
name = "origin"
} |
Dang, I was really hoping it was that easy 😭 🤣 After poking at it, it appears that it doesn't really matter whether the in my case
And I have a feeling this is more related to how |
Ok yeah I see. One potential solution right now might be to expose an input variable in your In order to get rid of the variable altogether, this provider would have to mirror the behavior of the git cli and check parent folders when opening repositories. This should be doable without a change in go-git and I think that it would be a nice addition to this provider. I'll take a deeper look on the weekend! |
Oof moving sucks, good luck! I'll poke a bit more but let me know if/when you figure anything out! |
I don't think there is a good way to do this automatically from just within the TF hcl. I did have a thought on implementation, I feel like it shouldn't always do the recursive upwards search. Maybe only if the I was trying to avoid any obvious vulnerabilities lol |
fixes #314 Signed-off-by: Sebastian Hoß <[email protected]>
Ok I think I found something nice - go-git already has a |
Hey, I am working on a TF module that will be used within other projects.
I want to use the remote(s) datasource as a way to get the URL of the project that is calling the module.
The other projects have various locations that their terrafom lives at so I can't just hardcode a
../
solution.with
directory
aspath.root
it fails reportingCould not open git repository [.] because of: repository does not exist
Do you have any ideas? I was hoping it would work how the git CLI does when calling
git config --get remote.origin.url
[my_module] = {
metio/git
}
[my_project] = {
my_module
}
The text was updated successfully, but these errors were encountered: