Ive what should be a simple json literal issue. IM curious how others handle using TF to populate vault and what im missing functionally. Clearly it works in the CLI so its a syntax/command understanding issue on my part.
any advice or expertise is appreciated, thank you.
############################# the .tf #############################
resource "vault_generic_secret" "Cert-pem" {
path = "CertStore/Cert-pem"
depends_on = ["vault_mount.CertStore-MOUNT"]
data_json = <<EOT
{
"value": "${data.template_file.Cert-pem.rendered }"
}
EOT
}
data "template_file" "cert-pem" {
template = "${file("certs/Cert-pem")}"
}
############################# the .tf #############################
############################# the Errror #############################
Error: Error running plan: 1 error(s) occurred:
* vault_generic_secret.Cert-pem: invalid character '\r' in string literal
############################# the Errror #############################
############################# the Successful CLI #############################
[ ~]$ vault write CertStore/cert-pem \ value="-----BEGIN RSA PRIVATE KEY-----
> MIIEpAIBAAKCAQEA33DbTbVLvdRyQ4gzOKgP3xmHdLJZQFkhjMR5PhrSAz1frMOD9DLOrgSWoXAz
........
> RNXoOsNzZy36GNc2SJR5yo30WLA1fT2RHTK9Ev9w0QP8pHmXTLhWipbzCYumKQn4CIUunA==
> -----END RSA PRIVATE KEY-----"
Success! Data written to: CertStore/cert-pem
############################# the Successful CLI #############################