You can use terraform replace() function to replace a substring from a string in terraform. replace() searches a given string for another given substring, and replaces each occurrence with a given replacement string.
Syntax: replace(string, substring, replacement)
Open terraform console
1 2 |
## Open terraform console terraform console |
Replace a substring from a string in terraform
1 2 3 4 5 6 7 |
## Replace a substring from a string replace("Hello from debjeet","debjeet","cloudaffaire") ## returns "Hello from cloudaffaire" ## replace also support regx replace("Hello world", "/w.*d/", "everybody") ## returns "Hello everybody" |