Skip to content

Commit 2a4dc51

Browse files
ramonvermeulenBBBmau
authored andcommitted
feat: google_datastream_private_connection resource network_attachement support via psc_interface_config (GoogleCloudPlatform#13947)
1 parent 9a0dfe3 commit 2a4dc51

File tree

2 files changed

+75
-4
lines changed

2 files changed

+75
-4
lines changed

mmv1/products/datastream/PrivateConnection.yaml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ immutable: true
2828
import_format:
2929
- 'projects/{{project}}/locations/{{location}}/privateConnections/{{private_connection_id}}'
3030
timeouts:
31-
insert_minutes: 20
32-
update_minutes: 20
33-
delete_minutes: 20
31+
insert_minutes: 30
32+
update_minutes: 30
33+
delete_minutes: 30
3434
async:
3535
actions: ['create', 'delete', 'update']
3636
type: 'OpAsync'
@@ -51,6 +51,18 @@ examples:
5151
vars:
5252
private_connection_id: 'my-connection'
5353
network_name: 'my-network'
54+
- name: 'datastream_private_connection_psc_interface'
55+
primary_resource_id: 'default'
56+
test_env_vars:
57+
project: 'PROJECT_NAME'
58+
project_number: 'PROJECT_NUMBER'
59+
org_id: 'ORG_ID'
60+
billing_account: 'BILLING_ACCT'
61+
vars:
62+
private_connection_id: 'my-connection'
63+
network_attachment_name: 'my-network-attachment'
64+
network_name: 'my-network'
65+
subnetwork_name: 'my-subnetwork'
5466
parameters:
5567
- name: 'privateConnectionId'
5668
type: String
@@ -116,7 +128,9 @@ properties:
116128
description: |
117129
The VPC Peering configuration is used to create VPC peering
118130
between Datastream and the consumer's VPC.
119-
required: true
131+
exactly_one_of:
132+
- 'vpc_peering_config'
133+
- 'psc_interface_config'
120134
properties:
121135
- name: 'vpc'
122136
type: String
@@ -129,3 +143,23 @@ properties:
129143
description: |
130144
A free subnet for peering. (CIDR of /29)
131145
required: true
146+
- name: 'pscInterfaceConfig'
147+
type: NestedObject
148+
description: |
149+
The PSC Interface configuration is used to create PSC Interface
150+
between Datastream and the consumer's PSC.
151+
exactly_one_of:
152+
- 'vpc_peering_config'
153+
- 'psc_interface_config'
154+
properties:
155+
- name: 'networkAttachment'
156+
type: String
157+
description: |
158+
Fully qualified name of the network attachment that Datastream will connect to.
159+
Format: projects/{project}/regions/{region}/networkAttachments/{name}
160+
161+
To get Datastream project for the accepted list:
162+
`gcloud datastream private-connections create [PC ID] --location=[LOCATION] --network-attachment=[NA URI] --validate-only --display-name=[ANY STRING]`
163+
Add Datastream project to the attachment accepted list:
164+
`gcloud compute network-attachments update [NA URI] --region=[NA region] --producer-accept-list=[TP from prev command]`
165+
required: true
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
resource "google_datastream_private_connection" "{{$.PrimaryResourceId}}" {
2+
display_name = "Connection profile"
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 = google_compute_network_attachment.default.id
12+
}
13+
}
14+
15+
resource "google_compute_network_attachment" "default" {
16+
name = "{{index $.Vars "network_attachment_name"}}"
17+
region = "us-central1"
18+
description = "basic network attachment description"
19+
connection_preference = "ACCEPT_AUTOMATIC"
20+
21+
subnetworks = [
22+
google_compute_subnetwork.default.self_link
23+
]
24+
}
25+
26+
resource "google_compute_network" "default" {
27+
name = "{{index $.Vars "network_name"}}"
28+
auto_create_subnetworks = false
29+
}
30+
31+
resource "google_compute_subnetwork" "default" {
32+
name = "{{index $.Vars "subnetwork_name"}}"
33+
region = "us-central1"
34+
35+
network = google_compute_network.default.id
36+
ip_cidr_range = "10.0.0.0/16"
37+
}

0 commit comments

Comments
 (0)