Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated byovpc network config for GCP #1748

Merged
merged 7 commits into from
Dec 22, 2022

Conversation

stikkireddy
Copy link
Contributor

@stikkireddy stikkireddy commented Nov 10, 2022

  • [ ] create doc updates/guide updates
  • test creating mws for aws with older version and then upgrade and see impact on previous state
  • unit tests

Attempts to resolve #1393

byovpc example:

variable "databricks_account_id" {
  default = "myaccount-id"
}

variable "google_project" {
  default = "my-project"
}

terraform {
  required_providers {
    google = {
      source = "hashicorp/google"
      version = "4.37.0"
    }
    databricks = {
      source = "databricks/databricks"
      version = "1.6.5" # compile and install it as a new version
    }

  }
}


provider "google" {
  project     = "my-project"
  region      = "us-central1"
  credentials = ".../somecredfile.json"
}

provider "databricks" {
  host = "https://accounts.gcp.databricks.com"
  google_credentials = ".../somecredfile.json"
}

resource "random_string" "suffix" {
  special = false
  upper   = false
  length  = 6
}

resource "google_compute_network" "dbx_private_vpc" {
  project                 = var.google_project
  name                    = "tf-network-${random_string.suffix.result}"
  auto_create_subnetworks = false
#  mtu                     = 1460
}

resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges" {
  name          = "test-dbx-${random_string.suffix.result}"
  ip_cidr_range = "10.0.0.0/16"
  region        = "us-central1"
  network       = google_compute_network.dbx_private_vpc.id
  secondary_ip_range {
    range_name    = "pods"
    ip_cidr_range = "10.1.0.0/16"
  }
  secondary_ip_range {
    range_name    = "svc"
    ip_cidr_range = "10.2.0.0/20"
  }
  private_ip_google_access = true
}

resource "google_compute_router" "router" {
  name    = "my-router"
  region  = google_compute_subnetwork.network-with-private-secondary-ip-ranges.region
  network = google_compute_network.dbx_private_vpc.id
}

resource "google_compute_router_nat" "nat" {
  name                               = "my-router-nat"
  router                             = google_compute_router.router.name
  region                             = google_compute_router.router.region
  nat_ip_allocate_option             = "AUTO_ONLY"
  source_subnetwork_ip_ranges_to_nat = "ALL_SUBNETWORKS_ALL_IP_RANGES"
}

resource "databricks_mws_networks" "this" {
  account_id     = var.databricks_account_id
  network_name = "test-demo-${random_string.suffix.result}"
  gcp_network_info {
    network_project_id = var.google_project
    vpc_id = google_compute_network.dbx_private_vpc.name
    subnet_id = google_compute_subnetwork.network-with-private-secondary-ip-ranges.name
    subnet_region = google_compute_subnetwork.network-with-private-secondary-ip-ranges.region
    pod_ip_range_name = "pods"
    service_ip_range_name = "svc"
  }
}

resource "databricks_mws_workspaces" "this" {
 account_id     = var.databricks_account_id
 workspace_name = "tf-demo-test-${random_string.suffix.result}"
 location       = google_compute_subnetwork.network-with-private-secondary-ip-ranges.region
   cloud_resource_bucket {
     gcp {
       project_id = var.google_project
     }
   }
  network {
    network_id = databricks_mws_networks.this.network_id
    gcp_common_network_config {
      gke_connectivity_type = "PRIVATE_NODE_PUBLIC_MASTER"
      gke_cluster_master_ip_range = "10.3.0.0/28"
    }
  }
  depends_on = [google_compute_router_nat.nat]
}

SubnetCIDR string `json:"subnet_cidr"`
GKEClusterPodIPRange string `json:"gke_cluster_pod_ip_range"`
GKEClusterServiceIPRange string `json:"gke_cluster_service_ip_range"`
SubnetCIDR string `json:"subnet_cidr" tf:"force_new"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please do one space instead of two

Copy link
Contributor

@alexott alexott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks good

@nfx
Copy link
Contributor

nfx commented Nov 21, 2022

Following up - is this issue still relevant?

1 similar comment
@nfx
Copy link
Contributor

nfx commented Dec 1, 2022

Following up - is this issue still relevant?

@martinzuern
Copy link
Contributor

This feature is highly relevant for me. Is there anything I can do to move this forward? @nfx @stikkireddy

@yanw2
Copy link

yanw2 commented Dec 7, 2022

We need this feature for my current client. Can you please advise when it is available to use? Thank you.

@nfx
Copy link
Contributor

nfx commented Dec 7, 2022

@martinzuern @yanw2 we cannot merge this without an acceptance test

@yanw2
Copy link

yanw2 commented Dec 7, 2022

@nfx - Thank you for your reply. Can you please advise ETC if possible? Thanks.

@nfx
Copy link
Contributor

nfx commented Dec 7, 2022

etc?

@yanw2
Copy link

yanw2 commented Dec 7, 2022

Sorry, I mean "Estimate to Complete" :)

@mahmuzicamel
Copy link

Is this pull request still a work in progress? Do you have any infos for us when it is available to use, since it is a kind of big relevance for my client? Thank you

@martinzuern
Copy link
Contributor

@nfx what would you need for said acceptance test? Anything I can do to help here?

@stikkireddy stikkireddy marked this pull request as ready for review December 16, 2022 17:44
@stikkireddy stikkireddy requested a review from nfx December 16, 2022 17:44
@codecov-commenter
Copy link

Codecov Report

Merging #1748 (d99015a) into master (1ee4ba8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1748   +/-   ##
=======================================
  Coverage   90.15%   90.15%           
=======================================
  Files         142      142           
  Lines       11377    11382    +5     
=======================================
+ Hits        10257    10262    +5     
  Misses        711      711           
  Partials      409      409           
Impacted Files Coverage Δ
mws/resource_mws_workspaces.go 90.64% <ø> (ø)
mws/resource_mws_networks.go 83.60% <100.00%> (+1.46%) ⬆️

@nfx
Copy link
Contributor

nfx commented Dec 16, 2022

acceptance tests passed

@nfx nfx enabled auto-merge (squash) December 22, 2022 15:35
@nfx nfx merged commit 3c41d01 into databricks:master Dec 22, 2022
@yanw2
Copy link

yanw2 commented Jan 10, 2023

Hi @nfx, great thanks for fixing this. Can you please advise when you can publish this feature as a new release? It looks like it isn't included in the v1.7.0 release. Thank you.

nfx added a commit that referenced this pull request Jan 10, 2023
# Version changelog

### 1.8.0

 * Added support for GCP (Public Preview) with state upgraders for [databricks_mws_workspaces](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/mws_workspaces) ([#1871](#1871), [#1886](#1886), [#1748](#1748), [#1879](#1879)).
 * Added documentation for [databricks_permission_assignment](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/permission_assignment) ([#1880](#1880)).
 * Added `azure_attributes` to clusters in [databricks_pipeline](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/pipeline) resource ([#1854](#1854)).
 * Added [databricks_instance_pool](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/instance_pool) data source ([#1907](#1907)).
 * Added [databricks_provider](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/provider) resource for Delta Sharing ([#1572](#1572)).
 * Added acceptance tests for [databricks_cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/cluster) data and [databricks_sql_endpoint](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/sql_endpoint) data ([#1882](#1882)).
 * Added search by name for [databricks_cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/cluster) data source ([#1901](#1901)).
 * Added support for sparse checkouts in the [databricks_repo](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/repo) ([#1869](#1869)).
 * Added `config_reference` attribute to [databricks_secret](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/secret) for easier reference from Spark configuration ([#1898](#1898)).
 * Added `datarbicks_directory` data source ([#1902](#1902)).
 * Extended [databricks_catalog](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/catalog) resource to support Delta Sharing Catalog ([#1887](#1887)).
 * Improved [databricks_metastore_assignment](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/metastore_assignment) resource ([#1900](#1900)).
 * Improved [databricks_grants](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/grants) error messages ([#1888](#1888)).
 * Improved [databricks_group](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group) documentation ([#1816](#1816)).
 * Improved `data_security_mode` documentation for [databricks_cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/cluster) ([#1830](#1830)).
 * Replace the incorrect `id` attribute with the correct `sp_id` in service principal data source docs example ([#1873](#1873)).
 * Use NVMe disk size for selection in the [databricks_node_type](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/node_type) data source ([#1856](#1856)).
 * Allowed to override resource ID for specific data source ([#1885](#1885)).

Experimental Resource Exporter

 * Added command-line flag to export all users and service principals ([#1893](#1893)).
 * Added emit for secret scopes from Spark Conf and Env Vars ([#1897](#1897)).
 * Fixed issue with exporting of resources with simple name ([#1891](#1891)).
 * Generate references that are matching only to a prefix ([#1890](#1890)).
 * Updated list of supported services and associated resources ([#1894](#1894)).
 * Use [databricks_group_role](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_role) instead of deprecated [databricks_group_instance_profile](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_instance_profile) ([#1905](#1905)).
 * Use `dbfs_path` as reference for init scripts in clusters ([#1892](#1892)).
 * Logging improvements ([#1895](#1895)).

Updated dependency versions:

 * Bump google.golang.org/api from 0.104.0 to 0.105.0 ([#1863](#1863)).
@nfx nfx mentioned this pull request Jan 10, 2023
nfx added a commit that referenced this pull request Jan 10, 2023
# Version changelog

### 1.8.0

 * Added support for GCP (Public Preview) with state upgraders for [databricks_mws_workspaces](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/mws_workspaces) ([#1871](#1871), [#1886](#1886), [#1748](#1748), [#1879](#1879)).
 * Added documentation for [databricks_permission_assignment](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/permission_assignment) ([#1880](#1880)).
 * Added `azure_attributes` to clusters in [databricks_pipeline](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/pipeline) resource ([#1854](#1854)).
 * Added [databricks_instance_pool](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/instance_pool) data source ([#1907](#1907)).
 * Added [databricks_provider](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/provider) resource for Delta Sharing ([#1572](#1572)).
 * Added acceptance tests for [databricks_cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/cluster) data and [databricks_sql_endpoint](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/sql_endpoint) data ([#1882](#1882)).
 * Added search by name for [databricks_cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/cluster) data source ([#1901](#1901)).
 * Added support for sparse checkouts in the [databricks_repo](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/repo) ([#1869](#1869)).
 * Added `config_reference` attribute to [databricks_secret](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/secret) for easier reference from Spark configuration ([#1898](#1898)).
 * Added `datarbicks_directory` data source ([#1902](#1902)).
 * Extended [databricks_catalog](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/catalog) resource to support Delta Sharing Catalog ([#1887](#1887)).
 * Improved [databricks_metastore_assignment](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/metastore_assignment) resource ([#1900](#1900)).
 * Improved [databricks_grants](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/grants) error messages ([#1888](#1888)).
 * Improved [databricks_group](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group) documentation ([#1816](#1816)).
 * Improved `data_security_mode` documentation for [databricks_cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/cluster) ([#1830](#1830)).
 * Replace the incorrect `id` attribute with the correct `sp_id` in service principal data source docs example ([#1873](#1873)).
 * Use NVMe disk size for selection in the [databricks_node_type](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/node_type) data source ([#1856](#1856)).
 * Allowed to override resource ID for specific data source ([#1885](#1885)).

Experimental Resource Exporter

 * Added command-line flag to export all users and service principals ([#1893](#1893)).
 * Added emit for secret scopes from Spark Conf and Env Vars ([#1897](#1897)).
 * Fixed issue with exporting of resources with simple name ([#1891](#1891)).
 * Generate references that are matching only to a prefix ([#1890](#1890)).
 * Updated list of supported services and associated resources ([#1894](#1894)).
 * Use [databricks_group_role](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_role) instead of deprecated [databricks_group_instance_profile](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_instance_profile) ([#1905](#1905)).
 * Use `dbfs_path` as reference for init scripts in clusters ([#1892](#1892)).
 * Logging improvements ([#1895](#1895)).

Updated dependency versions:

 * Bump google.golang.org/api from 0.104.0 to 0.105.0 ([#1863](#1863)).
michael-berk pushed a commit to michael-berk/terraform-provider-databricks that referenced this pull request Feb 15, 2023
michael-berk pushed a commit to michael-berk/terraform-provider-databricks that referenced this pull request Feb 15, 2023
# Version changelog

### 1.8.0

 * Added support for GCP (Public Preview) with state upgraders for [databricks_mws_workspaces](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/mws_workspaces) ([databricks#1871](databricks#1871), [databricks#1886](databricks#1886), [databricks#1748](databricks#1748), [databricks#1879](databricks#1879)).
 * Added documentation for [databricks_permission_assignment](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/permission_assignment) ([databricks#1880](databricks#1880)).
 * Added `azure_attributes` to clusters in [databricks_pipeline](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/pipeline) resource ([databricks#1854](databricks#1854)).
 * Added [databricks_instance_pool](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/instance_pool) data source ([databricks#1907](databricks#1907)).
 * Added [databricks_provider](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/provider) resource for Delta Sharing ([databricks#1572](databricks#1572)).
 * Added acceptance tests for [databricks_cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/cluster) data and [databricks_sql_endpoint](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/sql_endpoint) data ([databricks#1882](databricks#1882)).
 * Added search by name for [databricks_cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/cluster) data source ([databricks#1901](databricks#1901)).
 * Added support for sparse checkouts in the [databricks_repo](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/repo) ([databricks#1869](databricks#1869)).
 * Added `config_reference` attribute to [databricks_secret](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/secret) for easier reference from Spark configuration ([databricks#1898](databricks#1898)).
 * Added `datarbicks_directory` data source ([databricks#1902](databricks#1902)).
 * Extended [databricks_catalog](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/catalog) resource to support Delta Sharing Catalog ([databricks#1887](databricks#1887)).
 * Improved [databricks_metastore_assignment](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/metastore_assignment) resource ([databricks#1900](databricks#1900)).
 * Improved [databricks_grants](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/grants) error messages ([databricks#1888](databricks#1888)).
 * Improved [databricks_group](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group) documentation ([databricks#1816](databricks#1816)).
 * Improved `data_security_mode` documentation for [databricks_cluster](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/cluster) ([databricks#1830](databricks#1830)).
 * Replace the incorrect `id` attribute with the correct `sp_id` in service principal data source docs example ([databricks#1873](databricks#1873)).
 * Use NVMe disk size for selection in the [databricks_node_type](https://registry.terraform.io/providers/databricks/databricks/latest/docs/data-sources/node_type) data source ([databricks#1856](databricks#1856)).
 * Allowed to override resource ID for specific data source ([databricks#1885](databricks#1885)).

Experimental Resource Exporter

 * Added command-line flag to export all users and service principals ([databricks#1893](databricks#1893)).
 * Added emit for secret scopes from Spark Conf and Env Vars ([databricks#1897](databricks#1897)).
 * Fixed issue with exporting of resources with simple name ([databricks#1891](databricks#1891)).
 * Generate references that are matching only to a prefix ([databricks#1890](databricks#1890)).
 * Updated list of supported services and associated resources ([databricks#1894](databricks#1894)).
 * Use [databricks_group_role](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_role) instead of deprecated [databricks_group_instance_profile](https://registry.terraform.io/providers/databricks/databricks/latest/docs/resources/group_instance_profile) ([databricks#1905](databricks#1905)).
 * Use `dbfs_path` as reference for init scripts in clusters ([databricks#1892](databricks#1892)).
 * Logging improvements ([databricks#1895](databricks#1895)).

Updated dependency versions:

 * Bump google.golang.org/api from 0.104.0 to 0.105.0 ([databricks#1863](databricks#1863)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add support for byo vpc based workspace creation on gcp
7 participants