The output you show is correct, a quoted string is displayed and the backslash must be correctly escaped. The actual string only contains a single backslash.
That is not correct, the variable passed in the variable contains 2 backslashes instead of the one. If you escape a backslash two backslashes are passed. I did figure out a way around it with just templating the value to get it to return a single backslash.
Template file:
${domain_name}/${user_name}
data "template_file" "logon_template" {
template = file("${path.module}/logon.key")
vars = {
user_name = local.username,
domain_name = local.domain
}
}
output "username" {
value = data.template_file.logon_template.rendered
}
Ah, the little things! Thanks for the insights into using the raw switch, the provider keeps indicating bad username string so I thought it was the backslashes.