azurermEventgridEventSubscription
Manages an EventGrid Event Subscription
Example Usage
/*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: "example-resources",
}
);
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
this,
"example_1",
{
account_replication_type: "LRS",
account_tier: "Standard",
location: azurermResourceGroupExample.location,
name: "exampleasa",
resource_group_name: azurermResourceGroupExample.name,
tags: {
environment: "staging",
},
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermStorageQueueExample = new azurerm.storageQueue.StorageQueue(
this,
"example_2",
{
name: "example-astq",
storage_account_name: azurermStorageAccountExample.name,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageQueueExample.overrideLogicalId("example");
const azurermEventgridEventSubscriptionExample =
new azurerm.eventgridEventSubscription.EventgridEventSubscription(
this,
"example_3",
{
name: "example-aees",
scope: azurermResourceGroupExample.id,
storage_queue_endpoint: [
{
queue_name: azurermStorageQueueExample.name,
storage_account_id: azurermStorageAccountExample.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.*/
azurermEventgridEventSubscriptionExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the EventGrid Event Subscription resource. Changing this forces a new resource to be created. -
scope
- (Required) Specifies the scope at which the EventGrid Event Subscription should be created. Changing this forces a new resource to be created. -
expirationTimeUtc
- (Optional) Specifies the expiration time of the event subscription (Datetime Formatrfc3339
). -
eventDeliverySchema
- (Optional) Specifies the event delivery schema for the event subscription. Possible values include:eventGridSchema
,cloudEventSchemaV10
,customInputSchema
. Defaults toeventGridSchema
. Changing this forces a new resource to be created. -
azureFunctionEndpoint
- (Optional) AnazureFunctionEndpoint
block as defined below. -
eventhubEndpointId
- (Optional) Specifies the id where the Event Hub is located. -
hybridConnectionEndpointId
- (Optional) Specifies the id where the Hybrid Connection is located. -
serviceBusQueueEndpointId
- (Optional) Specifies the id where the Service Bus Queue is located. -
serviceBusTopicEndpointId
- (Optional) Specifies the id where the Service Bus Topic is located. -
storageQueueEndpoint
- (Optional) AstorageQueueEndpoint
block as defined below. -
webhookEndpoint
- (Optional) AwebhookEndpoint
block as defined below.
\~> NOTE: One of eventhubEndpointId
, hybridConnectionEndpointId
, serviceBusQueueEndpointId
, serviceBusTopicEndpointId
, storageQueueEndpoint
, webhookEndpoint
or azureFunctionEndpoint
must be specified.
-
includedEventTypes
- (Optional) A list of applicable event types that need to be part of the event subscription. -
subjectFilter
- (Optional) AsubjectFilter
block as defined below. -
advancedFilter
- (Optional) AadvancedFilter
block as defined below. -
deliveryIdentity
- (Optional) AdeliveryIdentity
block as defined below. -
deliveryProperty
- (Optional) One or moredeliveryProperty
blocks as defined below. -
deadLetterIdentity
- (Optional) AdeadLetterIdentity
block as defined below.
-> Note: storageBlobDeadLetterDestination
must be specified when a deadLetterIdentity
is specified
-
storageBlobDeadLetterDestination
- (Optional) AstorageBlobDeadLetterDestination
block as defined below. -
retryPolicy
- (Optional) AretryPolicy
block as defined below. -
labels
- (Optional) A list of labels to assign to the event subscription. -
advancedFilteringOnArraysEnabled
- (Optional) Specifies whether advanced filters should be evaluated against an array of values instead of expecting a singular value. Defaults tofalse
.
A storageQueueEndpoint
block supports the following:
-
storageAccountId
- (Required) Specifies the id of the storage account id where the storage queue is located. -
queueName
- (Required) Specifies the name of the storage queue where the Event Subscription will receive events. -
queueMessageTimeToLiveInSeconds
- (Optional) Storage queue message time to live in seconds.
An azureFunctionEndpoint
block supports the following:
-
functionId
- (Required) Specifies the ID of the Function where the Event Subscription will receive events. This must be the functions ID in format {function_app.id}/functions/{name}. -
maxEventsPerBatch
- (Optional) Maximum number of events per batch. -
preferredBatchSizeInKilobytes
- (Optional) Preferred batch size in Kilobytes.
A webhookEndpoint
block supports the following:
-
url
- (Required) Specifies the url of the webhook where the Event Subscription will receive events. -
baseUrl
- (Computed) The base url of the webhook where the Event Subscription will receive events. -
maxEventsPerBatch
- (Optional) Maximum number of events per batch. -
preferredBatchSizeInKilobytes
- (Optional) Preferred batch size in Kilobytes. -
activeDirectoryTenantId
- (Optional) The Azure Active Directory Tenant ID to get the access token that will be included as the bearer token in delivery requests. -
activeDirectoryAppIdOrUri
- (Optional) The Azure Active Directory Application ID or URI to get the access token that will be included as the bearer token in delivery requests.
A subjectFilter
block supports the following:
-
subjectBeginsWith
- (Optional) A string to filter events for an event subscription based on a resource path prefix. -
subjectEndsWith
- (Optional) A string to filter events for an event subscription based on a resource path suffix. -
caseSensitive
- (Optional) Specifies ifsubjectBeginsWith
andsubjectEndsWith
case sensitive. This value
A advancedFilter
supports the following nested blocks:
boolEquals
- (Optional) Compares a value of an event using a single boolean value.numberGreaterThan
- (Optional) Compares a value of an event using a single floating point number.numberGreaterThanOrEquals
- (Optional) Compares a value of an event using a single floating point number.numberLessThan
- (Optional) Compares a value of an event using a single floating point number.numberLessThanOrEquals
- (Optional) Compares a value of an event using a single floating point number.numberIn
- (Optional) Compares a value of an event using multiple floating point numbers.numberNotIn
- (Optional) Compares a value of an event using multiple floating point numbers.numberInRange
- (Optional) Compares a value of an event using multiple floating point number ranges.numberNotInRange
- (Optional) Compares a value of an event using multiple floating point number ranges.stringBeginsWith
- (Optional) Compares a value of an event using multiple string values.stringNotBeginsWith
- (Optional) Compares a value of an event using multiple string values.stringEndsWith
- (Optional) Compares a value of an event using multiple string values.stringNotEndsWith
- (Optional) Compares a value of an event using multiple string values.stringContains
- (Optional) Compares a value of an event using multiple string values.stringNotContains
- (Optional) Compares a value of an event using multiple string values.stringIn
- (Optional) Compares a value of an event using multiple string values.stringNotIn
- (Optional) Compares a value of an event using multiple string values.isNotNull
- (Optional) Evaluates if a value of an event isn't NULL or undefined.isNullOrUndefined
- (Optional) Evaluates if a value of an event is NULL or undefined.
Each nested block consists of a key and a value(s) element.
-
key
- (Required) Specifies the field within the event data that you want to use for filtering. Type of the field can be a number, boolean, or string. -
value
- (Required) Specifies a single value to compare to when using a single value operator.
OR
values
- (Required) Specifies an array of values to compare to when using a multiple values operator.
\~> NOTE: A maximum of total number of advanced filter values allowed on event subscription is 25.
A deliveryIdentity
block supports the following:
-
type
- (Required) Specifies the type of Managed Service Identity that is used for event delivery. Allowed value issystemAssigned
,userAssigned
. -
userAssignedIdentity
- (Optional) The user identity associated with the resource.
A deliveryProperty
block supports the following:
-
headerName
- (Required) The name of the header to send on to the destination -
type
- (Required) Eitherstatic
ordynamic
-
value
- (Optional) If thetype
isstatic
, then provide the value to use -
sourceField
- (Optional) If thetype
isdynamic
, then provide the payload field to be used as the value. Valid source fields differ by subscription type. -
secret
- (Optional) True if thevalue
is a secret and should be protected, otherwise false. If True, then this value won't be returned from Azure API calls
A deadLetterIdentity
block supports the following:
-
type
- (Required) Specifies the type of Managed Service Identity that is used for dead lettering. Allowed value issystemAssigned
,userAssigned
. -
userAssignedIdentity
- (Optional) The user identity associated with the resource.
A storageBlobDeadLetterDestination
block supports the following:
-
storageAccountId
- (Required) Specifies the id of the storage account id where the storage blob is located. -
storageBlobContainerName
- (Required) Specifies the name of the Storage blob container that is the destination of the deadletter events.
A retryPolicy
block supports the following:
-
maxDeliveryAttempts
- (Required) Specifies the maximum number of delivery retry attempts for events. -
eventTimeToLive
- (Required) Specifies the time to live (in minutes) for events. Supported range is1
to1440
. See official documentation for more details.
Attributes Reference
The following attributes are exported:
id
- The ID of the EventGrid Event Subscription.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the EventGrid Event Subscription.update
- (Defaults to 30 minutes) Used when updating the EventGrid Event Subscription.read
- (Defaults to 5 minutes) Used when retrieving the EventGrid Event Subscription.delete
- (Defaults to 30 minutes) Used when deleting the EventGrid Event Subscription.
Import
EventGrid Event Subscription's can be imported using the resourceId
, e.g.