Skip to content

[Bug] Developer service account unable to import itself due to invalid account_access field #296

@aevv

Description

@aevv

What are you really trying to do?

Use an API key created by a service account with role developer to import itself. Using Temporal Cloud.

Describe the bug

When importing a service account, if the service account is set to the developer role in the UI, the account_access field of temporalcloud_service_account is returned as none, which is an invalid field. Using a developer service account to import itself, it becomes impossible to import as the service account does not have permissions to change the role of itself from none to developer. As none is an invalid field for account_access, it's not possible to import the service account by setting that value.

Attempting to apply the plan gives the error:

Image

Manually adjusting the role of the service account to Global Admin correctly imports account_access as admin. Changing back to developer, results in none being imported again.

Attempting to apply the plan when going from admin to developer results in an error:

Image

Minimal Reproduction

This HCL (with variables + backend set):

terraform {
  required_providers {
    temporalcloud = {
      source  = "temporalio/temporalcloud"
      version = "~> 0.7"
    }
  }
}

provider "temporalcloud" {
  allowed_account_id = var.account_id
  api_key            = var.api_key # API key created by the service account which is being imported. sensitive key retrieved from a keyvault in reality, `var.` used for illustration
}

import {
  to = temporalcloud_service_account.service_account
  id = var.service_account_id # Existing service account ID with `developer` role, which owns the API key above
}

resource "temporalcloud_service_account" "service_account" {
  name           = var.name
  account_access = "developer"

  lifecycle {
    prevent_destroy = true
  }
}

Results in following plan output:

  # temporalcloud_service_account.service_account will be updated in-place
  # (imported from "{redacted}")
  ~ resource "temporalcloud_service_account" "service_account" {
      ~ account_access = "none" -> "developer"
        id             = "{redacted}"
        name           = "sample_name"
        state          = "active"
    }

Environment/Versions

  • OS and processor: x64 Windows, Linux
  • Temporal Version: Terraform Provider Version 0.7.0, Temporal Cloud

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions