Skip to content

streamnative_service_account cannot be destroyed and re-created.Β #123

@erniebilling

Description

@erniebilling

Community Note

  • Please vote on this issue by adding a
    πŸ‘ reaction to the original
    issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra
    noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v1.3.9
on linux_amd64

  • provider registry.terraform.io/streamnative/streamnative v0.4.2

Your version of Terraform is out of date! The latest version
is 1.9.1. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

streamnative_service_account

Terraform Configuration Files

variable "instance_name" {
    type = string
    description = "Instance name"
    default = "sp-test-instance"
}

variable "sp_name" {
    type = string
    description = "Service principal name"
    default = "sp-test"
}

variable "organization_name" {
    type = string
    description = "Organization name"
}

terraform {
  required_providers {
    streamnative = {
      source = "streamnative/streamnative"
      version = "0.4.2"
    }
  }
}

provider "streamnative" {
}

resource "streamnative_service_account" "cluster_service_account" {
    organization = var.organization_name
    name = var.sp_name
    admin = true
}

resource "streamnative_pulsar_instance" "dev-instance" {
  organization = var.organization_name
  name = var.instance_name
  availability_mode = "zonal"
  pool_name = "shared-aws"  
  pool_namespace = "streamnative" 
}

resource "streamnative_apikey" "cluster_service_account_api_key" {
    instance_name = streamnative_pulsar_instance.dev-instance.name
    name = "${var.sp_name}-sa-apikey"
    organization = var.organization_name
    service_account_name = streamnative_service_account.cluster_service_account.name
}

data "streamnative_apikey" "cluster_service_account_api_key" {
    name = streamnative_apikey.cluster_service_account_api_key.name
    organization = var.organization_name
    private_key = streamnative_apikey.cluster_service_account_api_key.private_key
}

output "service_account_name" {
    description = "Cluster management service account name"
    value = data.streamnative_apikey.cluster_service_account_api_key.name
}

output "service_account_token" {
    description = "Cluster management service account token"
    value = data.streamnative_apikey.cluster_service_account_api_key.token
}

Debug Output

Panic Output

Expected Behavior

terraform apply, terraform destroy, terraform apply should work.

Actual Behavior

The second terraform apply fails with:

β•·
β”‚ Error: ERROR_CREATE_SERVICE_ACCOUNT: object is being deleted: serviceaccounts.cloud.streamnative.io "sp-test" already exists
β”‚ 
β”‚   with streamnative_service_account.cluster_service_account,
β”‚   on service-principal.tf line 30, in resource "streamnative_service_account" "cluster_service_account":
β”‚   30: resource "streamnative_service_account" "cluster_service_account" {

Steps to Reproduce

  1. terraform apply
  2. terraform destroy
  3. terraform apply

Important Factoids

References

  • #0000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions