terraform/website/source/docs/providers/azurerm/r/servicebus_subscription.htm...

115 lines
4.0 KiB
Markdown
Raw Normal View History

---
layout: "azurerm"
page_title: "Azure Resource Manager: azurerm_servicebus_subscription"
sidebar_current: "docs-azurerm-resource-servicebus-subscription"
description: |-
Create a ServiceBus Subscription.
---
# azurerm\_servicebus\_subscription
Create a ServiceBus Subscription.
## Example Usage
```hcl
resource "azurerm_resource_group" "test" {
name = "resourceGroup1"
location = "West US"
}
resource "azurerm_servicebus_namespace" "test" {
name = "acceptanceTestServiceBusNamespace"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "standard"
tags {
environment = "Production"
}
}
resource "azurerm_servicebus_topic" "test" {
name = "testTopic"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
namespace_name = "${azurerm_servicebus_namespace.test.name}"
enable_partitioning = true
}
resource "azurerm_servicebus_subscription" "test" {
name = "testSubscription"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
namespace_name = "${azurerm_servicebus_namespace.test.name}"
topic_name = "${azurerm_servicebus_topic.test.name}"
max_delivery_count = 1
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) Specifies the name of the ServiceBus Subscription resource.
Changing this forces a new resource to be created.
* `namespace_name` - (Required) The name of the ServiceBus Namespace to create
this Subscription in. Changing this forces a new resource to be created.
* `topic_name` - (Required) The name of the ServiceBus Topic to create
this Subscription in. Changing this forces a new resource to be created.
* `location` - (Required) Specifies the supported Azure location where the resource exists.
Changing this forces a new resource to be created.
* `resource_group_name` - (Required) The name of the resource group in which to
create the namespace. Changing this forces a new resource to be created.
* `max_delivery_count` - (Required) The maximum number of deliveries.
* `auto_delete_on_idle` - (Optional) The idle interval after which the
Subscription is automatically deleted, minimum of 5 minutes. Provided in the
[TimeSpan](#timespan-format) format.
* `default_message_ttl` - (Optional) The TTL of messages sent to this Subscription
if no TTL value is set on the message itself. Provided in the [TimeSpan](#timespan-format)
format.
* `lock_duration` - (Optional) The lock duration for the subscription, maximum
supported value is 5 minutes. Defaults to 1 minute.
* `dead_lettering_on_filter_evaluation_exceptions` - (Optional) Boolean flag which
controls whether the Subscription has dead letter support on Filter evaluation
exceptions. Defaults to false.
* `dead_lettering_on_message_expiration` - (Optional) Boolean flag which controls
whether the Subscription has dead letter support when a message expires. Defaults
to false.
* `enable_batched_operations` - (Optional) Boolean flag which controls whether the
Subscription supports batched operations. Defaults to false.
* `requires_session` - (Optional) Boolean flag which controls whether this Subscription
supports the concept of a session. Defaults to false. Changing this forces a
new resource to be created.
### TimeSpan Format
Some arguments for this resource are required in the TimeSpan format which is
used to represent a lengh of time. The supported format is documented [here](https://msdn.microsoft.com/en-us/library/se73z7b9(v=vs.110).aspx#Anchor_2)
## Attributes Reference
The following attributes are exported:
* `id` - The ServiceBus Subscription ID.
provider/azurerm: enable import of more resources (#10195) * provider/azurerm: support import of virtual_machine TF_ACC=1 go test ./builtin/providers/azurerm -v -run "TestAccAzureRMVirtualMachine_(basic|import)" -timeout 120m === RUN TestAccAzureRMVirtualMachine_importBasic --- PASS: TestAccAzureRMVirtualMachine_importBasic (561.08s) === RUN TestAccAzureRMVirtualMachine_basicLinuxMachine --- PASS: TestAccAzureRMVirtualMachine_basicLinuxMachine (677.49s) === RUN TestAccAzureRMVirtualMachine_basicLinuxMachine_disappears --- PASS: TestAccAzureRMVirtualMachine_basicLinuxMachine_disappears (674.21s) === RUN TestAccAzureRMVirtualMachine_basicWindowsMachine --- PASS: TestAccAzureRMVirtualMachine_basicWindowsMachine (1105.18s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 3017.970s * provider/azurerm: support import of servicebus_namespace TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMServiceBusNamespace_import -timeout 120m === RUN TestAccAzureRMServiceBusNamespace_importBasic --- PASS: TestAccAzureRMServiceBusNamespace_importBasic (345.80s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 345.879s * provider/azurerm: document import of servicebus_topic and servicebus_subscription * provider/azurerm: support import of dns record resources TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMDns[A-z]+Record_importBasic -timeout 120m === RUN TestAccAzureRMDnsARecord_importBasic --- PASS: TestAccAzureRMDnsARecord_importBasic (102.84s) === RUN TestAccAzureRMDnsAAAARecord_importBasic --- PASS: TestAccAzureRMDnsAAAARecord_importBasic (100.59s) === RUN TestAccAzureRMDnsCNameRecord_importBasic --- PASS: TestAccAzureRMDnsCNameRecord_importBasic (98.94s) === RUN TestAccAzureRMDnsMxRecord_importBasic --- PASS: TestAccAzureRMDnsMxRecord_importBasic (107.30s) === RUN TestAccAzureRMDnsNsRecord_importBasic --- PASS: TestAccAzureRMDnsNsRecord_importBasic (98.55s) === RUN TestAccAzureRMDnsSrvRecord_importBasic --- PASS: TestAccAzureRMDnsSrvRecord_importBasic (100.19s) === RUN TestAccAzureRMDnsTxtRecord_importBasic --- PASS: TestAccAzureRMDnsTxtRecord_importBasic (97.49s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 706.000s * provider/azurerm: support import of cdn_endpoint, document profile import TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMCdnEndpoint_import -timeout 120m === RUN TestAccAzureRMCdnEndpoint_importWithTags --- PASS: TestAccAzureRMCdnEndpoint_importWithTags (207.83s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 207.907s * provider/azurerm: support import of sql_server, fix sql_firewall import TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMSql[A-z]+_importBasic -timeout 120m === RUN TestAccAzureRMSqlFirewallRule_importBasic --- PASS: TestAccAzureRMSqlFirewallRule_importBasic (153.72s) === RUN TestAccAzureRMSqlServer_importBasic --- PASS: TestAccAzureRMSqlServer_importBasic (119.83s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 273.630s
2016-11-22 13:13:11 +01:00
## Import
Service Bus Subscriptions can be imported using the `resource id`, e.g.
provider/azurerm: enable import of more resources (#10195) * provider/azurerm: support import of virtual_machine TF_ACC=1 go test ./builtin/providers/azurerm -v -run "TestAccAzureRMVirtualMachine_(basic|import)" -timeout 120m === RUN TestAccAzureRMVirtualMachine_importBasic --- PASS: TestAccAzureRMVirtualMachine_importBasic (561.08s) === RUN TestAccAzureRMVirtualMachine_basicLinuxMachine --- PASS: TestAccAzureRMVirtualMachine_basicLinuxMachine (677.49s) === RUN TestAccAzureRMVirtualMachine_basicLinuxMachine_disappears --- PASS: TestAccAzureRMVirtualMachine_basicLinuxMachine_disappears (674.21s) === RUN TestAccAzureRMVirtualMachine_basicWindowsMachine --- PASS: TestAccAzureRMVirtualMachine_basicWindowsMachine (1105.18s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 3017.970s * provider/azurerm: support import of servicebus_namespace TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMServiceBusNamespace_import -timeout 120m === RUN TestAccAzureRMServiceBusNamespace_importBasic --- PASS: TestAccAzureRMServiceBusNamespace_importBasic (345.80s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 345.879s * provider/azurerm: document import of servicebus_topic and servicebus_subscription * provider/azurerm: support import of dns record resources TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMDns[A-z]+Record_importBasic -timeout 120m === RUN TestAccAzureRMDnsARecord_importBasic --- PASS: TestAccAzureRMDnsARecord_importBasic (102.84s) === RUN TestAccAzureRMDnsAAAARecord_importBasic --- PASS: TestAccAzureRMDnsAAAARecord_importBasic (100.59s) === RUN TestAccAzureRMDnsCNameRecord_importBasic --- PASS: TestAccAzureRMDnsCNameRecord_importBasic (98.94s) === RUN TestAccAzureRMDnsMxRecord_importBasic --- PASS: TestAccAzureRMDnsMxRecord_importBasic (107.30s) === RUN TestAccAzureRMDnsNsRecord_importBasic --- PASS: TestAccAzureRMDnsNsRecord_importBasic (98.55s) === RUN TestAccAzureRMDnsSrvRecord_importBasic --- PASS: TestAccAzureRMDnsSrvRecord_importBasic (100.19s) === RUN TestAccAzureRMDnsTxtRecord_importBasic --- PASS: TestAccAzureRMDnsTxtRecord_importBasic (97.49s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 706.000s * provider/azurerm: support import of cdn_endpoint, document profile import TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMCdnEndpoint_import -timeout 120m === RUN TestAccAzureRMCdnEndpoint_importWithTags --- PASS: TestAccAzureRMCdnEndpoint_importWithTags (207.83s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 207.907s * provider/azurerm: support import of sql_server, fix sql_firewall import TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMSql[A-z]+_importBasic -timeout 120m === RUN TestAccAzureRMSqlFirewallRule_importBasic --- PASS: TestAccAzureRMSqlFirewallRule_importBasic (153.72s) === RUN TestAccAzureRMSqlServer_importBasic --- PASS: TestAccAzureRMSqlServer_importBasic (119.83s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 273.630s
2016-11-22 13:13:11 +01:00
```
terraform import azurerm_servicebus_subscription.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/microsoft.servicebus/namespaces/sbns1/topics/sntopic1/subscriptions/sbsub1
```