Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing existing platform_oidc_identity_mapping results in invalid resource configuration #145

Closed
nbaju1 opened this issue Oct 23, 2024 · 8 comments · Fixed by #147
Closed
Assignees
Labels
enhancement Automatically generated release notes

Comments

@nbaju1
Copy link

nbaju1 commented Oct 23, 2024

Describe the bug
I'm attempting to import an existing identity mapping to inspect the resulting syntax in the Terraform config. The imported resource in the state does not match the actual mapping in the GUI and also has values not allowed by the provider.

Identity mapping in the GUI:
Image

Resource in state after import:

{
      "mode": "managed",
      "type": "platform_oidc_identity_mapping",
      "name": "setup",
      "provider": "provider[\"registry.terraform.io/jfrog/platform\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "claims_json": "{\"roles\":[\"jfrog_user\"]}",
            "description": "OAuth used for client setup",
            "name": "setup",
            "priority": 1,
            "provider_name": "jfrog-setup",
            "token_spec": {
              "audience": "jfrt@* jfac@* jfmc@* jfmd@* jfevt@* jfxfer@* jflnk@* jfint@* jfwks@*",
              "expires_in": 60,
              "scope": "",
              "username": null
            }
          },
          "sensitive_attributes": []
        }
      ]
    }

Requirements for and issue
Provider version: 1.15.1
Terraform version: 1.9.3
Artifactory version: 7.98.2

Expected behavior
Resource imported with correct values.

@nbaju1 nbaju1 added the bug Something isn't working label Oct 23, 2024
@alexhung
Copy link
Member

@nbaju1 Which version of Artifactory are you on?

@nbaju1
Copy link
Author

nbaju1 commented Oct 29, 2024

@nbaju1 Which version of Artifactory are you on?

Sorry, forgot to add that. 7.98.2.

@alexhung
Copy link
Member

@nbaju1 Thanks! The reason I asked is that I don't see that field "Pattern" in our dev and test environments.

Which type of OIDC provider are you using? I don't think this changes the OIDC mapping screen but would be good to know.

@nbaju1
Copy link
Author

nbaju1 commented Oct 30, 2024

@alexhung The resource in question is using the Azure OIDC provider.

@alexhung
Copy link
Member

alexhung commented Oct 30, 2024

@alexhung This is what I see when configuring a OIDC Identity Mapping for Azure OIDC integration:

Image

Note it is the "User name" field, not "Pattern" here.

The REST API also (AFAIK) only support username.

@alexhung
Copy link
Member

@nbaju1 Are you setting up OIDC identity mapping with Project (vs Global)?

@nbaju1
Copy link
Author

nbaju1 commented Oct 31, 2024

@alexhung Global. If changing to Project, the below image is the identity mapping screen. Which options do you have for the "Token scope" with Global? We have "Admin", "User", "Group", "User Mapping" and "Groups Mapping". User and Groups Mapping has the "Pattern" input.

@alexhung
Copy link
Member

@nbaju1 Thanks! Now I see the "Pattern" field in the UI as well as the API response. I'll add this to our plan to add to the resource.

@alexhung alexhung added enhancement Automatically generated release notes and removed bug Something isn't working labels Oct 31, 2024
alexhung added a commit that referenced this issue Oct 31, 2024
…ty-mapping

Add patterns to OIDC identity mapping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Automatically generated release notes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants