Troubleshoot the Databricks Terraform provider
This article provides troubleshooting information for common errors when using the Databricks Terraform provider. For information about the Databricks Terraform provider, see Databricks Terraform provider.
For Terraform-specific support, see the Latest Terraform topics on the HashiCorp Discuss website. For issues specific to the Databricks Terraform Provider, see Issues in the databrickslabs/terraform-provider-databricks GitHub repository.
Error: Failed to install provider
Issue: If you did not check in a terraform.lock.hcl file to your version control system, and you run the terraform init command, the following message appears: Failed to install provider. Additional output may include a message similar to the following:
Error while installing databrickslabs/databricks: v1.0.0: checksum list has no SHA-256 hash for "https://github.com/databricks/terraform-provider-databricks/releases/download/v1.0.0/terraform-provider-databricks_1.0.0_darwin_amd64.zip"
Cause: Your Terraform configurations reference outdated Databricks Terraform providers.
Solution:
-
Replace
databrickslabs/databrickswithdatabricks/databricksin all of your.tffiles.To automate these replacements, run the following Python command from the parent folder that contains the
.tffiles to update:Pythonpython3 -c "$(curl -Ls https://dbricks.co/updtfns)" -
Run the following Terraform command and then approve the changes when prompted:
Bashterraform state replace-provider databrickslabs/databricks databricks/databricksFor information about this command, see Command: state replace-provider in the Terraform documentation.
-
Verify the changes by running the following Terraform command:
Bashterraform init
Error: Failed to query available provider packages
Issue: If you did not check in a terraform.lock.hcl file to your version control system, and you run the terraform init command, the following message appears: Failed to query available provider packages.
Cause: Your Terraform configurations reference outdated Databricks Terraform providers.
Solution: Follow the solution instructions in Error: Failed to install provider.
Enable logging
To help you troubleshoot issue, the Databricks Terraform provider outputs logs that you can enable by setting the TF_LOG environment variable to DEBUG or any other log level that Terraform supports.
By default, logs are sent to stderr. To send logs to a file, set the TF_LOG_PATH environment variable to the target file path.
For example, you can run the following command to enable logging at the debug level, and to output logs in monochrome format to a file named tf.log relative to the current working directory, while the terraform apply command runs:
TF_LOG=DEBUG TF_LOG_PATH=tf.log terraform apply -no-color
For more information about Terraform logging, see Debugging Terraform.