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

Mismatch on provider type in UI and resource for OIDC integration #102

Closed
elumalaigjfrog opened this issue Jul 1, 2024 · 4 comments · Fixed by #103
Closed

Mismatch on provider type in UI and resource for OIDC integration #102

elumalaigjfrog opened this issue Jul 1, 2024 · 4 comments · Fixed by #103
Assignees
Labels
bug Something isn't working

Comments

@elumalaigjfrog
Copy link

elumalaigjfrog commented Jul 1, 2024

When importing a platform_oidc_configuration resource which was manually created in Artifactory using UI, the provider is imported as "provider_type": "Generic OpenID Connect" which is against the provider values as per the documentation.

provider_type (String) Type of OIDC provider. Can be generic or GitHub.

terraform {
  required_providers {
    platform = {
      source = "jfrog/platform"
      version = "1.8.0"
    }
  }
}

provider "platform" {
  url   = "https://arturl/artifactory"
  access_token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

resource "platform_oidc_configuration" "my-github-oidc-configuration" {
  name          = "testneww"
  description   = "My GitHub OIDC configuration"
  issuer_url    = "https://token.actions.githubusercontent.com"
}
# import % terraform import platform_oidc_configuration.my-github-oidc-configuration testneww
platform_oidc_configuration.my-github-oidc-configuration: Importing from ID "testneww"...
platform_oidc_configuration.my-github-oidc-configuration: Import prepared!
terraform {
  Prepared platform_oidc_configuration for import
platform_oidc_configuration.my-github-oidc-configuration: Refreshing state... [name=testneww]

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
import % cat terraform.tfstate
{
  "version": 4,
  "terraform_version": "1.9.0",
  "serial": 1,
  "lineage": "be705437-e831-3ffe-6d5e-b9f36cad9802",
  "outputs": {},
  "resources": [
    {
      "mode": "managed",
      "type": "platform_oidc_configuration",
      "name": "my-github-oidc-configuration",
      "provider": "provider[\"registry.terraform.io/jfrog/platform\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "audience": "test-github",
            "description": "test",
            "issuer_url": "https://token.actions.githubusercontent.com",
            "name": "testneww",
            "provider_type": "Generic OpenID Connect"
          },
          "sensitive_attributes": []
        }
      ]
    }
  ],
  "check_results": null
}

Artifactory Version: "version": "7.88.0",

Terraform version : 1.90

Terraform provider version: version = "1.8.0"

Expected behavior

The imported provided type should be generic or github

@elumalaigjfrog elumalaigjfrog added the bug Something isn't working label Jul 1, 2024
@alexhung
Copy link
Member

alexhung commented Jul 1, 2024

@elumalaigjfrog Thanks for the report. This is curious as provider_type is a required attribute and your resource does not have it. And yet, there is no error in the import process.

@jgrumboe
Copy link

jgrumboe commented Jul 1, 2024

Hi @alexhung
@elumalaigjfrog opened that issue because of my support case. I'd leave the non-erroring Import aside for the moment (isn't that working as designed by TF Import process?).
The more imported thing is that the UI sets a provider_type of "Generic OpenID Connect", although valid values are only "generic" or "Github".
This leads to an change in the next apply and later to an inconsistency with the UI. The UI shows then the value "generic" as selected in the drop-down.
BR, Jo

@alexhung
Copy link
Member

alexhung commented Jul 1, 2024

@jgrumboe Yes the provider_type should only be generic or GitHub. I'll investigate both issues.

@alexhung
Copy link
Member

alexhung commented Jul 3, 2024

@jgrumboe Looks like Terraform doesn't error out for import when the configuration is missing required attribute. I wonder if this is a bug or intentional.

alexhung added a commit that referenced this issue Jul 3, 2024
…idc-config

Fix mismatch provider type in OIDC config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants