streamnative_service_account cannot be destroyed and re-created.
erniebilling opened this issue ยท 0 comments
erniebilling commented
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
terraform apply
terraform destroy
terraform apply
Important Factoids
References
- #0000