Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_data_factory_trigger_custom_event requires one of subject_begins_with or subject_ends_with when the Azure UI / REST API does not #25929

Closed
1 task done
jonnyry opened this issue May 10, 2024 · 1 comment · Fixed by #25932

Comments

@jonnyry
Copy link
Contributor

jonnyry commented May 10, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.6.6

AzureRM Provider Version

3.100.0

Affected Resource(s)/Data Source(s)

azurerm_data_factory_trigger_custom_event

Terraform Configuration Files

resource "azurerm_data_factory_trigger_custom_event" "my_trigger" {

  name = "adf-my-trigger"
  data_factory_id = azurerm_data_factory.adf.id
  eventgrid_topic_id = azurerm_eventgrid_topic.my_topic.id
  events = [ "MyEventName"]

  pipeline {
    name = "adf-my-pipeline"
  }
}

Debug Output/Panic Output

│ Error: Missing required argument
│ 
│   with module.module_name.azurerm_data_factory_trigger_custom_event.trigger_defender_scan_result,
│   on module_name/datafactory.tf line 235, in resource "azurerm_data_factory_trigger_custom_event" "trigger_name":
│  235: resource "azurerm_data_factory_trigger_custom_event" "trigger_name" {
│ 
│ "subject_begins_with": one of `subject_begins_with,subject_ends_with` must be specified
╵
╷
│ Error: Missing required argument
│ 
│   with module.module_name.azurerm_data_factory_trigger_custom_event.trigger_defender_scan_result,
│   on module_name/datafactory.tf line 235, in resource "azurerm_data_factory_trigger_custom_event" "trigger_name":
│  235: resource "azurerm_data_factory_trigger_custom_event" "trigger_name" {
│ 
│ "subject_ends_with": one of `subject_begins_with,subject_ends_with` must be specified

Expected Behaviour

It should be possible to not set both of subject_begins_with or subject_ends_with properties, as per the Azure UI, REST API & Documentation:

Microsoft Custom Event Schema JSON documentation

See Microsoft ADF custom trigger documentation: https://learn.microsoft.com/en-gb/azure/data-factory/how-to-create-custom-event-trigger#json-schema

image

Testing with REST API

Indeed, you can test the underlying REST API for the presence & absence of the two parameters & whether they will update the trigger without the properties or not:

GET trigger:

az rest --method get --url https://management.azure.com/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.DataFactory/factories/<ADF_NAME>/triggers/<EVENT_TRIGGER_NAME>?api-version=2018-06-01

PUT trigger:

az rest --method put --url https://management.azure.com/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.DataFactory/factories/<ADF_NAME>/triggers/<EVENT_TRIGGER_NAME>?api-version=2018-06-01 --body "{  'properties': {    'type': 'CustomEventsTrigger',    'typeProperties': {      'events': [        'MyEventType'      ],      'scope': '/subscriptions/<SUBSCRIPTION_ID>/resourceGroups/<RESOURCE_GROUP>/providers/Microsoft.EventGrid/topics/<EVENT_GRID_TOPIC_NAME>'   },    'pipelines': [      {       'pipelineReference': {          'referenceName': '<PIPELINE_NAME>',          'type': 'PipelineReference'        }      }    ]  }}"

Testing in the Azure portal UI

image

Actual Behaviour

One of subject_begins_with or subject_ends_with fields are required to be populated with a non empty string.

See

Steps to Reproduce

  1. Create an ADF instance & an Event Grid Custom Topic
  2. Attempt to subscribe to the Event Grid Custom Topic using azurerm_data_factory_trigger_custom_event resource and do not add subject_begins_with or subject_ends_with properties.
  3. Observe the error described.

Important Factoids

No response

References

No response

@jonnyry jonnyry changed the title azurerm_data_factory_trigger_custom_event does not require a non-empty string for subject_begins_with or subject_ends_with azurerm_data_factory_trigger_custom_event requires a non-empty string for subject_begins_with or subject_ends_with when the Azure UI does not May 10, 2024
@jonnyry jonnyry changed the title azurerm_data_factory_trigger_custom_event requires a non-empty string for subject_begins_with or subject_ends_with when the Azure UI does not azurerm_data_factory_trigger_custom_event requires one of subject_begins_with or subject_ends_with when the Azure UI / REST API does not May 10, 2024
catriona-m pushed a commit that referenced this issue May 14, 2024
…h and subject_ends_with to both not be set (#25932)

* #25929 azurerm_data_factory_trigger_custom_event requires a non-empty string for subject_begins_with or subject_ends_with when the Azure UI does not

* #25929
@github-actions github-actions bot added this to the v3.104.0 milestone May 14, 2024
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.