Git module revision not specified

Specify a reviewed Git module revision and apply changes deliberately.

Description

A Terraform git::https://... module source without ?ref= uses the remote repository’s default branch. A fresh install or module update can fetch different code after the branch changes.

Potential impact

An unreviewed module change can affect infrastructure or make a failed deployment harder to trace.

Remediation

Set ?ref= to a reviewed revision. For reproducible installs, use the full commit hash. Review and test a module upgrade before applying it.

Examples

Replace example.com with your module repository.

Before

hcl
module "network" {
  source = "git::https://example.com/terraform-modules/network.git"
}

After

hcl
module "network" {
  source = "git::https://example.com/terraform-modules/network.git?ref=v1.4.2"
}

The example selects the v1.4.2 tag. Like a branch, a tag can be moved to another commit.

References