terragrunt icon indicating copy to clipboard operation
terragrunt copied to clipboard

Do not warn about double slash in URL for modules at root of registry module

Open archenroot opened this issue 2 years ago • 3 comments

Its bit pitty as terragrunt still complains about this: WARN[0000] No double-slash (//) found in source URL /terraform-google-modules/terraform-google-cloud-storage.git. Relative paths in downloaded Terraform code may not work.

But my definition of the module is as following:

## ---------------------------------------------------------------------------------------------------------------------
## COMMON TERRAGRUNT CONFIGURATION
## This is the common component configuration for mysql. The common variables for each environment to
## deploy mysql are defined here. This configuration will be merged into the environment configuration
## via an include block.
## ---------------------------------------------------------------------------------------------------------------------
#
## Terragrunt will copy the Terraform configurations specified by the source parameter, along with any files in the
## working directory, into a temporary folder, and execute your Terraform commands in that folder. If any environment
## needs to deploy a different module version, it should redefine this block with a different ref to override the
## deployed version.
terraform {
  source = "${local.source_source_url}?ref=v2.2.0"
}
#
## ---------------------------------------------------------------------------------------------------------------------
## Locals are named constants that are reusable within the configuration.
## ---------------------------------------------------------------------------------------------------------------------
locals {
  # Automatically load environment-level variables
  environment_vars = read_terragrunt_config(find_in_parent_folders("env.hcl"))

  # Extract out common variables for reuse
  env = local.environment_vars.locals.environment

  # Expose the base source URL so different versions of the module can be deployed in different environments. This will
  # be used to construct the terraform block in the child terragrunt configurations.

  source_source_url  = "git::[email protected]:terraform-google-modules/terraform-google-cloud-storage.git"
#  version = "2.2.0"

}
#
#
## ---------------------------------------------------------------------------------------------------------------------
## MODULE PARAMETERS
## These are the variables we have to pass in to use the module. This defines the parameters that are common across all
## environments.
## ---------------------------------------------------------------------------------------------------------------------
inputs = {
  project_id = "auto-accountant"
  force_destroy = {
    "documents" = true
  }
  names = ["documents"]
  #  location   = "eu-central1"
  prefix = "prokyon-systems-auto-accountant"
  set_admin_roles = true
  admins = ["user:[email protected]","user:[email protected]","user:[email protected]"]
  versioning = {
    first = true
  }

  #  bucket_admins = {
  #    second = "user:[email protected],[email protected]"
  #  }
  # TODO: To avoid storing your DB password in the code, set it as the environment variable TF_VAR_master_password
}

archenroot avatar Oct 16 '21 07:10 archenroot

Is this just an annoying warning or is it really creating a problem. This also should reflect the scope of the issue: should the warning simply be reduced or is some further mitigation needed?

Btw. this warning also occurs when using a source like this:

terraform {
  source = "[email protected]:organization/terraform-module.git//?ref=1.0.0"
}

(Notice the double slashes that are in the source URL)

kappmeier avatar Jan 27 '22 14:01 kappmeier

Interestingly these two source uri constructions do not issue warnings. The post-// current directory . apparently satisfies terragrunt's remote vs path logic though it is worth noting that omitting this . also works albeit noisily:

terraform {
  source = ".//."
}
terraform {
  source = "git::[email protected]:terraform-google-modules/terraform-google-project-factory.git//.?ref=v11.3.1"
}

haggishunk avatar Mar 01 '22 04:03 haggishunk

Possible dupe of #1675 which has one solution here (use //.) - https://github.com/gruntwork-io/terragrunt/issues/1675#issuecomment-862298365

tedmiston avatar Jun 01 '22 21:06 tedmiston

Fix released in https://github.com/gruntwork-io/terragrunt/releases/tag/v0.50.13

denis256 avatar Sep 22 '23 18:09 denis256