diff --git a/google-bigquery.yml b/google-bigquery.yml deleted file mode 100644 index 18e76893..00000000 --- a/google-bigquery.yml +++ /dev/null @@ -1,150 +0,0 @@ -# Copyright 2018 the Service Broker Project Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http:#www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. ---- -version: 1 -name: csb-google-bigquery -id: 3d4b5b0c-931d-11ea-a02b-cb6a223f4ab2 -description: Beta - A fast, economical and fully managed data warehouse for large-scale data analytics. -display_name: Google Big Query (Beta) -image_url: file://service-images/csb.png -documentation_url: https://docs.vmware.com/en/Cloud-Service-Broker-for-VMware-Tanzu/index.html -provider_display_name: VMware -support_url: https://cloud.google.com/support/ -tags: [gcp, bigquery, beta] -plans: -- name: standard - id: 481212b0-931d-11ea-b054-535fa8f91417 - description: 'Beta - Pay as you go' - display_name: "standard (Beta)" -provision: - plan_inputs: [] - user_inputs: - - field_name: credentials - type: string - details: GCP credentials - default: ${config("gcp.credentials")} - - field_name: project - type: string - details: GCP project - default: ${config("gcp.project")} - - field_name: instance_name - type: string - details: Name for your mysql instance - default: csb-bigquery-${request.instance_id} - constraints: - maxLength: 98 - minLength: 6 - pattern: ^[a-z][a-z0-9-]+$ - - field_name: region - type: string - details: The region of the bigquery instance. - default: us-central1 - constraints: - examples: - - us-central1 - - asia-northeast1 - pattern: ^[a-z][a-z0-9-]+$ - prohibit_update: true - # - field_name: authorized_network - # type: string - # details: The name of the Google Compute Engine network to which the instance is connected. If left unspecified, the network named 'default' will be used. - # default: default - # prohibit_update: true - # - field_name: authorized_network_id - # type: string - # details: The id of the Google Compute Engine network to which the instance is connected. - # default: "" - # prohibit_update: true - computed_inputs: - - name: labels - default: ${json.marshal(request.default_labels)} - overwrite: true - type: object - template_refs: - provider: terraform/bigquery/provision/provider.tf - versions: terraform/bigquery/provision/versions.tf - main: terraform/bigquery/provision/main.tf - variables: terraform/bigquery/provision/variables.tf - outputs: terraform/bigquery/provision/outputs.tf - outputs: - - field_name: dataset_id - type: string - details: The name of the database. -bind: - plan_inputs: [] - user_inputs: - - field_name: role - type: string - details: The role that should be applied. - default: bigquery.user - - field_name: credentials - type: string - details: GCP credentials - default: ${config("gcp.credentials")} - - field_name: project - type: string - details: GCP project - default: ${config("gcp.project")} - computed_inputs: - - name: dataset_id - type: string - default: ${instance.details["dataset_id"]} - overwrite: true - - name: service_account_name - default: ${str.truncate(20, "pcf-binding-${request.binding_id}")} - overwrite: true - - name: service_account_display_name - default: "" - overwrite: true - template_refs: - provider: terraform/bigquery/bind/provider.tf - main: terraform/bigquery/bind/main.tf - variables: terraform/bigquery/bind/variables.tf - data: terraform/bigquery/bind/data.tf - outputs: terraform/bigquery/bind/outputs.tf - outputs: - - required: true - field_name: Email - type: string - details: Email address of the service account. - - required: true - field_name: Name - type: string - details: The name of the service account. - - required: true - field_name: PrivateKeyData - type: string - details: Service account private key data. Base64 encoded JSON. - - required: true - field_name: ProjectId - type: string - details: ID of the project that owns the service account. - - required: true - field_name: UniqueId - type: string - details: Unique and stable ID of the service account. - - field_name: dataset_id - type: string - details: The name of the BigQuery dataset. - - required: true - field_name: Credentials - type: string - details: Credentials of the service account. -examples: -- name: general configuration - description: Create a Pay as you go bigquery instance - plan_id: 481212b0-931d-11ea-b054-535fa8f91417 - provision_params: {} - bind_params: {} - bind_can_fail: true diff --git a/integration-tests/bigquery_test.go b/integration-tests/bigquery_test.go deleted file mode 100644 index 88e08f07..00000000 --- a/integration-tests/bigquery_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package integration_test - -import ( - testframework "github.com/cloudfoundry/cloud-service-broker/v2/brokerpaktestframework" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gstruct" -) - -const ( - bigqueryServiceName = "csb-google-bigquery" - bigqueryServiceID = "3d4b5b0c-931d-11ea-a02b-cb6a223f4ab2" - bigqueryServiceDisplayName = "Google Big Query (Beta)" - bigqueryServiceDescription = "Beta - A fast, economical and fully managed data warehouse for large-scale data analytics." - bigqueryServiceSupportURL = "https://cloud.google.com/support/" - bigqueryStandardPlanName = "standard" - bigqueryStandardPlanID = "481212b0-931d-11ea-b054-535fa8f91417" -) - -var _ = Describe("BigQuery", func() { - BeforeEach(func() { - Expect(mockTerraform.SetTFState([]testframework.TFStateValue{})).To(Succeed()) - }) - - AfterEach(func() { - Expect(mockTerraform.Reset()).To(Succeed()) - }) - - It("publishes in the catalog", func() { - catalog, err := broker.Catalog() - Expect(err).NotTo(HaveOccurred()) - - service := testframework.FindService(catalog, bigqueryServiceName) - Expect(service.ID).To(Equal(bigqueryServiceID)) - Expect(service.Description).To(Equal(bigqueryServiceDescription)) - Expect(service.Tags).To(ConsistOf("gcp", "bigquery", "beta")) - Expect(service.Metadata.ImageUrl).To(ContainSubstring("data:image/png;base64,")) - Expect(service.Metadata.DisplayName).To(Equal(bigqueryServiceDisplayName)) - Expect(service.Metadata.DocumentationUrl).To(Equal(cloudServiceBrokerDocumentationURL)) - Expect(service.Metadata.ProviderDisplayName).To(Equal(providerDisplayName)) - Expect(service.Metadata.SupportUrl).To(Equal(bigqueryServiceSupportURL)) - Expect(service.Plans).To( - ConsistOf( - MatchFields(IgnoreExtras, Fields{ - ID: Equal(bigqueryStandardPlanID), - Name: Equal(bigqueryStandardPlanName), - }), - ), - ) - }) - - Describe("provisioning", func() { - It("should check region constraints", func() { - _, err := broker.Provision(bigqueryServiceName, "standard", map[string]any{"region": "-Asia-northeast1"}) - Expect(err).To(MatchError(ContainSubstring("region: Does not match pattern '^[a-z][a-z0-9-]+$'"))) - }) - }) - - Describe("updating instance", func() { - var instanceID string - - BeforeEach(func() { - var err error - instanceID, err = broker.Provision(bigqueryServiceName, "standard", nil) - - Expect(err).NotTo(HaveOccurred()) - Expect(mockTerraform.Reset()).To(Succeed()) - }) - - It("should prevent updating properties flagged as `prohibit_update` because it can result in the recreation of the service instance and lost data", func() { - err := broker.Update(instanceID, bigqueryServiceName, "standard", map[string]any{"region": "asia-southeast1"}) - - Expect(err).To(MatchError( - ContainSubstring( - "attempt to update parameter that may result in service instance re-creation and data loss", - ), - )) - }) - }) -}) diff --git a/manifest.yml b/manifest.yml index 96f14a1f..bd825614 100644 --- a/manifest.yml +++ b/manifest.yml @@ -41,5 +41,4 @@ service_definitions: - google-storage.yml - google-mysql.yml - google-postgresql.yml -- google-bigquery.yml - google-stackdriver-trace.yml diff --git a/terraform/bigquery/bind/data.tf b/terraform/bigquery/bind/data.tf deleted file mode 100644 index 76aa32df..00000000 --- a/terraform/bigquery/bind/data.tf +++ /dev/null @@ -1,10 +0,0 @@ -locals { - members = format("serviceAccount:%s", google_service_account.account.email) -} - -data "google_iam_policy" "database_iam_policy" { - binding { - role = var.role - members = [local.members] - } -} diff --git a/terraform/bigquery/bind/main.tf b/terraform/bigquery/bind/main.tf deleted file mode 100644 index f7b2c1d9..00000000 --- a/terraform/bigquery/bind/main.tf +++ /dev/null @@ -1,14 +0,0 @@ -resource "google_service_account" "account" { - account_id = var.service_account_name - display_name = var.service_account_display_name -} -resource "google_service_account_key" "key" { - service_account_id = google_service_account.account.name -} - -resource "google_bigquery_dataset_access" "access" { - project = var.project - dataset_id = var.dataset_id - role = "roles/${var.role}" - user_by_email = google_service_account.account.email -} diff --git a/terraform/bigquery/bind/outputs.tf b/terraform/bigquery/bind/outputs.tf deleted file mode 100644 index c47a55d1..00000000 --- a/terraform/bigquery/bind/outputs.tf +++ /dev/null @@ -1,13 +0,0 @@ -output "Name" { value = google_service_account.account.name } -output "Email" { value = google_service_account.account.email } -output "UniqueId" { value = google_service_account.account.unique_id } -output "PrivateKeyData" { - sensitive = true - value = google_service_account_key.key.private_key -} -output "ProjectId" { value = google_service_account.account.project } -output "dataset_id" { value = var.dataset_id } -output "Credentials" { - sensitive = true - value = base64decode(google_service_account_key.key.private_key) -} diff --git a/terraform/bigquery/bind/provider.tf b/terraform/bigquery/bind/provider.tf deleted file mode 100644 index e34e2155..00000000 --- a/terraform/bigquery/bind/provider.tf +++ /dev/null @@ -1,4 +0,0 @@ -provider "google" { - credentials = var.credentials - project = var.project -} diff --git a/terraform/bigquery/bind/variables.tf b/terraform/bigquery/bind/variables.tf deleted file mode 100644 index f1cb6141..00000000 --- a/terraform/bigquery/bind/variables.tf +++ /dev/null @@ -1,9 +0,0 @@ -variable "dataset_id" { type = string } -variable "role" { type = string } -variable "service_account_name" { type = string } -variable "service_account_display_name" { type = string } -variable "project" { type = string } -variable "credentials" { - type = string - sensitive = true -} diff --git a/terraform/bigquery/bind/versions.tf b/terraform/bigquery/bind/versions.tf deleted file mode 100644 index 29e387d6..00000000 --- a/terraform/bigquery/bind/versions.tf +++ /dev/null @@ -1,8 +0,0 @@ -terraform { - required_providers { - google = { - source = "registry.terraform.io/hashicorp/google" - version = "~> 5" - } - } -} diff --git a/terraform/bigquery/provision/main.tf b/terraform/bigquery/provision/main.tf deleted file mode 100644 index dc268fc9..00000000 --- a/terraform/bigquery/provision/main.tf +++ /dev/null @@ -1,23 +0,0 @@ - - -resource "google_bigquery_dataset" "csb_dataset" { - dataset_id = replace(var.instance_name, "-", "") - friendly_name = var.instance_name - location = var.region - access { - role = "OWNER" - special_group = "projectOwners" - } - access { - role = "WRITER" - special_group = "projectWriters" - } - access { - role = "READER" - special_group = "allAuthenticatedUsers" - } - - lifecycle { - prevent_destroy = true - } -} diff --git a/terraform/bigquery/provision/outputs.tf b/terraform/bigquery/provision/outputs.tf deleted file mode 100644 index 5bd22871..00000000 --- a/terraform/bigquery/provision/outputs.tf +++ /dev/null @@ -1 +0,0 @@ -output "dataset_id" { value = google_bigquery_dataset.csb_dataset.dataset_id } diff --git a/terraform/bigquery/provision/provider.tf b/terraform/bigquery/provision/provider.tf deleted file mode 100644 index c9088844..00000000 --- a/terraform/bigquery/provision/provider.tf +++ /dev/null @@ -1,5 +0,0 @@ -provider "google" { - credentials = var.credentials - project = var.project - region = var.region -} diff --git a/terraform/bigquery/provision/variables.tf b/terraform/bigquery/provision/variables.tf deleted file mode 100644 index d55c2d70..00000000 --- a/terraform/bigquery/provision/variables.tf +++ /dev/null @@ -1,8 +0,0 @@ -variable "credentials" { - type = string - sensitive = true -} -variable "project" { type = string } -variable "labels" { type = map(any) } -variable "region" { type = string } -variable "instance_name" { type = string } diff --git a/terraform/bigquery/provision/versions.tf b/terraform/bigquery/provision/versions.tf deleted file mode 100644 index 29e387d6..00000000 --- a/terraform/bigquery/provision/versions.tf +++ /dev/null @@ -1,8 +0,0 @@ -terraform { - required_providers { - google = { - source = "registry.terraform.io/hashicorp/google" - version = "~> 5" - } - } -}