Terraform ATLAS_INVALID_X509_NAME when using customer x509 provided certificate

When following the mongo terraform x509 guide to create a CUSTOMER managed certificate Terraform Registry I am receiving an error
“│ https://cloud.mongodb.com/api/atlas/v2/groups/65f21ff10d64dd4038fc5d89/databaseUsers POST: HTTP 400 Bad Request (Error code: “ATLAS_INVALID_X509_NAME”) Detail: The distinguished name
│ specified in the username field, myUsername, is not valid according to RFC 2253. Reason: Bad Request. Params: [myUsername]
╵”

The example doesn’t seem to be working or correct. Can the community provide a valid working example configuration for these resources?

1 Like

You need to have CN, C, O, OU in username field.
e.g.

resource “mongodbatlas_database_user” “test” {
username = “CN=xxxx.domain.com
project_id = mongodbatlas_project.test.id
auth_database_name = “$external”
x509_type = “CUSTOMER”
}

Hey, I’m having the same issue as well. Did you happen to find a fix for this?