Skip to content

Commit

Permalink
short-circuit resources not supported by tfschema (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
roni-frantchi authored May 12, 2020
1 parent 043b666 commit 61bd9d9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tfschema/tfschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import (
"github.com/env0/terratag/providers"
"github.com/hashicorp/hcl/v2/hclwrite"
"github.com/mitchellh/mapstructure"
"log"
"os/exec"
"strings"
)

func IsTaggable(dir string, resource hclwrite.Block) (bool, bool) {
Expand All @@ -19,7 +21,16 @@ func IsTaggable(dir string, resource hclwrite.Block) (bool, bool) {
command.Dir = dir
output, err := command.Output()
outputAsString := string(output)
errors.PanicOnError(err, &outputAsString)

if err != nil {
if strings.Contains(outputAsString, "Failed to find resource type") {
// short circuiting unfound resource due to: https://github.com/env0/terratag/issues/17
log.Print("Skipped ", resourceType, " as it is not YET supported")
return false, false
} else {
errors.PanicOnError(err, &outputAsString)
}
}

var schema map[string]interface{}

Expand Down

0 comments on commit 61bd9d9

Please sign in to comment.