You can use terraform trim() function to remove a specified set of characters from the start and end of the given string.
Syntax: trim(string, str_character_set)
Open terraform console
1 2 |
## Open terraform console terraform console |
Remove a specified set of characters from the start and end of the given string in terraform
1 2 3 4 5 6 7 |
## remove from start trim("debjeet", "deb") ## returns "jeet" trimprefix("debjeet", "deb") ## returns "jeet" ## remove from end trim("debjeet", "jeet") ## returns "deb" trimsuffix("debjeet", "jeet") ## returns "jeet" |