2016-07-20 22:18:44 +02:00
|
|
|
---
|
|
|
|
layout: "rabbitmq"
|
|
|
|
page_title: "RabbitMQ: rabbitmq_exchange"
|
|
|
|
sidebar_current: "docs-rabbitmq-resource-exchange"
|
|
|
|
description: |-
|
|
|
|
Creates and manages an exchange on a RabbitMQ server.
|
|
|
|
---
|
|
|
|
|
|
|
|
# rabbitmq\_exchange
|
|
|
|
|
|
|
|
The ``rabbitmq_exchange`` resource creates and manages an exchange.
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
2017-04-17 12:17:54 +02:00
|
|
|
```hcl
|
2016-07-20 22:18:44 +02:00
|
|
|
resource "rabbitmq_vhost" "test" {
|
2017-02-18 23:48:50 +01:00
|
|
|
name = "test"
|
2016-07-20 22:18:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "rabbitmq_permissions" "guest" {
|
2017-02-18 23:48:50 +01:00
|
|
|
user = "guest"
|
|
|
|
vhost = "${rabbitmq_vhost.test.name}"
|
|
|
|
|
|
|
|
permissions {
|
|
|
|
configure = ".*"
|
|
|
|
write = ".*"
|
|
|
|
read = ".*"
|
|
|
|
}
|
2016-07-20 22:18:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "rabbitmq_exchange" "test" {
|
2017-02-18 23:48:50 +01:00
|
|
|
name = "test"
|
|
|
|
vhost = "${rabbitmq_permissions.guest.vhost}"
|
|
|
|
|
|
|
|
settings {
|
|
|
|
type = "fanout"
|
|
|
|
durable = false
|
|
|
|
auto_delete = true
|
|
|
|
}
|
2016-07-20 22:18:44 +02:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `name` - (Required) The name of the exchange.
|
|
|
|
|
|
|
|
* `vhost` - (Required) The vhost to create the resource in.
|
|
|
|
|
|
|
|
* `settings` - (Required) The settings of the exchange. The structure is
|
|
|
|
described below.
|
|
|
|
|
|
|
|
The `settings` block supports:
|
|
|
|
|
|
|
|
* `type` - (Required) The type of exchange.
|
|
|
|
|
|
|
|
* `durable` - (Optional) Whether the exchange survives server restarts.
|
|
|
|
Defaults to `false`.
|
|
|
|
|
|
|
|
* `auto_delete` - (Optional) Whether the exchange will self-delete when all
|
|
|
|
queues have finished using it.
|
|
|
|
|
|
|
|
* `arguments` - (Optional) Additional key/value settings for the exchange.
|
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
|
|
|
No further attributes are exported.
|
|
|
|
|
|
|
|
## Import
|
|
|
|
|
|
|
|
Exchanges can be imported using the `id` which is composed of `name@vhost`.
|
|
|
|
E.g.
|
|
|
|
|
|
|
|
```
|
|
|
|
terraform import rabbitmq_exchange.test test@vhost
|
|
|
|
```
|