Skip to content

Instantly share code, notes, and snippets.

@gerrytan
Last active August 23, 2024 00:19
Show Gist options
  • Save gerrytan/4e300ccb11a74ca2cb5a82506594eedf to your computer and use it in GitHub Desktop.
Save gerrytan/4e300ccb11a74ca2cb5a82506594eedf to your computer and use it in GitHub Desktop.
azurerm #26935 reproduction
~/projects/learning/terraform-playground/gh-26935-simple (master) » terraform apply gtan@twisties
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
<= read (data resources)
Terraform will perform the following actions:
# data.databricks_node_type.smallest will be read during apply
# (depends on a resource or a module with changes pending)
<= data "databricks_node_type" "smallest" {
+ gb_per_core = 1
+ id = (known after apply)
+ local_disk = true
+ min_cores = 16
}
# data.databricks_spark_version.latest_lts will be read during apply
# (depends on a resource or a module with changes pending)
<= data "databricks_spark_version" "latest_lts" {
+ id = (known after apply)
+ long_term_support = true
}
# azurerm_databricks_workspace.example_1 will be created
+ resource "azurerm_databricks_workspace" "example_1" {
+ customer_managed_key_enabled = false
+ disk_encryption_set_id = (known after apply)
+ id = (known after apply)
+ infrastructure_encryption_enabled = false
+ location = "eastus2"
+ managed_disk_identity = (known after apply)
+ managed_resource_group_id = (known after apply)
+ managed_resource_group_name = (known after apply)
+ name = "gtan-26935-simple-2231-workspace"
+ network_security_group_rules_required = (known after apply)
+ public_network_access_enabled = true
+ resource_group_name = "gtan-26935-simple-2231-rg"
+ sku = "premium"
+ storage_account_identity = (known after apply)
+ tags = {
+ "Creator" = "tangerry@microsoft.com"
}
+ workspace_id = (known after apply)
+ workspace_url = (known after apply)
+ custom_parameters (known after apply)
}
# azurerm_resource_group.rg will be created
+ resource "azurerm_resource_group" "rg" {
+ id = (known after apply)
+ location = "eastus2"
+ name = "gtan-26935-simple-2231-rg"
+ tags = {
+ "Creator" = "tangerry@microsoft.com"
+ "DateCreated" = "2024-08-22T07:25:19Z"
}
}
# databricks_cluster.my_cluster will be created
+ resource "databricks_cluster" "my_cluster" {
+ autotermination_minutes = 20
+ cluster_id = (known after apply)
+ cluster_name = "gtan-26935-simple-2231-cluster"
+ default_tags = (known after apply)
+ driver_instance_pool_id = (known after apply)
+ driver_node_type_id = (known after apply)
+ enable_elastic_disk = (known after apply)
+ enable_local_disk_encryption = (known after apply)
+ id = (known after apply)
+ node_type_id = (known after apply)
+ num_workers = 2
+ spark_version = (known after apply)
+ state = (known after apply)
+ url = (known after apply)
}
Plan: 3 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ databricks_node_type_id = (known after apply)
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
azurerm_resource_group.rg: Creating...
azurerm_resource_group.rg: Still creating... [10s elapsed]
azurerm_resource_group.rg: Creation complete after 12s [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-simple-2231-rg]
azurerm_databricks_workspace.example_1: Creating...
azurerm_databricks_workspace.example_1: Still creating... [10s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [20s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [30s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [40s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [50s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [1m0s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [1m10s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [1m20s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [1m30s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [1m40s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [1m50s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [2m0s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [2m10s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [2m20s elapsed]
azurerm_databricks_workspace.example_1: Still creating... [2m30s elapsed]
azurerm_databricks_workspace.example_1: Creation complete after 2m36s [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-simple-2231-rg/providers/Microsoft.Databricks/workspaces/gtan-26935-simple-2231-workspace]
data.databricks_node_type.smallest: Reading...
data.databricks_spark_version.latest_lts: Reading...
data.databricks_spark_version.latest_lts: Read complete after 5s [id=15.4.x-scala2.12]
data.databricks_node_type.smallest: Still reading... [10s elapsed]
data.databricks_node_type.smallest: Still reading... [20s elapsed]
data.databricks_node_type.smallest: Read complete after 27s [id=Standard_F16s]
databricks_cluster.my_cluster: Creating...
databricks_cluster.my_cluster: Still creating... [10s elapsed]
databricks_cluster.my_cluster: Still creating... [20s elapsed]
databricks_cluster.my_cluster: Still creating... [30s elapsed]
databricks_cluster.my_cluster: Still creating... [40s elapsed]
databricks_cluster.my_cluster: Still creating... [50s elapsed]
databricks_cluster.my_cluster: Still creating... [1m0s elapsed]
databricks_cluster.my_cluster: Still creating... [1m10s elapsed]
databricks_cluster.my_cluster: Still creating... [1m20s elapsed]
databricks_cluster.my_cluster: Still creating... [1m30s elapsed]
databricks_cluster.my_cluster: Still creating... [1m40s elapsed]
databricks_cluster.my_cluster: Still creating... [1m50s elapsed]
databricks_cluster.my_cluster: Still creating... [2m0s elapsed]
databricks_cluster.my_cluster: Still creating... [2m10s elapsed]
databricks_cluster.my_cluster: Still creating... [2m20s elapsed]
databricks_cluster.my_cluster: Still creating... [2m30s elapsed]
databricks_cluster.my_cluster: Still creating... [2m40s elapsed]
databricks_cluster.my_cluster: Still creating... [2m50s elapsed]
databricks_cluster.my_cluster: Still creating... [3m0s elapsed]
databricks_cluster.my_cluster: Still creating... [3m10s elapsed]
databricks_cluster.my_cluster: Still creating... [3m20s elapsed]
databricks_cluster.my_cluster: Still creating... [3m30s elapsed]
databricks_cluster.my_cluster: Still creating... [3m40s elapsed]
databricks_cluster.my_cluster: Still creating... [3m50s elapsed]
databricks_cluster.my_cluster: Still creating... [4m0s elapsed]
databricks_cluster.my_cluster: Still creating... [4m10s elapsed]
databricks_cluster.my_cluster: Still creating... [4m20s elapsed]
databricks_cluster.my_cluster: Still creating... [4m30s elapsed]
databricks_cluster.my_cluster: Still creating... [4m40s elapsed]
databricks_cluster.my_cluster: Still creating... [4m50s elapsed]
databricks_cluster.my_cluster: Still creating... [5m0s elapsed]
databricks_cluster.my_cluster: Still creating... [5m10s elapsed]
databricks_cluster.my_cluster: Still creating... [5m20s elapsed]
databricks_cluster.my_cluster: Still creating... [5m30s elapsed]
databricks_cluster.my_cluster: Still creating... [5m40s elapsed]
databricks_cluster.my_cluster: Still creating... [5m50s elapsed]
databricks_cluster.my_cluster: Still creating... [6m0s elapsed]
databricks_cluster.my_cluster: Still creating... [6m10s elapsed]
databricks_cluster.my_cluster: Still creating... [6m20s elapsed]
databricks_cluster.my_cluster: Still creating... [6m30s elapsed]
databricks_cluster.my_cluster: Still creating... [6m40s elapsed]
databricks_cluster.my_cluster: Still creating... [6m50s elapsed]
databricks_cluster.my_cluster: Still creating... [7m0s elapsed]
databricks_cluster.my_cluster: Still creating... [7m10s elapsed]
databricks_cluster.my_cluster: Still creating... [7m20s elapsed]
databricks_cluster.my_cluster: Still creating... [7m30s elapsed]
databricks_cluster.my_cluster: Still creating... [7m40s elapsed]
databricks_cluster.my_cluster: Still creating... [7m50s elapsed]
databricks_cluster.my_cluster: Still creating... [8m0s elapsed]
databricks_cluster.my_cluster: Still creating... [8m10s elapsed]
databricks_cluster.my_cluster: Still creating... [8m20s elapsed]
databricks_cluster.my_cluster: Still creating... [8m30s elapsed]
databricks_cluster.my_cluster: Creation complete after 8m34s [id=*********]
Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
Outputs:
databricks_node_type_id = "Standard_F16s"
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
databricks = {
source = "databricks/databricks"
version = "~>1.50.0"
}
}
}
provider "azurerm" {
features {}
}
provider "databricks" {
host = azurerm_databricks_workspace.example_1.workspace_url
}
locals {
prefix = "gtan-26935-simple-2231"
}
resource "azurerm_resource_group" "rg" {
name = "${local.prefix}-rg"
location = "eastus2"
tags = {
Creator = "tangerry@microsoft.com",
DateCreated = "2024-08-22T07:25:19Z"
}
}
resource "azurerm_databricks_workspace" "example_1" {
name = "${local.prefix}-workspace"
resource_group_name = azurerm_resource_group.rg.name
location = azurerm_resource_group.rg.location
sku = "premium"
public_network_access_enabled = true
tags = {
Creator = "tangerry@microsoft.com"
}
}
data "databricks_node_type" "smallest" {
local_disk = true
min_cores = 16
gb_per_core = 1
depends_on = [azurerm_databricks_workspace.example_1]
}
data "databricks_spark_version" "latest_lts" {
long_term_support = true
depends_on = [azurerm_databricks_workspace.example_1]
}
resource "databricks_cluster" "my_cluster" {
num_workers = 2
cluster_name = "${local.prefix}-cluster"
spark_version = data.databricks_spark_version.latest_lts.id
node_type_id = data.databricks_node_type.smallest.id
autotermination_minutes = 20
}
output "databricks_node_type_id" {
value = data.databricks_node_type.smallest.id
}
~/projects/learning/terraform-playground/gh-26935-vnet (master*) » terraform plan gtan@twisties
azurerm_resource_group.example: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint]
azurerm_network_security_group.example: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Network/networkSecurityGroups/gtan-26935-vnet-2251-nsg-databricks]
azurerm_virtual_network.example: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Network/virtualNetworks/gtan-26935-vnet-2251-vnet-databricks]
azurerm_subnet.public: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Network/virtualNetworks/gtan-26935-vnet-2251-vnet-databricks/subnets/gtan-26935-vnet-2251-sn-public]
azurerm_subnet.private: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Network/virtualNetworks/gtan-26935-vnet-2251-vnet-databricks/subnets/gtan-26935-vnet-2251-sn-private]
azurerm_subnet.endpoint: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Network/virtualNetworks/gtan-26935-vnet-2251-vnet-databricks/subnets/gtan-26935-vnet-2251-sn-private-endpoint]
azurerm_subnet_network_security_group_association.public: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Network/virtualNetworks/gtan-26935-vnet-2251-vnet-databricks/subnets/gtan-26935-vnet-2251-sn-public]
azurerm_subnet_network_security_group_association.private: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Network/virtualNetworks/gtan-26935-vnet-2251-vnet-databricks/subnets/gtan-26935-vnet-2251-sn-private]
azurerm_databricks_workspace.example: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Databricks/workspaces/gtan-26935-vnet-2251-DBW]
azurerm_private_endpoint.databricks: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Network/privateEndpoints/gtan-26935-vnet-2251-pe-databricks]
data.databricks_spark_version.latest_lts: Reading...
data.databricks_node_type.smallest: Reading...
data.azurerm_databricks_workspace_private_endpoint_connection.example: Reading...
azurerm_private_dns_zone.example: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Network/privateDnsZones/privatelink.azuredatabricks.net]
data.azurerm_databricks_workspace_private_endpoint_connection.example: Read complete after 1s [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Databricks/workspaces/gtan-26935-vnet-2251-DBW]
azurerm_private_dns_cname_record.example: Refreshing state... [id=/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint/providers/Microsoft.Network/privateDnsZones/privatelink.azuredatabricks.net/CNAME/adb-1689505042441137.17.azuredatabricks.net]
data.databricks_node_type.smallest: Read complete after 8s [id=Standard_D3_v2]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
~ update in-place
Terraform planned the following actions, but then encountered a problem:
# azurerm_resource_group.example will be updated in-place
~ resource "azurerm_resource_group" "example" {
id = "/subscriptions/0b1***********************/resourceGroups/gtan-26935-vnet-2251-databricks-private-endpoint"
name = "gtan-26935-vnet-2251-databricks-private-endpoint"
~ tags = {
- "Creator" = "tangerry@microsoft.com" -> null
- "DateCreated" = "2024-08-22T13:08:14Z" -> null
}
# (2 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
│ Warning: Argument is deprecated
│ with azurerm_subnet.endpoint,
│ on main.tf line 94, in resource "azurerm_subnet" "endpoint":
│ 94: private_endpoint_network_policies_enabled = false
│ `private_endpoint_network_policies_enabled` will be removed in favour of the property `private_endpoint_network_policies` in version 4.0 of the AzureRM Provider
│ (and one more similar warning elsewhere)
│ Error: cannot read spark version: cannot read data spark version: Unauthorized access to workspace: 168***********
│ with data.databricks_spark_version.latest_lts,
│ on main.tf line 175, in data "databricks_spark_version" "latest_lts":
│ 175: data "databricks_spark_version" "latest_lts" {
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~>3.0"
}
databricks = {
source = "databricks/databricks"
version = "~>1.50.0"
}
}
}
locals {
prefix = "gtan-26935-vnet-2251"
}
provider "azurerm" {
features {}
}
provider "databricks" {
host = azurerm_databricks_workspace.example.workspace_url
azure_workspace_resource_id = azurerm_databricks_workspace.example.id
}
data "azurerm_databricks_workspace_private_endpoint_connection" "example" {
workspace_id = azurerm_databricks_workspace.example.id
private_endpoint_id = azurerm_private_endpoint.databricks.id
}
resource "azurerm_resource_group" "example" {
name = "${local.prefix}-databricks-private-endpoint"
location = "eastus2"
}
resource "azurerm_virtual_network" "example" {
name = "${local.prefix}-vnet-databricks"
address_space = ["10.0.0.0/16"]
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}
resource "azurerm_subnet" "public" {
name = "${local.prefix}-sn-public"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.0.1.0/24"]
delegation {
name = "databricks-del-pub-${local.prefix}"
service_delegation {
actions = [
"Microsoft.Network/virtualNetworks/subnets/join/action",
"Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
"Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
]
name = "Microsoft.Databricks/workspaces"
}
}
}
resource "azurerm_subnet" "private" {
name = "${local.prefix}-sn-private"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.0.2.0/24"]
delegation {
name = "databricks-del-pri-${local.prefix}"
service_delegation {
actions = [
"Microsoft.Network/virtualNetworks/subnets/join/action",
"Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action",
"Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action",
]
name = "Microsoft.Databricks/workspaces"
}
}
}
resource "azurerm_subnet" "endpoint" {
name = "${local.prefix}-sn-private-endpoint"
resource_group_name = azurerm_resource_group.example.name
virtual_network_name = azurerm_virtual_network.example.name
address_prefixes = ["10.0.3.0/24"]
private_endpoint_network_policies_enabled = false
}
resource "azurerm_subnet_network_security_group_association" "private" {
subnet_id = azurerm_subnet.private.id
network_security_group_id = azurerm_network_security_group.example.id
}
resource "azurerm_subnet_network_security_group_association" "public" {
subnet_id = azurerm_subnet.public.id
network_security_group_id = azurerm_network_security_group.example.id
}
resource "azurerm_network_security_group" "example" {
name = "${local.prefix}-nsg-databricks"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}
resource "azurerm_databricks_workspace" "example" {
name = "${local.prefix}-DBW"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
sku = "premium"
managed_resource_group_name = "${local.prefix}-DBW-managed-private-endpoint"
public_network_access_enabled = false
network_security_group_rules_required = "NoAzureDatabricksRules"
custom_parameters {
no_public_ip = true
public_subnet_name = azurerm_subnet.public.name
private_subnet_name = azurerm_subnet.private.name
virtual_network_id = azurerm_virtual_network.example.id
public_subnet_network_security_group_association_id = azurerm_subnet_network_security_group_association.public.id
private_subnet_network_security_group_association_id = azurerm_subnet_network_security_group_association.private.id
}
tags = {
Environment = "Production"
Pricing = "Premium"
}
}
resource "azurerm_private_endpoint" "databricks" {
name = "${local.prefix}-pe-databricks"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
subnet_id = azurerm_subnet.endpoint.id
private_service_connection {
name = "${local.prefix}-psc"
is_manual_connection = false
private_connection_resource_id = azurerm_databricks_workspace.example.id
subresource_names = ["databricks_ui_api"]
}
}
resource "azurerm_private_dns_zone" "example" {
depends_on = [azurerm_private_endpoint.databricks]
name = "privatelink.azuredatabricks.net"
resource_group_name = azurerm_resource_group.example.name
}
resource "azurerm_private_dns_cname_record" "example" {
name = azurerm_databricks_workspace.example.workspace_url
zone_name = azurerm_private_dns_zone.example.name
resource_group_name = azurerm_resource_group.example.name
ttl = 300
record = "eastus2-c2.azuredatabricks.net"
}
data "databricks_node_type" "smallest" {
local_disk = true
min_cores = 16
gb_per_core = 1
depends_on = [azurerm_databricks_workspace.example]
}
data "databricks_spark_version" "latest_lts" {
long_term_support = true
depends_on = [azurerm_databricks_workspace.example]
}
# create a databricks cluster for git proxy
resource "databricks_cluster" "git_proxy" {
autotermination_minutes = 0
azure_attributes {
availability = "SPOT_WITH_FALLBACK_AZURE"
first_on_demand = 1
spot_bid_max_price = -1
}
cluster_name = "${local.prefix}-git-proxy-cluster-1"
custom_tags = {
"ResourceClass" = "SingleNode"
}
node_type_id = data.databricks_node_type.smallest.id
num_workers = 1
spark_version = data.databricks_spark_version.latest_lts.id
spark_conf = {
"spark.databricks.cluster.profile" : "singleNode",
"spark.master" : "local[*]",
}
spark_env_vars = {
"GIT_PROXY_ENABLE_SSL_VERIFICATION" : "False"
# "GIT_PROXY_HTTP_PROXY" : var.git_http_proxy,
}
timeouts {
create = "30m"
update = "30m"
delete = "30m"
}
}
output "databricks_workspace_private_endpoint_connection_workspace_id" {
value = data.azurerm_databricks_workspace_private_endpoint_connection.example.workspace_id
}
output "databricks_workspace_private_endpoint_connection_private_endpoint_id" {
value = data.azurerm_databricks_workspace_private_endpoint_connection.example.private_endpoint_id
}
output "databricks_workspace_private_endpoint_connection_name" {
value = data.azurerm_databricks_workspace_private_endpoint_connection.example.connections.0.name
}
output "databricks_workspace_private_endpoint_connection_workspace_private_endpoint_id" {
value = data.azurerm_databricks_workspace_private_endpoint_connection.example.connections.0.workspace_private_endpoint_id
}
output "databricks_workspace_private_endpoint_connection_status" {
value = data.azurerm_databricks_workspace_private_endpoint_connection.example.connections.0.status
}
output "databricks_workspace_private_endpoint_connection_description" {
value = data.azurerm_databricks_workspace_private_endpoint_connection.example.connections.0.description
}
output "databricks_workspace_private_endpoint_connection_action_required" {
value = data.azurerm_databricks_workspace_private_endpoint_connection.example.connections.0.action_required
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment