azurermServicebusSubscriptionRule
Manages a ServiceBus Subscription Rule.
Example Usage (SQL Filter)
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "tfex-servicebus-subscription-rule-sql",
}
);
const azurermServicebusNamespaceExample =
new azurerm.servicebusNamespace.ServicebusNamespace(this, "example_1", {
location: azurermResourceGroupExample.location,
name: "tfex-servicebus-namespace",
resource_group_name: azurermResourceGroupExample.name,
sku: "Standard",
tags: {
source: "terraform",
},
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusNamespaceExample.overrideLogicalId("example");
const azurermServicebusTopicExample =
new azurerm.servicebusTopic.ServicebusTopic(this, "example_2", {
enable_partitioning: true,
name: "tfex_servicebus_topic",
namespace_id: azurermServicebusNamespaceExample.id,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusTopicExample.overrideLogicalId("example");
const azurermServicebusSubscriptionExample =
new azurerm.servicebusSubscription.ServicebusSubscription(this, "example_3", {
max_delivery_count: 1,
name: "tfex_servicebus_subscription",
topic_id: azurermServicebusTopicExample.id,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusSubscriptionExample.overrideLogicalId("example");
const azurermServicebusSubscriptionRuleExample =
new azurerm.servicebusSubscriptionRule.ServicebusSubscriptionRule(
this,
"example_4",
{
filter_type: "SqlFilter",
name: "tfex_servicebus_rule",
sql_filter: "colour = 'red'",
subscription_id: azurermServicebusSubscriptionExample.id,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusSubscriptionRuleExample.overrideLogicalId("example");
Example Usage (Correlation Filter)
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "tfex-servicebus-subscription-rule-cor",
}
);
const azurermServicebusNamespaceExample =
new azurerm.servicebusNamespace.ServicebusNamespace(this, "example_1", {
location: azurermResourceGroupExample.location,
name: "tfex-servicebus-namespace",
resource_group_name: azurermResourceGroupExample.name,
sku: "Standard",
tags: {
source: "terraform",
},
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusNamespaceExample.overrideLogicalId("example");
const azurermServicebusTopicExample =
new azurerm.servicebusTopic.ServicebusTopic(this, "example_2", {
enable_partitioning: true,
name: "tfex_servicebus_topic",
namespace_id: azurermServicebusNamespaceExample.id,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusTopicExample.overrideLogicalId("example");
const azurermServicebusSubscriptionExample =
new azurerm.servicebusSubscription.ServicebusSubscription(this, "example_3", {
max_delivery_count: 1,
name: "tfex_servicebus_subscription",
topic_id: azurermServicebusTopicExample.id,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusSubscriptionExample.overrideLogicalId("example");
const azurermServicebusSubscriptionRuleExample =
new azurerm.servicebusSubscriptionRule.ServicebusSubscriptionRule(
this,
"example_4",
{
correlation_filter: [
{
correlation_id: "high",
label: "red",
properties: [
{
customProperty: "value",
},
],
},
],
filter_type: "CorrelationFilter",
name: "tfex_servicebus_rule",
subscription_id: azurermServicebusSubscriptionExample.id,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermServicebusSubscriptionRuleExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the ServiceBus Subscription Rule. Changing this forces a new resource to be created. -
subscriptionId
- (Required) The ID of the ServiceBus Subscription in which this Rule should be created. Changing this forces a new resource to be created. -
filterType
- (Required) Type of filter to be applied to a BrokeredMessage. Possible values aresqlFilter
andcorrelationFilter
. -
sqlFilter
- (Optional) Represents a filter written in SQL language-based syntax that to be evaluated against a BrokeredMessage. Required whenfilterType
is set tosqlFilter
. -
correlationFilter
- (Optional) AcorrelationFilter
block as documented below to be evaluated against a BrokeredMessage. Required whenfilterType
is set tocorrelationFilter
. -
action
- (Optional) Represents set of actions written in SQL language-based syntax that is performed against a BrokeredMessage.
The correlationFilter
block supports the following:
-
contentType
- (Optional) Content type of the message. -
correlationId
- (Optional) Identifier of the correlation. -
label
- (Optional) Application specific label. -
messageId
- (Optional) Identifier of the message. -
replyTo
- (Optional) Address of the queue to reply to. -
replyToSessionId
- (Optional) Session identifier to reply to. -
sessionId
- (Optional) Session identifier. -
to
- (Optional) Address to send to. -
properties
- (Optional) A list of user defined properties to be included in the filter. Specified as a map of name/value pairs.
\~> NOTE: When creating a subscription rule of type correlationFilter
at least one property must be set in the correlationFilter
block.
Attributes Reference
The following attributes are exported:
id
- The ServiceBus Subscription Rule ID.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the ServiceBus Subscription Rule.update
- (Defaults to 30 minutes) Used when updating the ServiceBus Subscription Rule.read
- (Defaults to 5 minutes) Used when retrieving the ServiceBus Subscription Rule.delete
- (Defaults to 30 minutes) Used when deleting the ServiceBus Subscription Rule.
Import
Service Bus Subscription Rule can be imported using the resourceId
, e.g.