Skip to content

Commit 1f6c3df

Browse files
alevadnaiaAnna Levadnaia
andauthored
Add PSC connectivity support to Database Migration Service PrivateConnection (GoogleCloudPlatform#17439)
Co-authored-by: Anna Levadnaia <alevadnaia@google.com>
1 parent e5b837d commit 1f6c3df

2 files changed

Lines changed: 71 additions & 2 deletions

File tree

mmv1/products/databasemigrationservice/PrivateConnection.yaml

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ timeouts:
3333
delete_minutes: 60
3434
autogen_async: true
3535
async:
36-
actions: ['create', 'delete', 'update']
36+
actions: ['create', 'delete']
3737
type: 'OpAsync'
3838
operation:
39+
timeouts:
40+
insert_minutes: 60
41+
delete_minutes: 60
3942
base_url: '{{op_id}}'
4043
result:
4144
resource_inside_response: false
@@ -50,6 +53,23 @@ examples:
5053
test_vars_overrides:
5154
# for backward compatible
5255
create_without_validation: '"false" + randomSuffix'
56+
network_name: '"my-network" + randomSuffix'
57+
private_connection_id: '"my-connection" + randomSuffix'
58+
- name: 'database_migration_service_private_connection_psc'
59+
primary_resource_id: 'default'
60+
vars:
61+
private_connection_id: 'my-connection'
62+
attachment_name: 'my-attachment'
63+
create_without_validation: 'false'
64+
network_name: 'my-network'
65+
subnetwork_name: 'my-subnetwork'
66+
test_vars_overrides:
67+
# for backward compatible
68+
create_without_validation: '"false" + randomSuffix'
69+
attachment_name: '"my-attachment" + randomSuffix'
70+
private_connection_id: '"my-connection" + randomSuffix'
71+
network_name: '"my-network" + randomSuffix'
72+
subnetwork_name: '"my-subnetwork" + randomSuffix'
5373
parameters:
5474
- name: 'privateConnectionId'
5575
type: String
@@ -109,7 +129,8 @@ properties:
109129
description: |
110130
The VPC Peering configuration is used to create VPC peering
111131
between databasemigrationservice and the consumer's VPC.
112-
required: true
132+
exactly_one_of:
133+
- 'pscInterfaceConfig'
113134
properties:
114135
- name: 'vpcName'
115136
type: String
@@ -122,3 +143,17 @@ properties:
122143
description: |
123144
A free subnet for peering. (CIDR of /29)
124145
required: true
146+
- name: 'pscInterfaceConfig'
147+
type: NestedObject
148+
description: |
149+
The PSC Interface configuration is used to create PSC Interface
150+
between DMS's internal VPC and the consumer's PSC.
151+
exactly_one_of:
152+
- 'vpcPeeringConfig'
153+
properties:
154+
- name: 'networkAttachment'
155+
type: String
156+
description: |
157+
Fully qualified name of the Network Attachment that DMS will connect to.
158+
Format: projects/{project}/regions/{region}/networkAttachments/{name}
159+
required: true
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
resource "google_database_migration_service_private_connection" "{{$.PrimaryResourceId}}" {
2+
display_name = "dbms_pc"
3+
location = "us-central1"
4+
private_connection_id = "{{index $.Vars "private_connection_id"}}"
5+
6+
labels = {
7+
key = "value"
8+
}
9+
10+
psc_interface_config {
11+
network_attachment = resource.google_compute_network_attachment.default.id
12+
}
13+
14+
create_without_validation = false
15+
}
16+
17+
resource "google_compute_network_attachment" "default" {
18+
name = "{{index $.Vars "attachment_name"}}"
19+
region = "us-central1"
20+
connection_preference = "ACCEPT_AUTOMATIC"
21+
subnetworks = [resource.google_compute_subnetwork.default.id]
22+
}
23+
24+
resource "google_compute_network" "default" {
25+
name = "{{index $.Vars "network_name"}}"
26+
auto_create_subnetworks = false
27+
}
28+
29+
resource "google_compute_subnetwork" "default" {
30+
name = "{{index $.Vars "subnetwork_name"}}"
31+
ip_cidr_range = "10.0.0.0/16"
32+
region = "us-central1"
33+
network = google_compute_network.default.id
34+
}

0 commit comments

Comments
 (0)