@@ -239,6 +239,29 @@ func TestAccComputeFirewall_enableLogging(t *testing.T) {
239
239
})
240
240
}
241
241
242
+ func TestAccComputeFirewall_moduleOutput (t * testing.T ) {
243
+ t .Parallel ()
244
+
245
+ networkName := fmt .Sprintf ("tf-test-firewall-%s" , randString (t , 10 ))
246
+ firewallName := fmt .Sprintf ("tf-test-firewall-%s" , randString (t , 10 ))
247
+
248
+ vcrTest (t , resource.TestCase {
249
+ PreCheck : func () { testAccPreCheck (t ) },
250
+ Providers : testAccProviders ,
251
+ CheckDestroy : testAccCheckComputeFirewallDestroyProducer (t ),
252
+ Steps : []resource.TestStep {
253
+ {
254
+ Config : testAccComputeFirewall_moduleOutput (networkName , firewallName ),
255
+ },
256
+ {
257
+ ResourceName : "google_compute_firewall.foobar" ,
258
+ ImportState : true ,
259
+ ImportStateVerify : true ,
260
+ },
261
+ },
262
+ })
263
+ }
264
+
242
265
func testAccComputeFirewall_basic (network , firewall string ) string {
243
266
return fmt .Sprintf (`
244
267
resource "google_compute_network" "foobar" {
@@ -444,3 +467,40 @@ resource "google_compute_firewall" "foobar" {
444
467
}
445
468
` , network , firewall , enableLoggingCfg )
446
469
}
470
+
471
+ func testAccComputeFirewall_moduleOutput (network , firewall string ) string {
472
+ return fmt .Sprintf (`
473
+ resource "google_compute_network" "foobar" {
474
+ name = "%s"
475
+ auto_create_subnetworks = false
476
+ }
477
+
478
+ resource "google_compute_subnetwork" "foobar" {
479
+ name = "%s-subnet"
480
+ ip_cidr_range = "10.0.0.0/16"
481
+ region = "us-central1"
482
+ network = google_compute_network.foobar.name
483
+ }
484
+
485
+ resource "google_compute_address" "foobar" {
486
+ name = "%s-address"
487
+ subnetwork = google_compute_subnetwork.foobar.id
488
+ address_type = "INTERNAL"
489
+ region = "us-central1"
490
+ }
491
+
492
+ resource "google_compute_firewall" "foobar" {
493
+ name = "%s"
494
+ description = "Resource created for Terraform acceptance testing"
495
+ network = google_compute_network.foobar.name
496
+ direction = "INGRESS"
497
+
498
+ source_ranges = ["${google_compute_address.foobar.address}/32"]
499
+ target_tags = ["foo"]
500
+
501
+ allow {
502
+ protocol = "tcp"
503
+ }
504
+ }
505
+ ` , network , network , network , firewall )
506
+ }
0 commit comments