Skip to content

streamnative_service_account doesn't re-create deleted service account #70

@erniebilling

Description

@erniebilling

streamnative_service_account should be able to re-recreate a service account if someone accidentally deletes it.

Demo terraform:

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

provider "streamnative" {
}

variable "organization_name" {
    type = string
    description = "The name of the organization"
}

variable account_name {
    type = string
    description = "The name of the account to creaate"
    default = "test-account"
}

resource "streamnative_service_account" "service_account" {
  name         = var.account_name
  organization = var.organization_name
  admin        = false
}

Steps:

  1. plan and apply given terraform
  2. use stream native console to delete service account "test-account"
  3. plan given terraform

Gets error

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Error: ERROR_READ_SERVICE_ACCOUNT: serviceaccounts.cloud.streamnative.io "test-account" not found
│ 
│   with streamnative_service_account.service_account,
│   on main.tf line 24, in resource "streamnative_service_account" "service_account":
│   24: resource "streamnative_service_account" "service_account" {

Should detect missing service account and re-create it.

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