Using bzlmod with Bazel 6 or later:
-
Add
common --enable_bzlmod
to.bazelrc
. -
Add to your
MODULE.bazel
file:
bazel_dep(name = "bazel_terraform", version = "0.1.0")
terraform = use_extension("@bazel_terraform//terraform:extensions.bzl", "terraform")
# Add the Terraform versions you'd like
terraform.toolchains(terraform_version = "1.6.6")
terraform.toolchains(terraform_version = "1.6.4", sha256_by_platform = {"linux_amd64": "my-sha256-sum"})
use_repo(terraform, "terraform_terraform_toolchains")
register_toolchains("@terraform_terraform_toolchains//:all")
Using WORKSPACE:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_terraform",
sha256 = "42dabd2a0791c80d455c21b13fb318a95bface20679e77810e12a3dbab81d758",
strip_prefix = "bazel_terraform-0.1.0",
url = "https://github.com/bazel-contrib/bazel_terraform/releases/download/v0.1.0/bazel_terraform-v0.1.0.tar.gz",
)
load("@bazel_terraform//terraform:dependencies.bzl", "bazel_terraform_dependencies")
bazel_terraform_dependencies()
load("@bazel_terraform//terraform:repositories.bzl", "terraform_register_toolchains")
terraform_register_toolchains(
name = "terraform",
terraform_version_config = {
"1.6.3": json.encode({}),
"1.0.4": json.encode({}),
"0.14.2": json.encode({}),
"0.12.31": json.encode({}),
"0.11.15": json.encode({}),
},
)
What's Changed
- wip: add testing and workspace support by @VJftw in #1
- Support OPA and declarative authentication examples by @VJftw in #2
- add tests and fix release by @VJftw in #3
- fix release prep script by @VJftw in #4
- fix release permissions by @VJftw in #5
New Contributors
Full Changelog: https://github.com/VJftw/bazel_terraform/commits/v0.1.0