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 doesn't re-create deleted service account #70

Open
erniebilling opened this issue Nov 5, 2024 · 4 comments

Comments

@erniebilling
Copy link

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.

@erniebilling
Copy link
Author

Same result with provider streamnative/streamnative 0.6.0

@erniebilling
Copy link
Author

erniebilling commented Nov 6, 2024 via email

@ericsyh
Copy link
Member

ericsyh commented Nov 7, 2024

@erniebilling yeap, I double checked and this is a separate case and was not covered by PR 67. Will take a look how to support this case.

@freeznet
Copy link
Member

freeznet commented Nov 14, 2024

It seems the Read logic is directly throw the error when resources are missing. We could add recreation trigger logic to Read when resources been removed by external. I will working on this issue and create a PR for it.

nlu90 added a commit that referenced this issue Nov 15, 2024
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

3 participants