bazel: add terrafrom to //:check and //:generate

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-03-17 16:20:39 +01:00
parent 2693936906
commit 8d3fe6f477
7 changed files with 221 additions and 71 deletions

View file

@ -0,0 +1,8 @@
genrule(
name = "terraform_bin",
srcs = ["terraform"],
outs = ["terraform_bin_out"],
cmd = "cp $< $@", # Copy the binary to the output directory.
executable = True,
visibility = ["//visibility:public"],
)

View file

@ -3,7 +3,9 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def ci_deps():
"""Install CI dependencies"""
_shellcheck_deps()
_terraform_deps()
def _shellcheck_deps():
http_archive(
@ -31,3 +33,37 @@ def _shellcheck_deps():
strip_prefix = "shellcheck-v0.9.0",
build_file = "//bazel/toolchains:BUILD.shellcheck.bazel",
)
def _terraform_deps():
http_archive(
name = "com_github_hashicorp_terraform_linux_amd64",
build_file = "//bazel/toolchains:BUILD.terraform.bazel",
urls = [
"https://releases.hashicorp.com/terraform/1.4.2/terraform_1.4.2_linux_amd64.zip",
],
sha256 = "9f3ca33d04f5335472829d1df7785115b60176d610ae6f1583343b0a2221a931",
)
http_archive(
name = "com_github_hashicorp_terraform_linux_arm64",
build_file = "//bazel/toolchains:BUILD.terraform.bazel",
urls = [
"https://releases.hashicorp.com/terraform/1.4.2/terraform_1.4.2_linux_arm64.zip",
],
sha256 = "39c182670c4e63e918e0a16080b1cc47bb16e158d7da96333d682d6a9cb8eb91",
)
http_archive(
name = "com_github_hashicorp_terraform_darwin_amd64",
build_file = "//bazel/toolchains:BUILD.terraform.bazel",
urls = [
"https://releases.hashicorp.com/terraform/1.4.2/terraform_1.4.2_darwin_amd64.zip",
],
sha256 = "c218a6c0ef6692b25af16995c8c7bdf6739e9638fef9235c6aced3cd84afaf66",
)
http_archive(
name = "com_github_hashicorp_terraform_darwin_arm64",
build_file = "//bazel/toolchains:BUILD.terraform.bazel",
urls = [
"https://releases.hashicorp.com/terraform/1.4.2/terraform_1.4.2_darwin_arm64.zip",
],
sha256 = "af8ff7576c8fc41496fdf97e9199b00d8d81729a6a0e821eaf4dfd08aa763540",
)