terraform-provider-utils
terraform-provider-utils copied to clipboard
utils_deep_merge_* expose the object
Describe the Feature
After mergin the files you need to convert to an object the string. If you are chaining the merge a double encode is needed
Use Case
data "utils_deep_merge_json" "example" {
for_each = local.some_array
input = [for s in each.value: jsonencode(s)]
}
resource "kubectl_manifest" "example" {
for_each = data.utils_deep_merge_json.example
yaml_body = templatefile(**jsondecode(each.value.output).template**", merge(
**jsondecode(each.value.output).some_object**,
{
namespace = var.ns
},
))
}
Describe Ideal Solution
Expose the merged string as an object
@sergiomcalzada thanks for mentioning this. Unfortunately, the Terraform Plugin framework we are using does not allow outputs of complex types (only primitive). Terraform has a newer framework which I think allows this, but we have not tested it yet.
Any update on this? Maybe a planned date to test?
@sergiomcalzada currently we don't have plans to switch to a new TF plugin framework for the provider - we have not tested it, it's relatively new, and will need time to switch the provider to use it, implement and test. We've discussed that, but no ETA on the implementation.
We do convert the objects returned from the provider to strings as well, then in terraform we convert them back to objects.