terraform-provider-databricks
terraform-provider-databricks copied to clipboard
[ISSUE] `databricks_job` prevents deleting on_start, on_failure, or on_success blocks from webhook_notifications
Configuration
resource "databricks_job" "this" {
max_concurrent_runs =1
name = "test"
retry_on_timeout = false
timeout_seconds = 0
webhook_notifications {
on_start {
id = var.webhook_id
}
on_failure {
id = var.webhook_id
}
on_success {
id = var.webhook_id
}
}
task {
task_key = "test"
existing_cluster_id = data.databricks_cluster.default.id
notebook_task {
notebook_path = "/Repos/REPOSITORYIDENTIFIER/MYREPO/MYNOTEBOOKPATH"
source = "WORKSPACE"
}
}
}
Expected Behavior
When removing existing on_start, on_failure, or on_success blocks from webhook_notifications, it should remove the entire block.
Actual Behavior
Leaves removed block (such as on_success) and attempts to assign "" to the id resulting in an error.
Steps to Reproduce
- Run example above (updating notebook_path, var.webhook_id, and cluster od
- Comment out on_success block
- Run
Results in:
~ resource "databricks_job" "this" {
id = "XXXX"
name = "test"
# (8 unchanged attributes hidden)
~ webhook_notifications {
~ on_success {
- id = "XXX-XXX-XXX-XXX-XXXX" -> null
}
# (2 unchanged blocks hidden)
}
# (2 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
databricks_job.this: Modifying... [id=XXX]
╷
│ Error: cannot update job: Webhook with id '' was not found.
│
│ with databricks_job.this,
│ on main.tf line 33, in resource "databricks_job" "this":
│ 33: resource "databricks_job" "this" {
Terraform and provider versions
Hello,
I also have this error. Is there any news on this?
Francisco Vieira
I think this is related, but when I attempt to delete the entire webhook_notification block it will also assign the previous values to null, then complain that those fields can't be null. Seems it's not possible to remove a webhook from the terraform resource once it is added.
I ran into the exact same issue today. For email_notifications, destroying it does work. For webhook_notifications it does not. This makes setting webhook notifcations from terraform impossible to manage. Any news on this would be appreciated?
@mgyucht - https://github.com/databricks/terraform-provider-databricks/pull/3309 should fix this?