<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z000074un3pCAAOkta Classic EngineAdministrationAnswered2024-04-16T12:47:02.000Z2021-07-23T01:04:45.000Z2021-10-28T19:12:24.000Z

JaraganI.52615 (Customer) asked a question.

Updating mappings for an App using Terraform

I couldn't find any documentation for updating mappings for an app using Terraform. I am not using any social providers.

 

My terraform code looks like this. What should target_id and source_id be

 

resource "okta_profile_mapping" "example" {

target_id = ""

source_id = "okta"

delete_when_absent = false

 

mappings {

id = "firstName"

expression = "user.firstName"

}

 

mappings {

id = "lastName"

expression = "user.lastName"

}

 

mappings {

id = "email"

expression = "user.email"

}

 

mappings {

id = "login"

expression = "user.email"

}

 

mappings {

id = "custom"

expression = "user.custom"

}

}


  • Hi @JaraganI.52615 (Customer)​ 

     

    I don't see any documentation available for a Terraform deployment, however I think it's using the Okta API for mappings: https://developer.okta.com/docs/reference/api/mappings/

     

    So the sourceID and targetid would be an ID that you should be able to retrieve via the mappings API

     

    "source": {

    "id": "otysbePhQ3yqt4cVv0g3",

    "name": "user",

    "type": "user",

    ..................................................................

    },

    "target": {

    "id": "0oa1qmn4LZQQEH0wZ0g4",

    "name": "okta_org2org",

    "type": "appuser",

    ...................

    }

     

     

    Let me know if this helps.

     

    Valentin Borcan at Okta

    Expand Post
  • xdard (xdard)

    We are using this for _some_ oauth clients and we came up with something like this ..

     

    data "okta_user_profile_mapping_source" "user" {}

     

    resource "okta_profile_mapping" "profile-mapping" {

    source_id = data.okta_user_profile_mapping_source.user.id

    target_id = okta_app_oauth.client.id

     

    however .. I have a follow up question here because it seems that the profile mapping is created but not applied (I checked and believe there is an internal API /mapping/reapply)

     

    Is there a way to trigger this via terraform? .. I mean in my opinion it should be done by the terraform provider after creating the mapping so I consider this a bug.

     

    Expand Post
This question is closed.
Loading
Updating mappings for an App using Terraform