Skip to content

Commit

Permalink
fix: review notes
Browse files Browse the repository at this point in the history
  • Loading branch information
jrauschenbusch committed May 6, 2020
1 parent 65259c9 commit 74a64a1
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func resourceArmEventGridEventSubscription() *schema.Resource {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
ConflictsWith: RemoveFromStringArray(getEnpointTypes(), "hybrid_connection_endpoint"),
ConflictsWith: RemoveFromStringArray(getEnpointTypes(), "webhook_endpoint"),
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"url": {
Expand Down Expand Up @@ -523,7 +523,7 @@ func resourceArmEventGridEventSubscriptionRead(d *schema.ResourceData, meta inte
}

if err := d.Set("advanced_filter", flattenEventGridEventSubscriptionAdvancedFilter(filter.AdvancedFilters)); err != nil {
return fmt.Errorf("Error setting `advanced_filter_scalar` for EventGrid Event Subscription %q (Scope %q): %s", name, scope, err)
return fmt.Errorf("Error setting `advanced_filter` for EventGrid Event Subscription %q (Scope %q): %s", name, scope, err)
}
}

Expand Down Expand Up @@ -713,13 +713,13 @@ func expandEventGridEventSubscriptionAzureFunctionEndpoint(d *schema.ResourceDat
props := d.Get("azure_function_endpoint").([]interface{})[0].(map[string]interface{})
azureFunctionResourceID := props["azure_function_id"].(string)

storageQueueEndpoint := eventgrid.AzureFunctionEventSubscriptionDestination{
azureFunctionEndpoint := eventgrid.AzureFunctionEventSubscriptionDestination{
EndpointType: eventgrid.EndpointTypeAzureFunction,
AzureFunctionEventSubscriptionDestinationProperties: &eventgrid.AzureFunctionEventSubscriptionDestinationProperties{
ResourceID: &azureFunctionResourceID,
},
}
return storageQueueEndpoint
return azureFunctionEndpoint
}

func expandEventGridEventSubscriptionFilter(d *schema.ResourceData) (*eventgrid.EventSubscriptionFilter, error) {
Expand Down Expand Up @@ -770,6 +770,7 @@ func expandAdvancedFilter(config map[string]interface{}) (eventgrid.BasicAdvance
string(eventgrid.OperatorTypeNumberGreaterThanOrEquals),
string(eventgrid.OperatorTypeNumberLessThan),
string(eventgrid.OperatorTypeNumberLessThanOrEquals):
// Workaround as long as nested schema validation is not working as expected (see https://github.com/hashicorp/terraform-plugin-sdk/issues/71)
if values != nil && len(*values) > 0 {
return nil, fmt.Errorf("Conflicting field for `advanced_filter` (key=%s, operator_type=%s): values", key, operatorType)
}
Expand All @@ -785,6 +786,7 @@ func expandAdvancedFilter(config map[string]interface{}) (eventgrid.BasicAdvance
string(eventgrid.OperatorTypeStringEndsWith),
string(eventgrid.OperatorTypeStringIn),
string(eventgrid.OperatorTypeStringNotIn):
// Workaround as long as nested schema validation is not working as expected (see https://github.com/hashicorp/terraform-plugin-sdk/issues/71)
if &value != nil && len(value) > 0 {
return nil, fmt.Errorf("Conflicting field for `advanced_filter` (key=%s, operator_type=%s): value", key, operatorType)
}
Expand Down

0 comments on commit 74a64a1

Please sign in to comment.