mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-29 10:21:01 -06:00
096010600d
* terraform: use hcl.MergeBodies instead of configs.MergeBodies for provider configuration Previously, Terraform would return an error if the user supplied provider configuration via interactive input iff the configuration provided on the command line was missing any required attributes - even if those attributes were already set in config. That error came from configs.MergeBody, which was designed for overriding valid configuration. It expects that the first ("base") body has all required attributes. However in the case of interactive input for provider configuration, it is perfectly valid if either or both bodies are missing required attributes, as long as the final body has all required attributes. hcl.MergeBodies works very similarly to configs.MergeBodies, with a key difference being that it only checks that all required attributes are present after the two bodies are merged. I've updated the existing test to use interactive input vars and a schema with all required attributes. This test failed before switching from configs.MergeBodies to hcl.MergeBodies. * add a command package test that shows that we can still have providers with dynamic configuration + required + interactive input merging This test failed when buildProviderConfig still used configs.MergeBodies instead of hcl.MergeBodies
20 lines
322 B
HCL
20 lines
322 B
HCL
variable "users" {
|
|
default = {
|
|
one = "onepw"
|
|
two = "twopw"
|
|
}
|
|
}
|
|
|
|
provider "test" {
|
|
url = "example.com"
|
|
|
|
dynamic "auth" {
|
|
for_each = var.users
|
|
content {
|
|
user = auth.key
|
|
password = auth.value
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "test_instance" "test" {} |