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

Use Create instead of Patch to create google_service_networking_connection #8872

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions mmv1/products/alloydb/Backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ examples:
alloydb_cluster_name: 'alloydb-cluster'
alloydb_instance_name: 'alloydb-instance'
network_name: 'alloydb-network'
test_vars_overrides:
network_name: 'acctest.BootstrapSharedTestNetwork(t, "alloydb-backup-basic")'
ignore_read_extra:
- 'reconciling'
- 'update_time'
Expand All @@ -55,8 +53,6 @@ examples:
alloydb_cluster_name: 'alloydb-cluster'
alloydb_instance_name: 'alloydb-instance'
network_name: 'alloydb-network'
test_vars_overrides:
network_name: 'acctest.BootstrapSharedTestNetwork(t, "alloydb-backup-full")'
ignore_read_extra:
- 'reconciling'
- 'update_time'
Expand Down
2 changes: 0 additions & 2 deletions mmv1/products/alloydb/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ examples:
alloydb_cluster_name: 'alloydb-cluster'
alloydb_instance_name: 'alloydb-instance'
network_name: 'alloydb-network'
test_vars_overrides:
network_name: 'acctest.BootstrapSharedTestNetwork(t, "alloydb-instance-basic")'
ignore_read_extra:
- 'reconciling'
- 'update_time'
Expand Down
2 changes: 0 additions & 2 deletions mmv1/products/databasemigrationservice/connectionprofile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ examples:
profile: 'my-profileid'
global_address_name: 'private-ip-alloc'
network_name: 'vpc-network'
test_vars_overrides:
network_name: 'acctest.BootstrapSharedTestNetwork(t, "profile-alloydb")'
parameters:
- !ruby/object:Api::Type::String
name: 'connectionProfileId'
Expand Down
1 change: 0 additions & 1 deletion mmv1/products/looker/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ examples:
client_id: 'my-client-id'
client_secret: 'my-client-secret'
test_vars_overrides:
network_name: 'acctest.BootstrapSharedTestNetwork(t, "looker-instance-enterprise")'
kms_key_name: 'acctest.BootstrapKMSKeyInLocation(t, "us-central1").CryptoKey.Name'
parameters:
- !ruby/object:Api::Type::String
Expand Down
2 changes: 0 additions & 2 deletions mmv1/products/memcache/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ examples:
instance_name: 'test-instance'
network_name: 'test-network'
address_name: 'address'
test_vars_overrides:
network_name: 'acctest.BootstrapSharedTestNetwork(t, "memcache-instance-basic")'
parameters:
- !ruby/object:Api::Type::String
name: 'region'
Expand Down
2 changes: 0 additions & 2 deletions mmv1/products/redis/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ examples:
instance_name: 'private-cache'
address_name: 'address'
network_name: 'redis-test-network'
test_vars_overrides:
network_name: 'acctest.BootstrapSharedTestNetwork(t, "redis-private-service")'
- !ruby/object:Provider::Terraform::Examples
name: 'redis_instance_mrr'
primary_resource_id: 'cache'
Expand Down
8 changes: 4 additions & 4 deletions mmv1/templates/terraform/examples/alloydb_backup_basic.tf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "google_alloydb_backup" "<%= ctx[:primary_resource_id] %>" {
resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" {
cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>"
location = "us-central1"
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" {
Expand All @@ -25,15 +25,15 @@ resource "google_compute_global_address" "private_ip_alloc" {
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

resource "google_service_networking_connection" "vpc_connection" {
network = data.google_compute_network.default.id
network = google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}

data "google_compute_network" "default" {
resource "google_compute_network" "default" {
name = "<%= ctx[:vars]['network_name'] %>"
}
8 changes: 4 additions & 4 deletions mmv1/templates/terraform/examples/alloydb_backup_full.tf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resource "google_alloydb_backup" "<%= ctx[:primary_resource_id] %>" {
resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" {
cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>"
location = "us-central1"
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" {
Expand All @@ -29,15 +29,15 @@ resource "google_compute_global_address" "private_ip_alloc" {
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

resource "google_service_networking_connection" "vpc_connection" {
network = data.google_compute_network.default.id
network = google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}

data "google_compute_network" "default" {
resource "google_compute_network" "default" {
name = "<%= ctx[:vars]['network_name'] %>"
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resource "google_alloydb_instance" "<%= ctx[:primary_resource_id] %>" {
resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" {
cluster_id = "<%= ctx[:vars]['alloydb_cluster_name'] %>"
location = "us-central1"
network = data.google_compute_network.default.id
network = google_compute_network.default.id

initial_user {
password = "<%= ctx[:vars]['alloydb_cluster_name'] %>"
Expand All @@ -22,7 +22,7 @@ resource "google_alloydb_cluster" "<%= ctx[:primary_resource_id] %>" {

data "google_project" "project" {}

data "google_compute_network" "default" {
resource "google_compute_network" "default" {
name = "<%= ctx[:vars]['network_name'] %>"
}

Expand All @@ -31,11 +31,11 @@ resource "google_compute_global_address" "private_ip_alloc" {
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

resource "google_service_networking_connection" "vpc_connection" {
network = data.google_compute_network.default.id
network = google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
data "google_project" "project" {
}

data "google_compute_network" "default" {
resource "google_compute_network" "default" {
name = "<%= ctx[:vars]['network_name'] %>"
}

Expand All @@ -10,11 +10,11 @@ resource "google_compute_global_address" "private_ip_alloc" {
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

resource "google_service_networking_connection" "vpc_connection" {
network = data.google_compute_network.default.id
network = google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
Expand All @@ -34,7 +34,7 @@ resource "google_database_migration_service_connection_profile" "<%= ctx[:primar
user = "alloyuser%{random_suffix}"
password = "alloypass%{random_suffix}"
}
vpc_network = data.google_compute_network.default.id
vpc_network = google_compute_network.default.id
labels = {
alloyfoo = "alloybar"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" {
private_ip_enabled = true
public_ip_enabled = false
reserved_range = "${google_compute_global_address.looker_range.name}"
consumer_network = data.google_compute_network.looker_network.id
consumer_network = google_compute_network.looker_network.id
admin_settings {
allowed_email_domains = ["google.com"]
}
Expand Down Expand Up @@ -49,7 +49,7 @@ resource "google_looker_instance" "<%= ctx[:primary_resource_id] %>" {
}

resource "google_service_networking_connection" "looker_vpc_connection" {
network = data.google_compute_network.looker_network.id
network = google_compute_network.looker_network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.looker_range.name]
}
Expand All @@ -59,12 +59,12 @@ resource "google_compute_global_address" "looker_range" {
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 20
network = data.google_compute_network.looker_network.id
network = google_compute_network.looker_network.id
}

data "google_project" "project" {}

data "google_compute_network" "looker_network" {
resource "google_compute_network" "looker_network" {
name = "<%= ctx[:vars]["network_name"] %>"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// If this network hasn't been created and you are using this example in your
// config, add an additional network resource or change
// this from "data"to "resource"
data "google_compute_network" "memcache_network" {
resource "google_compute_network" "memcache_network" {
name = "<%= ctx[:vars]['network_name'] %>"
}

Expand All @@ -15,11 +15,11 @@ resource "google_compute_global_address" "service_range" {
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = data.google_compute_network.memcache_network.id
network = google_compute_network.memcache_network.id
}

resource "google_service_networking_connection" "private_service_connection" {
network = data.google_compute_network.memcache_network.id
network = google_compute_network.memcache_network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.service_range.name]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// If this network hasn't been created and you are using this example in your
// config, add an additional network resource or change
// this from "data"to "resource"
data "google_compute_network" "redis-network" {
resource "google_compute_network" "redis-network" {
name = "<%= ctx[:vars]['network_name'] %>"
}

Expand All @@ -15,11 +15,11 @@ resource "google_compute_global_address" "service_range" {
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = data.google_compute_network.redis-network.id
network = google_compute_network.redis-network.id
}

resource "google_service_networking_connection" "private_service_connection" {
network = data.google_compute_network.redis-network.id
network = google_compute_network.redis-network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.service_range.name]
}
Expand All @@ -32,7 +32,7 @@ resource "google_redis_instance" "<%= ctx[:primary_resource_id] %>" {
location_id = "us-central1-a"
alternative_location_id = "us-central1-f"

authorized_network = data.google_compute_network.redis-network.id
authorized_network = google_compute_network.redis-network.id
connect_mode = "PRIVATE_SERVICE_ACCESS"

redis_version = "REDIS_4_0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (
func TestAccAlloydbBackup_update(t *testing.T) {
t.Parallel()

random_suffix := acctest.RandString(t, 10)
context := map[string]interface{}{
"network_name": acctest.BootstrapSharedTestNetwork(t, "alloydb-backup-update"),
"random_suffix": acctest.RandString(t, 10),
"network_name": "tf-test-alloydb-network" + random_suffix,
"random_suffix": random_suffix,
}

acctest.VcrTest(t, resource.TestCase{
Expand Down Expand Up @@ -61,7 +62,7 @@ resource "google_alloydb_backup" "default" {
resource "google_alloydb_cluster" "default" {
cluster_id = "tf-test-alloydb-cluster%{random_suffix}"
location = "us-central1"
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

resource "google_alloydb_instance" "default" {
Expand All @@ -77,16 +78,16 @@ resource "google_compute_global_address" "private_ip_alloc" {
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

resource "google_service_networking_connection" "vpc_connection" {
network = data.google_compute_network.default.id
network = google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}

data "google_compute_network" "default" {
resource "google_compute_network" "default" {
name = "%{network_name}"
}
`, context)
Expand All @@ -98,7 +99,7 @@ func TestAccAlloydbBackup_createBackupWithMandatoryFields(t *testing.T) {

context := map[string]interface{}{
"random_suffix": acctest.RandString(t, 10),
"network_name": acctest.BootstrapSharedTestNetwork(t, "alloydbbackup-mandatory"),
"network_name": "tf-test-" + acctest.RandString(t, 10),
}

acctest.VcrTest(t, resource.TestCase{
Expand All @@ -125,12 +126,12 @@ resource "google_alloydb_backup" "default" {
resource "google_alloydb_cluster" "default" {
location = "us-central1"
cluster_id = "tf-test-alloydb-cluster%{random_suffix}"
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

data "google_project" "project" { }

data "google_compute_network" "default" {
resource "google_compute_network" "default" {
name = "%{network_name}"
}

Expand All @@ -147,7 +148,7 @@ resource "google_compute_global_address" "private_ip_alloc" {
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = data.google_compute_network.default.id
network = google_compute_network.default.id
lifecycle {
ignore_changes = [
address,
Expand All @@ -161,7 +162,7 @@ resource "google_compute_global_address" "private_ip_alloc" {
}

resource "google_service_networking_connection" "vpc_connection" {
network = data.google_compute_network.default.id
network = google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}
Expand All @@ -172,7 +173,7 @@ func TestAccAlloydbBackup_usingCMEK(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"network_name": acctest.BootstrapSharedTestNetwork(t, "alloydb-backup-cmek"),
"network_name": "tf-test-" + acctest.RandString(t, 10),
"random_suffix": acctest.RandString(t, 10),
"key_name": "tf-test-key-" + acctest.RandString(t, 10),
}
Expand Down Expand Up @@ -215,7 +216,7 @@ resource "google_alloydb_backup" "default" {
resource "google_alloydb_cluster" "default" {
cluster_id = "tf-test-alloydb-cluster%{random_suffix}"
location = "us-central1"
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

resource "google_alloydb_instance" "default" {
Expand All @@ -231,16 +232,16 @@ resource "google_compute_global_address" "private_ip_alloc" {
address_type = "INTERNAL"
purpose = "VPC_PEERING"
prefix_length = 16
network = data.google_compute_network.default.id
network = google_compute_network.default.id
}

resource "google_service_networking_connection" "vpc_connection" {
network = data.google_compute_network.default.id
network = google_compute_network.default.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
}

data "google_compute_network" "default" {
resource "google_compute_network" "default" {
name = "%{network_name}"
}
data "google_project" "project" {}
Expand Down
Loading
Loading