Skip to content

Commit f0e9865

Browse files
NetworkAttachment is now optional in google_eventarc_pipeline (#14136) (#10125)
[upstream:3f7ef85b18f6378376a3cd10ae4139f4bda0e481] Signed-off-by: Modular Magician <[email protected]>
1 parent 83b6b39 commit f0e9865

File tree

6 files changed

+26
-60
lines changed

6 files changed

+26
-60
lines changed

.changelog/14136.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
eventarc: NetworkAttachment is now optional in google_eventarc_pipeline
3+
```

google-beta/services/eventarc/resource_eventarc_message_bus_test.go

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,8 @@ resource "google_eventarc_message_bus" "message_bus" {
429429
// concerned with testing the Pipeline resource, which depends on a singleton MessageBus.
430430
func testAccEventarcMessageBus_pipeline(t *testing.T) {
431431
context := map[string]interface{}{
432-
"project_id": envvar.GetTestProjectFromEnv(),
433-
"region": envvar.GetTestRegionFromEnv(),
434-
"random_suffix": acctest.RandString(t, 10),
435-
"network_attachment_name": acctest.BootstrapNetworkAttachment(t, "tf-bootstrap-eventarc-messagebus-na", acctest.BootstrapSubnet(t, "tf-bootstrap-eventarc-messagebus-subnet", acctest.BootstrapSharedTestNetwork(t, "tf-bootstrap-eventarc-messagebus-network"))),
432+
"region": envvar.GetTestRegionFromEnv(),
433+
"random_suffix": acctest.RandString(t, 10),
436434
}
437435

438436
acctest.VcrTest(t, resource.TestCase{
@@ -460,9 +458,6 @@ resource "google_eventarc_pipeline" "primary" {
460458
pipeline_id = "tf-test-some-pipeline%{random_suffix}"
461459
destinations {
462460
message_bus = google_eventarc_message_bus.primary.id
463-
network_config {
464-
network_attachment = "projects/%{project_id}/regions/%{region}/networkAttachments/%{network_attachment_name}"
465-
}
466461
}
467462
}
468463
@@ -477,10 +472,8 @@ resource "google_eventarc_message_bus" "primary" {
477472
// concerned with testing the Enrollment resource, which depends on a singleton MessageBus.
478473
func testAccEventarcMessageBus_enrollment(t *testing.T) {
479474
context := map[string]interface{}{
480-
"project_id": envvar.GetTestProjectFromEnv(),
481-
"region": envvar.GetTestRegionFromEnv(),
482-
"random_suffix": acctest.RandString(t, 10),
483-
"network_attachment_name": acctest.BootstrapNetworkAttachment(t, "tf-bootstrap-eventarc-messagebus-na", acctest.BootstrapSubnet(t, "tf-bootstrap-eventarc-messagebus-subnet", acctest.BootstrapSharedTestNetwork(t, "tf-bootstrap-eventarc-messagebus-network"))),
475+
"region": envvar.GetTestRegionFromEnv(),
476+
"random_suffix": acctest.RandString(t, 10),
484477
}
485478

486479
acctest.VcrTest(t, resource.TestCase{
@@ -527,9 +520,6 @@ resource "google_eventarc_pipeline" "pipeline" {
527520
pipeline_id = "tf-test-pipeline%{random_suffix}"
528521
destinations {
529522
topic = google_pubsub_topic.pipeline_topic.id
530-
network_config {
531-
network_attachment = "projects/%{project_id}/regions/%{region}/networkAttachments/%{network_attachment_name}"
532-
}
533523
}
534524
}
535525
@@ -544,10 +534,8 @@ resource "google_eventarc_message_bus" "message_bus" {
544534
// concerned with testing the Enrollment resource, which depends on a singleton MessageBus.
545535
func testAccEventarcMessageBus_updateEnrollment(t *testing.T) {
546536
context := map[string]interface{}{
547-
"project_id": envvar.GetTestProjectFromEnv(),
548-
"region": envvar.GetTestRegionFromEnv(),
549-
"random_suffix": acctest.RandString(t, 10),
550-
"network_attachment_name": acctest.BootstrapNetworkAttachment(t, "tf-bootstrap-eventarc-messagebus-na", acctest.BootstrapSubnet(t, "tf-bootstrap-eventarc-messagebus-subnet", acctest.BootstrapSharedTestNetwork(t, "tf-bootstrap-eventarc-messagebus-network"))),
537+
"region": envvar.GetTestRegionFromEnv(),
538+
"random_suffix": acctest.RandString(t, 10),
551539
}
552540

553541
acctest.VcrTest(t, resource.TestCase{
@@ -626,9 +614,6 @@ resource "google_eventarc_pipeline" "pipeline_update" {
626614
pipeline_id = "tf-test-pipeline2%{random_suffix}"
627615
destinations {
628616
topic = google_pubsub_topic.pipeline_update_topic.id
629-
network_config {
630-
network_attachment = "projects/%{project_id}/regions/%{region}/networkAttachments/%{network_attachment_name}"
631-
}
632617
}
633618
}
634619
@@ -641,9 +626,6 @@ resource "google_eventarc_pipeline" "pipeline" {
641626
pipeline_id = "tf-test-pipeline%{random_suffix}"
642627
destinations {
643628
topic = google_pubsub_topic.pipeline_topic.id
644-
network_config {
645-
network_attachment = "projects/%{project_id}/regions/%{region}/networkAttachments/%{network_attachment_name}"
646-
}
647629
}
648630
}
649631
@@ -673,9 +655,6 @@ resource "google_eventarc_pipeline" "pipeline_update" {
673655
pipeline_id = "tf-test-pipeline2%{random_suffix}"
674656
destinations {
675657
topic = google_pubsub_topic.pipeline_update_topic.id
676-
network_config {
677-
network_attachment = "projects/%{project_id}/regions/%{region}/networkAttachments/%{network_attachment_name}"
678-
}
679658
}
680659
}
681660

google-beta/services/eventarc/resource_eventarc_pipeline.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,14 @@ connectivity.`,
346346
Schema: map[string]*schema.Schema{
347347
"network_attachment": {
348348
Type: schema.TypeString,
349-
Required: true,
349+
Optional: true,
350350
Description: `Name of the NetworkAttachment that allows access to the consumer VPC.
351+
351352
Format:
352-
'projects/{PROJECT_ID}/regions/{REGION}/networkAttachments/{NETWORK_ATTACHMENT_NAME}'`,
353+
'projects/{PROJECT_ID}/regions/{REGION}/networkAttachments/{NETWORK_ATTACHMENT_NAME}'
354+
355+
Required for HTTP endpoint destinations. Must not be specified for
356+
Workflows, MessageBus, or Topic destinations.`,
353357
},
354358
},
355359
},

google-beta/services/eventarc/resource_eventarc_pipeline_generated_test.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ func TestAccEventarcPipeline_eventarcPipelineWithTopicDestinationExample(t *test
3535
t.Parallel()
3636

3737
context := map[string]interface{}{
38-
"project_id": envvar.GetTestProjectFromEnv(),
39-
"network_attachment_name": acctest.BootstrapNetworkAttachment(t, "tf-bootstrap-eventarc-pipeline-na", acctest.BootstrapSubnet(t, "tf-bootstrap-eventarc-pipeline-subnet", acctest.BootstrapSharedTestNetwork(t, "tf-bootstrap-eventarc-pipeline-network"))),
40-
"random_suffix": acctest.RandString(t, 10),
38+
"project_id": envvar.GetTestProjectFromEnv(),
39+
"random_suffix": acctest.RandString(t, 10),
4140
}
4241

4342
acctest.VcrTest(t, resource.TestCase{
@@ -69,9 +68,6 @@ resource "google_eventarc_pipeline" "primary" {
6968
pipeline_id = "tf-test-some-pipeline%{random_suffix}"
7069
destinations {
7170
topic = google_pubsub_topic.topic.id
72-
network_config {
73-
network_attachment = "projects/%{project_id}/regions/us-central1/networkAttachments/%{network_attachment_name}"
74-
}
7571
}
7672
labels = {
7773
test_label = "test-eventarc-label"
@@ -132,9 +128,8 @@ func TestAccEventarcPipeline_eventarcPipelineWithWorkflowDestinationExample(t *t
132128
t.Parallel()
133129

134130
context := map[string]interface{}{
135-
"project_id": envvar.GetTestProjectFromEnv(),
136-
"network_attachment_name": acctest.BootstrapNetworkAttachment(t, "tf-bootstrap-eventarc-pipeline-na", acctest.BootstrapSubnet(t, "tf-bootstrap-eventarc-pipeline-subnet", acctest.BootstrapSharedTestNetwork(t, "tf-bootstrap-eventarc-pipeline-network"))),
137-
"random_suffix": acctest.RandString(t, 10),
131+
"project_id": envvar.GetTestProjectFromEnv(),
132+
"random_suffix": acctest.RandString(t, 10),
138133
}
139134

140135
acctest.VcrTest(t, resource.TestCase{
@@ -195,9 +190,6 @@ resource "google_eventarc_pipeline" "primary" {
195190
pipeline_id = "tf-test-some-pipeline%{random_suffix}"
196191
destinations {
197192
workflow = google_workflows_workflow.workflow.id
198-
network_config {
199-
network_attachment = "projects/%{project_id}/regions/us-central1/networkAttachments/%{network_attachment_name}"
200-
}
201193
}
202194
}
203195
`, context)

google-beta/services/eventarc/resource_eventarc_pipeline_test.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ func TestAccEventarcPipeline_update(t *testing.T) {
3030
t.Parallel()
3131

3232
context := map[string]interface{}{
33-
"project_id": envvar.GetTestProjectFromEnv(),
34-
"service_account": envvar.GetTestServiceAccountFromEnv(t),
35-
"key_name": acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-eventarc-pipeline-key").CryptoKey.Name,
36-
"key2_name": acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-eventarc-pipeline-key2").CryptoKey.Name,
37-
"network_attachment_name": acctest.BootstrapNetworkAttachment(t, "tf-bootstrap-eventarc-pipeline-na", acctest.BootstrapSubnet(t, "tf-bootstrap-eventarc-pipeline-subnet", acctest.BootstrapSharedTestNetwork(t, "tf-bootstrap-eventarc-pipeline-network"))),
38-
"random_suffix": acctest.RandString(t, 10),
33+
"service_account": envvar.GetTestServiceAccountFromEnv(t),
34+
"key_name": acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-eventarc-pipeline-key").CryptoKey.Name,
35+
"key2_name": acctest.BootstrapKMSKeyWithPurposeInLocationAndName(t, "ENCRYPT_DECRYPT", "us-central1", "tf-bootstrap-eventarc-pipeline-key2").CryptoKey.Name,
36+
"random_suffix": acctest.RandString(t, 10),
3937
}
4038
acctest.BootstrapIamMembers(t, []acctest.IamMember{
4139
{
@@ -106,9 +104,6 @@ resource "google_eventarc_pipeline" "primary" {
106104
}
107105
destinations {
108106
topic = google_pubsub_topic.topic_update.id
109-
network_config {
110-
network_attachment = "projects/%{project_id}/regions/us-central1/networkAttachments/%{network_attachment_name}"
111-
}
112107
authentication_config {
113108
google_oidc {
114109
service_account = "%{service_account}"
@@ -169,9 +164,6 @@ resource "google_eventarc_pipeline" "primary" {
169164
pipeline_id = "tf-test-some-pipeline%{random_suffix}"
170165
destinations {
171166
topic = google_pubsub_topic.topic_update.id
172-
network_config {
173-
network_attachment = "projects/%{project_id}/regions/us-central1/networkAttachments/%{network_attachment_name}"
174-
}
175167
}
176168
}
177169
`, context)

website/docs/r/eventarc_pipeline.html.markdown

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ resource "google_eventarc_pipeline" "primary" {
4343
pipeline_id = "some-pipeline"
4444
destinations {
4545
topic = google_pubsub_topic.topic.id
46-
network_config {
47-
network_attachment = "projects/my-project-name/regions/us-central1/networkAttachments/some-network-attachment"
48-
}
4946
}
5047
labels = {
5148
test_label = "test-eventarc-label"
@@ -115,9 +112,6 @@ resource "google_eventarc_pipeline" "primary" {
115112
pipeline_id = "some-pipeline"
116113
destinations {
117114
workflow = google_workflows_workflow.workflow.id
118-
network_config {
119-
network_attachment = "projects/my-project-name/regions/us-central1/networkAttachments/some-network-attachment"
120-
}
121115
}
122116
}
123117
```
@@ -437,10 +431,12 @@ The following arguments are supported:
437431
<a name="nested_destinations_destinations_network_config"></a>The `network_config` block supports:
438432

439433
* `network_attachment` -
440-
(Required)
434+
(Optional)
441435
Name of the NetworkAttachment that allows access to the consumer VPC.
442436
Format:
443437
`projects/{PROJECT_ID}/regions/{REGION}/networkAttachments/{NETWORK_ATTACHMENT_NAME}`
438+
Required for HTTP endpoint destinations. Must not be specified for
439+
Workflows, MessageBus, or Topic destinations.
444440

445441
<a name="nested_destinations_destinations_http_endpoint"></a>The `http_endpoint` block supports:
446442

0 commit comments

Comments
 (0)