-
Notifications
You must be signed in to change notification settings - Fork 63
Crash when mixing integer and string values in list #231
Comments
If I do a simpler test, like using just two namespace yaml files, it works:
|
Here's the yaml file that's causing the issue: https://github.com/dak1n1/bug-repro-20210611/blob/main/consul/generated/tf-k8s-test-consul-server-svc.yaml The others are loaded successfully. |
The cause of the crash here is mixing of integer and string values for In Terraform's type system list and maps must have consistent element types. However, in the Kubernetes OpenAPI spec, The solution is to keep all instances of targetPort in the same list to the same type: either all numerical or all strings. We should add a validation step for this. |
In Terraform's type system, lists and maps must have consistent element types. However, the Kubernetes API spec defines certain fields as type IntOrString, which can lead to using more than one type in a list. Since Terraform has no equivalent type to translate this to, the solution is make each element of the List or Map the same type. Validation will fail if more than one type is used. Fixes hashicorp#231
A complete solution to this is proving to be pretty tricky. The validation has been added to another branch, but testing the proposed work-around in master, I'm seeing a new issue: I can best illustrate the behavior by giving some examples of what works and what doesn't. Here is the entire
The error seems to be from the Kubernetes API side:
|
Affected Resource(s)
kubernetes_manifest
Terraform Configuration Files
See this repo for full configuration: https://github.com/dak1n1/bug-repro-20210611
Debug Output
https://raw.githubusercontent.com/dak1n1/bug-repro-20210611/main/terraform_plan_output.txt
Panic Output
Steps to Reproduce
Expected Behavior
I thought I could load the yaml files into the kubernetes-alpha provider and have multiple manifests created.
Actual Behavior
crash
Important Factoids
References
Community Note
The text was updated successfully, but these errors were encountered: