Search code examples
urlterraform

Why Git URL path part is separated by double slash //


Why the path to the directory part in the Git URL is double slash //?

Terraform modules using a git branch as a source

git::ssh://private_server:myport/kbf/my_repository.git//ecs-cluster?ref=myBranch
git::https://private_server:myport/kbf/my_repository//ecs-cluster?ref=myBranch

Looking at GIT URLS page of the Git SCM but there is no // mentioned. Please advise where it is documented.


Solution

  • A special double-slash syntax is interpreted by Terraform to indicate that the remaining path after that point is a sub-directory within the package. For example:

    hashicorp/consul/aws//modules/consul-cluster
    git::https://example.com/network.git//modules/vpc
    https://example.com/network-module.zip//modules/vpc
    s3::https://s3-eu-west-1.amazonaws.com/examplecorp-terraform-modules/network.zip//modules/vpc
    

    See the docs.

    So this is not Git-specific, it's Terraform-specific.