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

Tracking the state of dependent resources #34

Open
0UserName opened this issue Apr 20, 2022 · 1 comment
Open

Tracking the state of dependent resources #34

0UserName opened this issue Apr 20, 2022 · 1 comment

Comments

@0UserName
Copy link

Terraform Version

Terraform v1.1.7 on windows_amd64.

rabbitmq = {

  source  = "cyrilgdn/rabbitmq"
  version = "1.6.0"
}

Affected Resource(s)

The problem is relevant for any resource that can be dependent on another resource, but reproduced for rabbitmq_binding.

Terraform Configuration Files

Not required.

Debug Output

N/A.

Panic Output

N/A.

Expected Behavior

The provider must track the state of dependent resources, i.e. recreating the queue should lead to recreating the binding between the queue and the exchange.

Actual Behavior

  # module.bus_service.module.rabbitmq_queue["queue"].rabbitmq_queue.queue must be replaced
-/+ resource "rabbitmq_queue" "queue" {
      ~ id    = "queue_name@/" -> (known after apply)
        name  = "queue_name"
        # (1 unchanged attribute hidden)

      ~ settings {
          - arguments      = {} -> null
          ~ arguments_json = jsonencode(
              ~ {
                  ~ x-queue-type             = "quorum" -> "classic"
                  - x-single-active-consumer = true -> null
                } # forces replacement
            )
            # (2 unchanged attributes hidden)
        }
    }

Terraform state reflects only the change in the queue type, the queue is subsequently recreated and the binding is lost.

Steps to Reproduce

  1. Create rabbitmq_exchange resource.

  2. Create rabbitmq_queue resource.

  3. Create rabbitmq_binding resource that binds the exchange from step 1 and the queue from step 2.

  4. Apply

  5. Change queue type from classic -> quorum or quorum -> classic

  6. Apply

Important Factoids

N/A.

References

/api/queues/vhost/name/bindings - A list of all bindings on a given queue.

@0UserName
Copy link
Author

Implemented in a fork.

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