terraform/website/source/docs/providers/rabbitmq/r/policy.html.markdown

79 lines
1.6 KiB
Markdown
Raw Normal View History

2016-07-20 22:18:44 +02:00
---
layout: "rabbitmq"
page_title: "RabbitMQ: rabbitmq_policy"
sidebar_current: "docs-rabbitmq-resource-policy"
description: |-
Creates and manages a policy on a RabbitMQ server.
---
# rabbitmq\_policy
The ``rabbitmq_policy`` resource creates and manages policies for exchanges
and queues.
## Example Usage
```hcl
2016-07-20 22:18:44 +02:00
resource "rabbitmq_vhost" "test" {
name = "test"
2016-07-20 22:18:44 +02:00
}
resource "rabbitmq_permissions" "guest" {
user = "guest"
vhost = "${rabbitmq_vhost.test.name}"
permissions {
configure = ".*"
write = ".*"
read = ".*"
}
2016-07-20 22:18:44 +02:00
}
resource "rabbitmq_policy" "test" {
name = "test"
vhost = "${rabbitmq_permissions.guest.vhost}"
policy {
pattern = ".*"
priority = 0
apply_to = "all"
definition {
ha-mode = "all"
2016-07-20 22:18:44 +02:00
}
}
2016-07-20 22:18:44 +02:00
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The name of the policy.
* `vhost` - (Required) The vhost to create the resource in.
* `policy` - (Required) The settings of the policy. The structure is
described below.
The `policy` block supports:
* `pattern` - (Required) A pattern to match an exchange or queue name.
* `priority` - (Required) The policy with the greater priority is applied first.
* `apply_to` - (Required) Can either be "exchange", "queues", or "all".
* `definition` - (Required) Key/value pairs of the policy definition. See the
RabbitMQ documentation for definition references and examples.
## Attributes Reference
No further attributes are exported.
## Import
Policies can be imported using the `id` which is composed of `name@vhost`.
E.g.
```
terraform import rabbitmq_policy.test name@vhost
```