terraform-provider-databricks icon indicating copy to clipboard operation
terraform-provider-databricks copied to clipboard

[ISSUE] Issue with `databricks_budget_policy` resource

Open jyrr opened this issue 7 months ago • 1 comments
trafficstars

Configuration

resource "databricks_budget_policy" "my_budget_policy" {
  provider    = databricks.account
  for_each    = toset(["policy1", "policy2", "policy3", "policy4", "policy5", "policy6", "policy7", "policy8", "policy9", "policy10"])
  policy_name = "bp_${each.value}"
  custom_tags = [{
    key   = "mytag"
    value = each.value
  }]
}

Expected Behavior

Create ten budget policies.

Actual Behavior

Creates some and then errors out with Duplicate policy name found. although there are no duplicate names. The plan looks absolutely fine with no duplicate policy names.

Steps to Reproduce

terraform plan --> all looks good terraform apply --> a number of policies are made and are visible in Databricks, but then it errors out saying Duplicate policy name found. for the remainder of the policy resources to be made.

Terraform and provider versions

Terraform v1.7.3 on windows_amd64

  • provider registry.terraform.io/databricks/databricks v1.70.0

Is it a regression?

No

jyrr avatar Mar 25 '25 19:03 jyrr

@jyrr this is a backend issue with budget policies where multiple create in parallel gets throttled - this is being looked at, but for now you would need to re-run the terraform apply a couple of times for this to succeed

nkvuong avatar Mar 27 '25 06:03 nkvuong

Rerunning the apply doesn't seem to make any progress for me - I also tried -parallelism=1 but no luck there either.

According to databricks account budget-policy list I have none created, but always get Duplicate policy name found.

Using provider version 1.82.0, otherwise the same issue. Plan looks fine, apply fails with duplicate policy name error.

adam133 avatar Jun 16 '25 20:06 adam133

Rerunning the apply doesn't seem to make any progress for me - I also tried -parallelism=1 but no luck there either.

Figured out part of the issue, my user needed Billing Admin role:

Billing admin Can view Budgets and create budget policies. This change might take a few minutes to update.

adam133 avatar Jun 16 '25 21:06 adam133