okta / terraform-provider-okta

A Terraform provider to manage Okta resources, enabling infrastructure-as-code provisioning and management of users, groups, applications, and other Okta objects.
https://registry.terraform.io/providers/okta/okta
Mozilla Public License 2.0
258 stars 208 forks source link

okta_domain_certificate doesn't update the certificate #1826

Open techish-io opened 11 months ago

techish-io commented 11 months ago

I'm configuring custom domain cert using okta_domain_certificate

When I update cert and re run terraform - it fails for the first time with following error. Re run doesn't fail but it doesn't update the certificate in okta either

│ Error: failed to update domain's certificate: the API returned an error: Api validation failed: certificate. Causes: errorSummary: certificate: Invalid certificate format. The format must be a valid PEM encoded RSA certificate, errorSummary: privateKey: Invalid private key format. The format must be a valid PEM encoded RSA private key │ │ with okta_domain_certificate.custom_domain_certificate, │ on custom_domain.tf line 12, in resource "okta_domain_certificate" "custom_domain_certificate": │ 12: resource "okta_domain_certificate" "custom_domain_certificate" {

dec5e commented 3 months ago

I see a similar problem. When I try to update existing certificate with a new one - terraform fails with the same API error:

okta_domain_certificate.this: Modifying... [id=A1b2C3d4E5f6G7h8]
╷
│ Error: failed to update domain's certificate: the API returned an error: Api validation failed: certificate. Causes: errorSummary: certificate: Invalid certificate format. The format must be a valid PEM encoded RSA certificate
│
│   with okta_domain_certificate.this,
│   on main.tf line 19, in resource "okta_domain_certificate" "this":
│   19: resource "okta_domain_certificate" "this" {
╵

The certificate stays not updated, but next terraform plan shows no diff.

The same certificate files are accepted by Okta UI without any problem. The certificate was obtained from DigiCert.