# Terraform: okta\_idp\_saml\_key format

**URL:** <https://devforum.okta.com/t/terraform-okta-idp-saml-key-format/14291>\
**Category:** Questions\
**Tags:** terraform\
**Created:** [May 18, 2021, 3:46pm UTC](https://devforum.okta.com/t/terraform-okta-idp-saml-key-format/14291 "2021-05-18T15:46:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwilczak](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jwilczak](https://devforum.okta.com/u/jwilczak)\
**Post date:** [May 18, 2021, 3:46pm UTC](https://devforum.okta.com/t/terraform-okta-idp-saml-key-format/14291/1 "2021-05-18T15:46:29Z")

</div>

Hi there, I’m trying to terraform script a SAML IdP and running into some issues (besides the fact that the documentation is lacking).

I cannot figure out, for the life of me, the proper format for the x5c attribute in the okta\_idp\_saml\_key script. [Terraform Documentation](https://registry.terraform.io/providers/oktadeveloper/okta/3.6.0/docs/resources/idp_saml_signing_key)

It’s supposed to be base64 format and if I upload the cert to okta, it works fine…

An example cert is like:

-----BEGIN CERTIFICATE-----  
….bunch of text…  
….bunch of text…  
….bunch of text…  
-----END CERTIFICATE-----

I tried converting it all to base64, tried making it one line with linebreaks, tried doing that and converting to base64…however, I keep getting an error:

on modules\idp\_saml\_key\main.tf line 15, in resource “okta\_idp\_saml\_key” “idp\_saml\_key”:  
15: x5c = var.cert

Inappropriate value for attribute “x5c”: set of string required.

Has anyone done this before? Any help??

---

<div class="post-metadata">

**Author:** ![jwilczak](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jwilczak](https://devforum.okta.com/u/jwilczak)\
**Post date:** [May 18, 2021, 3:56pm UTC](https://devforum.okta.com/t/terraform-okta-idp-saml-key-format/14291/2 "2021-05-18T15:56:11Z")

</div>

Nevermind, I’m super dense… I read the error message a bit better: Inappropriate value for attribute “x5c”: set of string required.

It’s because I had the input as a string instead of set(string) .  
I had to take each line of the cert and place it as an array of strings:  
["-----BEGIN CERTIFICATE-----",”text”,”text”, ["-----END CERTIFICATE-----"]

Sorry about the confusion!

---

<div class="post-metadata">

**Author:** ![jwilczak](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jwilczak](https://devforum.okta.com/u/jwilczak)\
**Post date:** [May 18, 2021, 4:03pm UTC](https://devforum.okta.com/t/terraform-okta-idp-saml-key-format/14291/3 "2021-05-18T16:03:50Z")

</div>

Nope, this didn’t work…I thought it did, but after trying to apply, it failed, mostly because it put all the array members out of order…

Still need help 😕

---

<div class="post-metadata">

**Author:** ![Lijia](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/lijia/32/2295_2.png) [@Lijia](https://devforum.okta.com/u/Lijia)\
**Post date:** [May 18, 2021, 8:58pm UTC](https://devforum.okta.com/t/terraform-okta-idp-saml-key-format/14291/4 "2021-05-18T20:58:19Z")

</div>

@jwilczak For the SAML IDP issue, could you please open a support ticket through an email to [support@okta.com](mailto:support@okta.com). One of our TSEs will help you take a look. Thanks

---

<div class="post-metadata">

**Author:** ![jwilczak](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jwilczak](https://devforum.okta.com/u/jwilczak)\
**Post date:** [May 19, 2021, 12:27pm UTC](https://devforum.okta.com/t/terraform-okta-idp-saml-key-format/14291/5 "2021-05-19T12:27:09Z")

</div>

It feels like it should be an easy answer and the forum could benefit from the answer…

What is the proper format for scripting a cert in Terraform?

```auto
resource "okta_idp_saml_key" "example" {
  x5c = ["${okta_app_saml.example.certificate}"] #What is an example of this value?
}

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [May 20, 2021, 1:01pm UTC](https://devforum.okta.com/t/terraform-okta-idp-saml-key-format/14291/7 "2021-05-20T13:01:05Z")

</div>

Closed on May 20, 2021, 1:01pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
