-
Notifications
You must be signed in to change notification settings - Fork 10.3k
"terraform providers lock" does not lock providers required by tests #37841
Description
Terraform Version
Terraform v1.13.3
on darwin_arm64Terraform Configuration Files
versions.tf
terraform {
required_providers {
dns = {
source = "hashicorp/dns"
version = "~> 3.4"
}
}
}tests/versions.tf
terraform {
required_providers {
vault = {
source = "hashicorp/vault"
version = "~> 5.3"
}
}
}tests/test.tftest.hcl
run "test" {
module {
source = "./tests"
}
}Debug Output
N/A
Expected Behavior
Checksums for both hashicorp/dns (required by the root Terraform module) and hashicorp/vault (required by the tests Terraform module, which itself is required by tests/test.tftest.hcl) should be recorded in .terraform.lock.hcl, so that terraform init -lockfile=readonly can install the locked provider versions required by both terraform plan and terraform test commands
Actual Behavior
Only the checksum for hashicorp/dns is recorded in .terraform.lock.hcl, causing terraform init -lockfile=readonly to fail when it tries to add hashicorp/vault to .terraform.lock.hcl, since terraform init respects the providers required by modules in tests/test.tftest.hcl, but terraform providers lock does not
Steps to Reproduce
terraform providers lockterraform init -lockfile=readonly
Additional Context
No response
References
No response
Generative AI / LLM assisted development?
No response