Problem
When you configure Azure Databricks with the Databricks provider, a terraform apply may intermittently fail with an invalid character error.
Error: invalid character '<' looking for beginning of value <!doctype html><html><head><meta... (487 more bytes)
Debug logs may also show an authorization error related to a missing token.
{"error":{"code":"Unauthorized","message":"AAA10000: Request is missing a Bearer or PoP token."}} [DEBUG] provider.terraform-provider-azurerm_v2.99.0_x5: AzureRM Request: POST /3dddd3d3-094d-4006-9849-0d11d61f4ddd/oauth2/token?api-version=1.0 HTTP/1.1Host: login.microsoftonline.comUser-Agent: Go/go1.17.5 (amd64-linux) go-autorest/adal/v1.0.0Content-Length: 170Content-Type: application/x-www-form-urlencodedAccept-Encoding: gzipPrerequisites
- An Azure environment
- The Terraform Databricks provider
Cause
This issue can be caused by underlying networking problems, such as:
- Intermittent DNS resolution failures.
- Misconfigurations in Azure Private Link or Private Endpoint settings.
Solutions
Solution 1: Investigate DNS Configuration
Review your DNS service for any intermittent resolution issues that could prevent the provider from reaching the necessary Azure endpoints. Ensure that all required hostnames are consistently resolvable from the environment where you run Terraform.
Solution 2: Verify Agent and Network Configuration
If you are using HCP Terraform agents or other automation agents, confirm that the execution environment is correctly configured to access Azure services. This includes verifying firewall rules, network security groups, and any Private Link or Private Endpoint configurations that could affect connectivity.
Outcome
After you resolve the underlying DNS or network connectivity issues, the Terraform configuration should apply successfully and consistently.