Skip to content

Commit

Permalink
Retrieve full URL for event grid subscription webhooks (#3630)
Browse files Browse the repository at this point in the history
(fixes #3629)
  • Loading branch information
phekmat authored and katbyte committed Jun 13, 2019
1 parent 41f071c commit 3bf4a5f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions azurerm/resource_arm_eventgrid_event_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,12 @@ func resourceArmEventGridEventSubscriptionRead(d *schema.ResourceData, meta inte
return fmt.Errorf("Error setting `hybrid_connection_endpoint` for EventGrid Event Subscription %q (Scope %q): %s", name, scope, err)
}
}
if webhookEndpoint, ok := props.Destination.AsWebHookEventSubscriptionDestination(); ok {
if err := d.Set("webhook_endpoint", flattenEventGridEventSubscriptionWebhookEndpoint(webhookEndpoint)); err != nil {
if _, ok := props.Destination.AsWebHookEventSubscriptionDestination(); ok {
fullURL, err := client.GetFullURL(ctx, scope, name)
if err != nil {
return fmt.Errorf("Error making Read request on EventGrid Event Subscription full URL '%s': %+v", name, err)
}
if err := d.Set("webhook_endpoint", flattenEventGridEventSubscriptionWebhookEndpoint(&fullURL)); err != nil {
return fmt.Errorf("Error setting `webhook_endpoint` for EventGrid Event Subscription %q (Scope %q): %s", name, scope, err)
}
}
Expand Down Expand Up @@ -575,7 +579,7 @@ func flattenEventGridEventSubscriptionHybridConnectionEndpoint(input *eventgrid.
return []interface{}{result}
}

func flattenEventGridEventSubscriptionWebhookEndpoint(input *eventgrid.WebHookEventSubscriptionDestination) []interface{} {
func flattenEventGridEventSubscriptionWebhookEndpoint(input *eventgrid.EventSubscriptionFullURL) []interface{} {
if input == nil {
return nil
}
Expand Down

0 comments on commit 3bf4a5f

Please sign in to comment.