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

alicloud_amqp_binding state conflicts when creating many bindings #7078

Open
wopol opened this issue Mar 19, 2024 · 1 comment
Open

alicloud_amqp_binding state conflicts when creating many bindings #7078

wopol opened this issue Mar 19, 2024 · 1 comment

Comments

@wopol
Copy link

wopol commented Mar 19, 2024

When we try to create many bindings at once, conflicts may occur because when building resource IDs InstanceId, VirtualHost, SourceExchange and DestinationName are considered.

When new binding is created and we read data from the API DestinationName is missing when looking for the right binding. It may happen that when we have many bindings for the same Exchange, the wrong state will be saved.

To reproduce this issue, you can consider the following example:

bindings = {
{
      key           = "execution-v1"
      queue_name    = "worker-execution"
      exchange_name = "internal-direct"
    },
    {
      key           = "kyc-v1"
      queue_name    = "worker-kyc"
      exchange_name = "internal-direct"
    },
    {
      key           = "user-v1"
      queue_name    = "worker-user"
      exchange_name = "internal-direct"
    },
}
.....
resource "alicloud_amqp_binding" "bindings" {
  for_each          = { for s in var.bindings : "${s.queue_name}_${s.key}" => s }
  binding_key       = each.value.key
  binding_type      = "QUEUE"
  destination_name  = each.value.queue_name
  instance_id       = var.instance_id != "" ? var.instance_id : alicloud_amqp_instance.default[0].id 
  source_exchange   = each.value.exchange_name
  virtual_host_name = alicloud_amqp_virtual_host.host.virtual_host_name

  depends_on = [alicloud_amqp_queue.queue, alicloud_amqp_exchange.exchanges]
}

PR: #7077

@wopol
Copy link
Author

wopol commented May 6, 2024

Could someone take a look?

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