Files
terraform-artifactapi/environments/root.hcl
T
unkinben 9351ea30a9
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/plan Pipeline was successful
fix: declare provider requirement in the artifactapi module
pre-commit runs `tofu validate`/tflint on modules/artifactapi standalone, where
no required_providers was declared, so OpenTofu inferred hashicorp/artifactapi
and failed (and tflint flagged missing required_version/version constraint).

- add modules/artifactapi/versions.tf declaring required_version and the
  artifactapi provider (source = the registry, version >= 0.1.2)
- drop the now-duplicate required_providers from root.hcl's generated backend.tf;
  keep the provider config block + backend. Declaring it in both the module and
  the generated root would be a "Duplicate required providers" error at runtime.

Also revert the earlier init lock-cleanup: the CI failure was stale provider
references in state (fixed with `tofu state replace-provider`), not the lock.
2026-07-03 23:34:19 +10:00

21 lines
467 B
HCL

generate "backend" {
path = "backend.tf"
if_exists = "overwrite"
contents = <<EOF
provider "artifactapi" {
endpoint = "https://${path_relative_to_include()}"
}
terraform {
backend "consul" {
address = "https://consul.service.consul"
path = "infra/terraform/artifactapi/${path_relative_to_include()}/state"
scheme = "https"
lock = true
ca_file = "/etc/pki/tls/certs/ca-bundle.crt"
}
required_version = ">= 1.10"
}
EOF
}