Skip to content

Commit

Permalink
Merge pull request #2 from rootlyhq/alexmingoia/sup-359-bug-with-root…
Browse files Browse the repository at this point in the history
…lys-terraformer-on-github-project-need

Prefix w/ tf-- if resource ID starts with digit
  • Loading branch information
alexmingoia authored Mar 20, 2024
2 parents dea6af2 + d65d616 commit 3b2f1df
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions terraformutils/hcl.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,12 @@ func escapeRune(s string) string {
}

// Sanitize name for terraform style
// Prefix with tfer-- if starts with digit
func TfSanitize(name string) string {
name = unsafeChars.ReplaceAllStringFunc(name, escapeRune)
if (len(name) > 0 && name[0] >= '0' && name[0] <= '9') {
name = "tfer--" + name
}
return name
}

Expand Down

0 comments on commit 3b2f1df

Please sign in to comment.