From e4e6c33a871f78a247e29d9a0409adfce75265a2 Mon Sep 17 00:00:00 2001 From: John Houston Date: Wed, 16 Jun 2021 01:34:04 -0400 Subject: [PATCH 1/2] skip empty YAML documents --- tfk8s.go | 5 +++++ tfk8s_test.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tfk8s.go b/tfk8s.go index 589f79e..3a3afa6 100644 --- a/tfk8s.go +++ b/tfk8s.go @@ -154,6 +154,11 @@ func YAMLToTerraformResources(r io.Reader, providerAlias string, stripServerSide return "", err } + if doc.IsNull() { + // skip empty YAML docs + continue + } + formatted, err := yamlToHCL(doc, providerAlias, stripServerSide, mapOnly) if err != nil { diff --git a/tfk8s_test.go b/tfk8s_test.go index 8027ebd..5dbced8 100644 --- a/tfk8s_test.go +++ b/tfk8s_test.go @@ -49,6 +49,11 @@ metadata: data: TEST: one --- +# this empty +# document +# should be +# skipped +--- apiVersion: v1 kind: ConfigMap metadata: From ffcc73d23cf417b5f5e9df92c6841a3db8fa7097 Mon Sep 17 00:00:00 2001 From: John Houston Date: Wed, 16 Jun 2021 01:35:58 -0400 Subject: [PATCH 2/2] version bump v0.1.4 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e366945..5cd3b96 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: build docker docker-push release install test clean -VERSION := 0.1.3 +VERSION := 0.1.4 DOCKER_IMAGE_NAME := jrhouston/tfk8s build: