Skip to content

[bug][replication]: when destroying resources with replication configs, provider should cleanup the replication config first #81

@ericsyh

Description

@ericsyh

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

v1.0.3

Affected Resource(s)

  • pulsar_tenant
  • pulsar_namespace

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

provider "pulsar"{
    alias = "us-east"
    web_service_url = ""
    issuer_url = ""
    audience = ""
    key_file_path = ""
}

resource "pulsar_cluster" "us-west-cluster" {
  provider = pulsar.us-east
  cluster = "us-west"

  cluster_data {
    web_service_url    = "<web_service_url>"
    broker_service_url = "<broker_service_url>"
  }
}

resource "pulsar_tenant" "us-east-geo-tenant" {
  provider = pulsar.us-east
  tenant = "geo-tenant"
  allowed_clusters = [
    "us-east",
    pulsar_cluster.us-west-cluster.cluster
  ]
}

resource "pulsar_namespace" "us-east-geo-namespace" {
  provider  = pulsar.us-east
  tenant    = pulsar_tenant.us-east-geo-tenant.tenant
  namespace = "geo-namespace"

  namespace_config {
    replication_clusters = [
      "us-east",
      pulsar_cluster.us-west-cluster.cluster
    ]
  }
}

Debug Output

Panic Output

Expected Behavior

Destroy successfully.

Actual Behavior

pulsar_namespace.us-east-geo-namespace: Destroying... [id=geo-tenant/geo-namespace]
pulsar_namespace.us-west-geo-namespace: Destroying... [id=geo-tenant/geo-namespace]
╷
│ Error: ERROR_DELETE_NAMESPACE: code: 412 reason: Cannot delete the global namespace geo-tenant/geo-namespace. There are still more than one replication clusters configured.
│
│
╵
╷
│ Error: ERROR_DELETE_NAMESPACE: code: 412 reason: Cannot delete the global namespace geo-tenant/geo-namespace. There are still more than one replication clusters configured.
│
│
╵

Steps to Reproduce

  1. terraform apply to create resources
  2. terrafrom destroy to cleanup resources

Important Factoids

References

  • I believe this issue is because Pulsar requires to remove the replication configurations on tenant, namespace first then allow to delete this resource.
  • So for the terraform provider should check the replication configuration first before the destroy.

Metadata

Metadata

Assignees

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