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

streamnative_service_account cannot be destroyed and re-created. #123

Open
erniebilling opened this issue Jul 8, 2024 · 0 comments
Open

Comments

@erniebilling
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant