Skip to content

Commit

Permalink
add delivery_property to `azurerm_eventgrid_system_topic_event_subs…
Browse files Browse the repository at this point in the history
…cription` (#15559)

* add delivery_property

* Remove `Scope` attr

* fix azureFunctionEndpoint stmt and field Name -> EventSubscriptionName

* static test

* mixed test

* docs

* secret

* use service bus

* update, eventhub, hybrid

* fix class and method names

* eventhub_endpoint block dne, but azure_function_endpoint can be defined; add relevant endpoint note

* add hybrid connection id

* Add period to end of description

Co-authored-by: stephybun <steph@hashicorp.com>

* Add period to end of description

Co-authored-by: stephybun <steph@hashicorp.com>

* Add period to end of description

Co-authored-by: stephybun <steph@hashicorp.com>

* Use ticks to indicate boolean value

Co-authored-by: stephybun <steph@hashicorp.com>

* terrafmt applied to internal/services/eventgrid/eventgrid_system_topic_event_subscription_resource_test.go

* fix for 3.0 beta errors

* terrafmt changes

* rm rgname

* eventhub still uses namespace_name

Co-authored-by: stephybun <steph@hashicorp.com>
  • Loading branch information
jackmuskopf and stephybun authored Mar 14, 2022
1 parent 92476f0 commit 20a701f
Show file tree
Hide file tree
Showing 3 changed files with 558 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ func resourceEventGridSystemTopicEventSubscription() *pluginsdk.Resource {
"labels": eventSubscriptionSchemaLabels(),

"advanced_filtering_on_arrays_enabled": eventSubscriptionSchemaEnableAdvancedFilteringOnArrays(),

"delivery_property": eventSubscriptionSchemaDeliveryProperty(),
},
}
}
Expand Down Expand Up @@ -275,16 +277,34 @@ func resourceEventGridSystemTopicEventSubscriptionRead(d *pluginsdk.ResourceData
if err := d.Set("azure_function_endpoint", flattenEventGridEventSubscriptionAzureFunctionEndpoint(azureFunctionEndpoint)); err != nil {
return fmt.Errorf("setting `azure_function_endpoint`: %+v", err)
}
if azureFunctionEndpoint.DeliveryAttributeMappings != nil {
if err := d.Set("delivery_property", flattenDeliveryProperties(d, azureFunctionEndpoint.DeliveryAttributeMappings)); err != nil {
return fmt.Errorf("setting `%q` for EventGrid SystemTopic delivery properties %q: %s", "azure_function_endpoint", id.EventSubscriptionName, err)
}
}
}
if v, ok := destination.AsEventHubEventSubscriptionDestination(); ok {
if err := d.Set("eventhub_endpoint_id", v.ResourceID); err != nil {
return fmt.Errorf("setting `eventhub_endpoint_id`: %+v", err)
}

if v.DeliveryAttributeMappings != nil {
if err := d.Set("delivery_property", flattenDeliveryProperties(d, v.DeliveryAttributeMappings)); err != nil {
return fmt.Errorf("setting `%q` for EventGrid SystemTopic delivery properties %q: %s", "eventhub_endpoint", id.EventSubscriptionName, err)
}
}
}
if v, ok := destination.AsHybridConnectionEventSubscriptionDestination(); ok {
if err := d.Set("hybrid_connection_endpoint_id", v.ResourceID); err != nil {
return fmt.Errorf("setting `hybrid_connection_endpoint_id`: %+v", err)
}

if v.DeliveryAttributeMappings != nil {
if err := d.Set("delivery_property", flattenDeliveryProperties(d, v.DeliveryAttributeMappings)); err != nil {
return fmt.Errorf("setting `%q` for EventGrid SystemTopic delivery properties %q: %s", "hybrid_connection_endpoint", id.EventSubscriptionName, err)
}
}

}
if serviceBusQueueEndpoint, ok := destination.AsServiceBusQueueEventSubscriptionDestination(); ok {
if err := d.Set("service_bus_queue_endpoint_id", serviceBusQueueEndpoint.ResourceID); err != nil {
Expand All @@ -295,6 +315,11 @@ func resourceEventGridSystemTopicEventSubscriptionRead(d *pluginsdk.ResourceData
if err := d.Set("service_bus_topic_endpoint_id", serviceBusTopicEndpoint.ResourceID); err != nil {
return fmt.Errorf("setting `service_bus_topic_endpoint_id`: %+v", err)
}
if serviceBusTopicEndpoint.DeliveryAttributeMappings != nil {
if err := d.Set("delivery_property", flattenDeliveryProperties(d, serviceBusTopicEndpoint.DeliveryAttributeMappings)); err != nil {
return fmt.Errorf("setting `%q` for EventGrid SystemTopic delivery properties %q: %s", "service_bus_topic_endpoint_id", id.EventSubscriptionName, err)
}
}
}
if v, ok := destination.AsStorageQueueEventSubscriptionDestination(); ok {
if err := d.Set("storage_queue_endpoint", flattenEventGridEventSubscriptionStorageQueueEndpoint(v)); err != nil {
Expand All @@ -309,6 +334,11 @@ func resourceEventGridSystemTopicEventSubscriptionRead(d *pluginsdk.ResourceData
if err := d.Set("webhook_endpoint", flattenEventGridEventSubscriptionWebhookEndpoint(v, &fullURL)); err != nil {
return fmt.Errorf("setting `webhook_endpoint`: %+v", err)
}
if v.DeliveryAttributeMappings != nil {
if err := d.Set("delivery_property", flattenDeliveryProperties(d, v.DeliveryAttributeMappings)); err != nil {
return fmt.Errorf("setting `%q` for EventGrid SystemTopic delivery properties %q: %s", "webhook_endpoint", id.EventSubscriptionName, err)
}
}
}

deadLetterDestination := props.DeadLetterDestination
Expand Down
Loading

0 comments on commit 20a701f

Please sign in to comment.