terraform_module

Rules

terraform_module

load("@rules_terraform//terraform:terraform_module.bzl", "terraform_module")

terraform_module(name, deps, srcs, data, lock, main, module_sources)

Defines a Terraform module that can be used as a dependency in other Terraform targets.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
depsOther terraform_module, terraform_provider, terraform_provider_group, terraform_external_module, or terraform_module_group targets that this module depends on.List of labelsoptional[]
srcsTerraform source files (.tf) that make up this module.List of labelsoptional[]
dataAdditional files or targets that should be available at runtime.List of labelsoptional[]
lockAn optional .terraform.lock.hcl file.LabeloptionalNone
mainAn explicit file to use for the entrypoint of the module. If unspecified, main.tf or the first .tf file will be used.LabeloptionalNone
module_sourcesMapping of Terraform module source paths to Bazel target labels. Use this to map local module "foo" { source = "./modules/vpc" } references to Bazel targets from other packages or external bzlmod dependencies. Keys are the Terraform source paths, values are Bazel labels providing TerraformInfo. The init tool will symlink these at the expected paths.Dictionary: String -> Stringoptional{}