terragrunt icon indicating copy to clipboard operation
terragrunt copied to clipboard

WARN[] No double-slash (//) found - on remote modules without submodules

Open nkaravias opened this issue 3 years ago • 12 comments

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

nkaravias avatar May 14 '21 20:05 nkaravias

I am also seeing this issue.

jevon71-work avatar May 18 '21 11:05 jevon71-work

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/] 

danielcrisap avatar May 20 '21 14:05 danielcrisap

It would be great if we could disable this warning deliberately via some flag / ENV variable/configuration.

k911 avatar May 20 '21 21:05 k911

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!

brikis98 avatar May 24 '21 13:05 brikis98

I see the same warning

sebastianmacarescu avatar Jun 09 '21 14:06 sebastianmacarescu

workaround for source without submodules terraform { source = "github.com/terraform-aws-modules/terraform-aws-acm//.?ref=v3.0.0" }

double-slash(//) and a period (.)

j3ffrw avatar Jun 16 '21 11:06 j3ffrw

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.

Frituurpanda avatar Sep 24 '21 09:09 Frituurpanda

Just hit this issue. Commenting for visibility.

NesManrique avatar Dec 01 '21 22:12 NesManrique

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//."

adv4000 avatar Jan 27 '22 21:01 adv4000

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"

adamwshero avatar Feb 02 '22 17:02 adamwshero

The //. doesn't work when using the find_in_parent_folders function.

terraform {
  source = find_in_parent_folders("_resources///_vpc")
}

jaydeland avatar Jul 05 '22 16:07 jaydeland

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}///"
}

josefloressv avatar Jul 31 '22 18:07 josefloressv

this is working for me

terraform {
  source = "${find_in_parent_folders("modules/global/dns")}///"
}

The trick here is the /// at the end

OriBenHur-akeyless avatar Nov 07 '22 13:11 OriBenHur-akeyless

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.

drueck avatar Apr 08 '23 00:04 drueck

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

gotheguy avatar Apr 27 '23 17:04 gotheguy

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...

stv-io avatar Jun 16 '23 14:06 stv-io

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:

image

jcarlson avatar Aug 31 '23 18:08 jcarlson

Improved checking of module path in release https://github.com/gruntwork-io/terragrunt/releases/tag/v0.50.13

denis256 avatar Sep 05 '23 19:09 denis256