Skip to content

Commit

Permalink
Merge pull request #21 from jrhouston/ignore-empty
Browse files Browse the repository at this point in the history
Ignore empty YAML documents
  • Loading branch information
jrhouston authored Jun 16, 2021
2 parents 0a3b602 + ffcc73d commit 9cb5bb2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
5 changes: 5 additions & 0 deletions tfk8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions tfk8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ metadata:
data:
TEST: one
---
# this empty
# document
# should be
# skipped
---
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down

0 comments on commit 9cb5bb2

Please sign in to comment.