8000 Option to remove fields with null value · Issue #61 · jrhouston/tfk8s · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Option to remove fields with null value #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
arthurk opened this issue Oct 18, 2023 · 0 comments
Open

Option to remove fields with null value #61

arthurk opened this issue Oct 18, 2023 · 0 comments

Comments

@arthurk
Copy link
arthurk commented Oct 18, 2023

I'm trying to install Istio. I've generated the YAML manifests and converted them to HCL using:

$ istioctl manifest generate > istio.yaml
$ tfk8s -f istio.yaml > istio.tf

Applying with terraform is failing:

Error: API response status: Failure

  with kubernetes_manifest.deployment_istio_system_istio_ingressgateway,
  on istio.tf line 14211, in resource "kubernetes_manifest" "deployment_istio_system_istio_ingressgateway":
14211: resource "kubernetes_manifest" "deployment_istio_system_istio_ingressgateway" {

Deployment.apps "istio-ingressgateway" is invalid:
spec.template.spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms: Required value: must
have at least one node selector term

The problem is with the conversion of null values. The YAML includes:

affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
    preferredDuringSchedulingIgnoredDuringExecution:

and was converted to:

"affinity" = {
  "nodeAffinity" = {
    "preferredDuringSchedulingIgnoredDuringExecution" = null
    "requiredDuringSchedulingIgnoredDuringExecution" = null
  }
}

After removing the null fields in the YAML or HCL file, the apply was successful.

Is it possible to implement an option in tfk8s that would automatically strip out YAML fields that have no value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0