terragrunt
terragrunt copied to clipboard
WARN[] No double-slash (//) found - on remote modules without submodules
When doing a plan using a module that doesn't have submodules, terragrunt keeps throwing a warning. The double slash would address the issue if using submodules but the warning is redundant if you have a single flat module.
Example:
terragrunt run-all plan --terragrunt-working-dir "resources/platform" --terragrunt-log-level INFO
INFO[0000] Stack at resources/platform:
=> Module /<my home>/terraform/cloud-factory/resources/platform/folders/root (excluded: false, dependencies: [])
WARN[0000] No double-slash (//) found in source URL /terraform-google-modules/terraform-google-folders.git.
Relative paths in downloaded Terraform code may not work.
prefix=[/<my home>/terraform/cloud-factory/resources/platform/folders/root]
The terragrunt.hcl configuration used in this example:
terraform {
source = "git::[email protected]:terraform-google-modules/terraform-google-folders.git?ref=v3.0.0"
}
The module in question has a flat structure with no submodules: https://github.com/terraform-google-modules/terraform-google-folders. I've seen a few threads about this but nothing with a permanent solution that addresses this for simple modules like the above mentioned one.
Using:
terragrunt version v0.29.2
Terraform v0.15.3 on darwin_amd64
I am also seeing this issue.
I'm using in this way and showing the same warning
terraform {
source = "github.com/terraform-aws-modules/terraform-aws-acm?ref=v3.0.0"
}
WARN[0000] No double-slash (//) found in source URL /terraform-aws-modules/terraform-aws-acm. Relative paths in downloaded Terraform code may not work. prefix=[/Users/MY_PATH/]
It would be great if we could disable this warning deliberately via some flag / ENV variable/configuration.
Ah, that's a good point. That logic needs to handle modules in the root of a repo better. PR to fix this is very welcome!
I see the same warning
workaround for source without submodules terraform { source = "github.com/terraform-aws-modules/terraform-aws-acm//.?ref=v3.0.0" }
double-slash(//) and a period (.)
We are getting the same issue when using the tfr
source method. For instance:
terraform {
source = "tfr:///terraform-aws-modules/vpc/aws?version=3.5.0"
}
results in a:
No double-slash (//) found in source URL /terraform-aws-modules/vpc/aws. Relative paths in downloaded Terraform code may not work...
The above fix also works for tfr
sources:
terraform {
source = "tfr:///terraform-aws-modules/vpc/aws//.?version=3.5.0"
}
A more systemic solution would be appreciated though as this is a Terragrunt issue, not a module issue.
Just hit this issue. Commenting for visibility.
Getting same error for:
source = "[email protected]:terraform-aws-modules/terraform-aws-s3-bucket.git"
Fixed by adding //.
source = "[email protected]:terraform-aws-modules/terraform-aws-s3-bucket.git//."
As others have mentioned, adding a trailing '.' at the end of the path solves but would appreciate a better solve for this.
source = "git::[email protected]:terraform-aws-modules/terraform-aws-autoscaling.git//.?ref=v4.11.0"
The //. doesn't work when using the find_in_parent_folders function.
terraform {
source = find_in_parent_folders("_resources///_vpc")
}
Workaround when you use functions. See de triple slash at the end, that works for me
terraform {
#source = "${get_parent_terragrunt_dir()}/../modules/stacks/${local.stack_name}/"
source = "${get_parent_terragrunt_dir()}/../modules/stacks/${local.stack_name}///"
}
this is working for me
terraform {
source = "${find_in_parent_folders("modules/global/dns")}///"
}
The trick here is the ///
at the end
I did a little digging into this today, and it looks like this issue happens because terragrunt is using the getter.Detect
function from https://github.com/hashicorp/go-getter to parse the source strings, and if the source string is in a somewhat non-canonical format such as git::[email protected]:foo...
, getter.Detect
transforms it into git::ssh://[email protected]/foo...
. When it does this, if there are trailing //
at the end of the source string, it removes them.
So, if your source is git::github.com:terraform-aws-modules/terraform-aws-acm//?ref=v3.0.0
for example, getter.Detect
will transform it into git::ssh://[email protected]/terraform-aws-modules/terraform-aws-acm?ref=v3.0.0
. Note that it has removed the //
.
Then when this sourceUrl
is passed into the splitSourceUrl
function in the terragrunt code, it raises this warning because there is now no //
in the transformed source url even though the original source had it.
So, yet another workaround is to use the more canonical URL (git::ssh://[email protected]/terraform-aws-modules/terraform-aws-acm//?ref=v3.0.0
) to begin with, which getter.Detect
will not have to transform. In this case it leaves the //
in, and terragrunt's splitSourceUrl
function no longer throws the warning.
I'm not sure if the go-getter library could/should be patched to leave the trailing //
in, or if there's a good reason for it to remove them, but it seems like maybe it could be an issue for them to consider there.
this is working for me
terraform { source = "${find_in_parent_folders("modules/global/dns")}///" }
The trick here is the
///
at the end
That did it for me, thank you, bud
This is also an issue for /dev/null
(hack used for decommissioned modules 😅 )
terraform {
source = "/dev/null"
# switched off since not needed
}
..
level=warning msg=No double-slash (//) found in source URL /dev/null. Relative paths in downloaded Terraform code may not work...
I'm seeing this as well after following this tutorial using Terragrunt 0.50.9: https://blog.gruntwork.io/how-to-manage-multiple-environments-with-terraform-using-terragrunt-2c3e32fc60a8
That blog even uses relative module paths as an example:
Improved checking of module path in release https://github.com/gruntwork-io/terragrunt/releases/tag/v0.50.13