Skip to content

Commit

Permalink
Merge branch 'main' into psc_vpc
Browse files Browse the repository at this point in the history
  • Loading branch information
glasnt authored Dec 9, 2024
2 parents 58b8a21 + 53e67a1 commit 0801ebf
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 19 deletions.
29 changes: 29 additions & 0 deletions bigquery/bigquery_create_spanner_external_dataset/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2024 Google LLC
*
* 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.
*/
# [START bigquery_create_spanner_external_dataset]
resource "google_bigquery_dataset" "default" {
dataset_id = "my_external_dataset"
friendly_name = "My external dataset"
description = "This is a test description."
location = "US"
external_dataset_reference {
# The full identifier of your Spanner database.
external_source = "google-cloudspanner:/projects/my_project/instances/my_instance/databases/my_database"
# Must be empty for a Spanner external dataset.
connection = ""
}
}
# [END bigquery_create_spanner_external_dataset]
20 changes: 20 additions & 0 deletions bigquery/bigquery_create_spanner_external_dataset/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Google LLC
#
# 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.

apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: bigquery_create_spanner_external_dataset
spec:
skip: true
61 changes: 61 additions & 0 deletions gke/autopilot/config_sync/git/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* Copyright 2024 Google LLC
*
* 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.
*/

# [START gke_autopilot_config_sync_git]
data "google_project" "default" {}

resource "google_container_cluster" "default" {
name = "gke-autopilot-basic"
location = "us-central1"

fleet {
project = data.google_project.default.project_id
}

enable_autopilot = true

# Set `deletion_protection` to `true` will ensure that one cannot
# accidentally delete this instance by use of Terraform.
deletion_protection = false
}

resource "google_gke_hub_feature" "configmanagement_feature" {
name = "configmanagement"
location = "global"
}

resource "google_gke_hub_feature_membership" "configmanagement_feature_member" {
location = "global"

feature = google_gke_hub_feature.configmanagement_feature.name
membership = google_container_cluster.default.fleet[0].membership_id
membership_location = google_container_cluster.default.fleet[0].membership_location

configmanagement {
config_sync {
# The field `enabled` was introduced in Terraform version 5.41.0, and
# needs to be set to `true` explicitly to install Config Sync.
enabled = true
git {
sync_repo = "REPO"
sync_branch = "BRANCH"
policy_dir = "DIRECTORY"
secret_type = "SECRET"
}
}
}
}
# [END gke_autopilot_config_sync_git]
21 changes: 21 additions & 0 deletions gke/autopilot/config_sync/git/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Google LLC
#
# 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.

# The kubernetes_manifest resource can only be used with pre-existing clusters.
apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: config_sync_git
spec:
skip: true
60 changes: 60 additions & 0 deletions gke/autopilot/config_sync/oci/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* Copyright 2024 Google LLC
*
* 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.
*/

# [START gke_autopilot_config_sync_oci]
data "google_project" "default" {}

resource "google_container_cluster" "default" {
name = "gke-autopilot-basic"
location = "us-central1"

fleet {
project = data.google_project.default.project_id
}

enable_autopilot = true

# Set `deletion_protection` to `true` will ensure that one cannot
# accidentally delete this instance by use of Terraform.
deletion_protection = false
}

resource "google_gke_hub_feature" "configmanagement_feature" {
name = "configmanagement"
location = "global"
}

resource "google_gke_hub_feature_membership" "configmanagement_feature_member" {
location = "global"

feature = google_gke_hub_feature.configmanagement_feature.name
membership = google_container_cluster.default.fleet[0].membership_id
membership_location = google_container_cluster.default.fleet[0].membership_location

configmanagement {
config_sync {
# The field `enabled` was introduced in Terraform version 5.41.0, and
# needs to be set to `true` explicitly to install Config Sync.
enabled = true
oci {
sync_repo = "REPO"
policy_dir = "DIRECTORY"
secret_type = "SECRET"
}
}
}
}
# [END gke_autopilot_config_sync_oci]
21 changes: 21 additions & 0 deletions gke/autopilot/config_sync/oci/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Google LLC
#
# 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.

# The kubernetes_manifest resource can only be used with pre-existing clusters.
apiVersion: blueprints.cloud.google.com/v1alpha1
kind: BlueprintTest
metadata:
name: config_sync_oci
spec:
skip: true
19 changes: 16 additions & 3 deletions managedkafka/managedkafka_create_cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# [START managedkafka_create_cluster_parent]
# [START managedkafka_create_cluster]
resource "google_managed_kafka_cluster" "default" {
provider = google-beta
project = data.google_project.default.project_id # Replace this with your project ID in quotes
cluster_id = "my-cluster-id"
location = "us-central1"
capacity_config {
Expand All @@ -27,14 +27,27 @@ resource "google_managed_kafka_cluster" "default" {
gcp_config {
access_config {
network_configs {
subnet = "projects/${data.google_project.default.number}/regions/us-central1/subnetworks/default"
subnet = google_compute_subnetwork.default.id
}
}
}
}
# [END managedkafka_create_cluster]

# [START managedkafka_subnetwork]
resource "google_compute_subnetwork" "default" {
name = "test-subnetwork"
ip_cidr_range = "10.2.0.0/16"
region = "us-central1"
network = google_compute_network.default.id
}

resource "google_compute_network" "default" {
name = "test-network"
auto_create_subnetworks = false
}
# [END managedkafka_subnetwork]

data "google_project" "default" {
provider = google-beta
}
# [END managedkafka_create_cluster_parent]
21 changes: 17 additions & 4 deletions managedkafka/managedkafka_create_topic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# [START managedkafka_create_topic_parent]
resource "google_managed_kafka_cluster" "default" {
provider = google-beta
project = data.google_project.default.project_id # Replace this with your project ID in quotes
cluster_id = "my-cluster-id"
location = "us-central1"
capacity_config {
Expand All @@ -26,15 +26,29 @@ resource "google_managed_kafka_cluster" "default" {
gcp_config {
access_config {
network_configs {
subnet = "projects/${data.google_project.default.number}/regions/us-central1/subnetworks/default"
subnet = google_compute_subnetwork.default.id
}
}
}
}

# [START managedkafka_subnetwork]
resource "google_compute_subnetwork" "default" {
name = "test-subnetwork"
ip_cidr_range = "10.2.0.0/16"
region = "us-central1"
network = google_compute_network.default.id
}

resource "google_compute_network" "default" {
name = "test-network"
auto_create_subnetworks = false
}
# [END managedkafka_subnetwork]

# [START managedkafka_create_topic]
resource "google_managed_kafka_topic" "default" {
provider = google-beta
project = data.google_project.default.project_id # Replace this with your project ID in quotes
topic_id = "my-topic-id"
cluster = google_managed_kafka_cluster.default.cluster_id
location = "us-central1"
Expand All @@ -44,6 +58,5 @@ resource "google_managed_kafka_topic" "default" {
# [END managedkafka_create_topic]

data "google_project" "default" {
provider = google-beta
}
# [END managedkafka_create_topic_parent]
8 changes: 4 additions & 4 deletions test/integration/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ go 1.22.7
toolchain go1.22.9

require (
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.16.3
github.com/stretchr/testify v1.9.0
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.17.0
github.com/stretchr/testify v1.10.0
)

require (
Expand Down Expand Up @@ -42,7 +42,7 @@ require (
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f // indirect
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
github.com/hashicorp/terraform-config-inspect v0.0.0-20240801114854-6714b46f5fe4 // indirect
github.com/hashicorp/terraform-config-inspect v0.0.0-20241107133921-3adb156ecfe2 // indirect
github.com/hashicorp/terraform-json v0.23.0 // indirect
github.com/jinzhu/copier v0.4.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
Expand All @@ -63,7 +63,7 @@ require (
github.com/zclconf/go-cty v1.15.0 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sync v0.4.0 // indirect
Expand Down
16 changes: 8 additions & 8 deletions test/integration/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoIS
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.16.3 h1:LKouXohMqxE7u43gOHx57Zme/E3sgMpFq0yPArI4DiE=
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.16.3/go.mod h1:6HwC1k0Nr7cu1ZaMeIQjb+sQAHKSHhG5tytYoA8Sn6A=
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.17.0 h1:EcxvASC45eOFrkk+cw9vP8Wztms3ZMWAQyBNEaI5MdU=
github.com/GoogleCloudPlatform/cloud-foundation-toolkit/infra/blueprint-test v0.17.0/go.mod h1:homk/qeh6p4f7onHkLc5Vy8nG31ZmDK2pamBdHrc1OM=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
Expand Down Expand Up @@ -377,8 +377,8 @@ github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f h1:UdxlrJz4JOnY8W+Db
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w=
github.com/hashicorp/hcl/v2 v2.20.1 h1:M6hgdyz7HYt1UN9e61j+qKJBqR3orTWbI1HKBJEdxtc=
github.com/hashicorp/hcl/v2 v2.20.1/go.mod h1:TZDqQ4kNKCbh1iJp99FdPiUaVDDUPivbqxZulxDYqL4=
github.com/hashicorp/terraform-config-inspect v0.0.0-20240801114854-6714b46f5fe4 h1:RwY5HBgtBZ997UtKJAO2Rx+94ETyevwWEVXWx1SL5YY=
github.com/hashicorp/terraform-config-inspect v0.0.0-20240801114854-6714b46f5fe4/go.mod h1:Gz/z9Hbn+4KSp8A2FBtNszfLSdT2Tn/uAKGuVqqWmDI=
github.com/hashicorp/terraform-config-inspect v0.0.0-20241107133921-3adb156ecfe2 h1:h+wcDC5wTiM+5YKjuLtUSWJtdtMVJNCRCPHoWieLpM4=
github.com/hashicorp/terraform-config-inspect v0.0.0-20241107133921-3adb156ecfe2/go.mod h1:Gz/z9Hbn+4KSp8A2FBtNszfLSdT2Tn/uAKGuVqqWmDI=
github.com/hashicorp/terraform-json v0.23.0 h1:sniCkExU4iKtTADReHzACkk8fnpQXrdD2xoR+lppBkI=
github.com/hashicorp/terraform-json v0.23.0/go.mod h1:MHdXbBAbSg0GvzuWazEGKAn/cyNfIB7mN6y7KJN6y2c=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
Expand Down Expand Up @@ -439,8 +439,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
Expand Down Expand Up @@ -520,8 +520,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down

0 comments on commit 0801ebf

Please sign in to comment.