I have a regex to replace any non word characters, underscores or spaces in one of my variables to sanitise the name to pass it to Route53.
It is replacing non alphanumeric and underscores but it is getting stuck on spaces.
I know the regex is \s
for whitespaces but it seems to be ignoring it when the Terraform plan runs but if I run it through a regex checker it works fine.
identifier = "qa-${lower(replace(var.dns_name,"/\\W|_|\\s/","-"))}"