Skip to content

Commit

Permalink
FIX replace all non-alphanumeric chars with _ when generating the res…
Browse files Browse the repository at this point in the history
…ource name
  • Loading branch information
jrhouston committed Feb 27, 2021
1 parent c31542d commit 1428768
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: build release install test clean

VERSION := 0.1.0
VERSION := 0.1.1

build:
go build -ldflags "-X main.toolVersion=${VERSION}"
Expand Down
2 changes: 1 addition & 1 deletion tfk8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func toHCL(doc map[interface{}]interface{}, providerAlias string, stripServerSid
var name, resourceName string
if kind != "List" {
name = formattable["metadata"].(map[string]interface{})["name"].(string)
re := regexp.MustCompile("[.-]")
re := regexp.MustCompile(`\W`)
name = strings.ToLower(re.ReplaceAllString(name, "_"))
resourceName = strings.ToLower(kind) + "_" + name
} else if !mapOnly {
Expand Down

0 comments on commit 1428768

Please sign in to comment.