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
255 stars 207 forks source link

Add support cases to `okta_resource_set` #2006

Open steveAG opened 4 months ago

steveAG commented 4 months ago

Community Note

Description

This one is blocked by an API limitation, the recent changes to support access require a resource set to be created that grants an admin with the okta.support.cases.manage permission access to create and manage support cases, as documented here.

This can be done in the UI, and a custom role that grants the permission can be managed with the provider, but the resource set cannot be managed with the API, or by extension the provider.

New or Affected Resource(s)

Potential Terraform Configuration

resource "okta_resource_set" "owned_support_cases" {
  label       = "Support - Owned Support Cases"
  description = "All Okta support cases owned by this user"
  resources = [<Whatever the resource identifier looks like>]
}

Current API response for a resource set that includes cases:

{
    "id": "<ID>",
    "label": "Support - Owned Support Cases",
    "description": "All Okta support cases owned by this user",
    "created": "2024-06-11T18:46:19.000Z",
    "lastUpdated": "2024-06-11T18:46:19.000Z",
    "_links": {
        "bindings": {
            "href": "<Self Link>/bindings"
        },
        "self": {
            "href": "<Self Link>"
        },
        "resources": {
            "href": "<Self Link>/resources"
        }
    }
}

References

exitcode0 commented 4 months ago

Something like this should work for you you might still run into this other reported bug https://github.com/okta/terraform-provider-okta/issues/1991

data "okta_org_metadata" "_" {}
locals {
  org_uri        = data.okta_org_metadata._.domains["organization"]
  org_url        = replace(local.org_uri, "https://", "")
  orn_prefix       = "orn:${local.org_url_1}"
  okta_instance_id = data.okta_org_metadata._.id
}
resource "okta_resource_set" "support_cases" {
  label       = "Support Cases"
  description = "Support Cases"
  resources = [
    "${local.orn_prefix}:support:${local.okta_instance_id}:cases"
  ]
}
duytiennguyen-okta commented 4 months ago

OKTA internal reference https://oktainc.atlassian.net/browse/OKTA-740253