@@ -47,6 +47,45 @@ func TestAccComputeFirewall_update(t *testing.T) {
47
47
})
48
48
}
49
49
50
+ func TestAccComputeFirewall_localRanges (t * testing.T ) {
51
+ t .Parallel ()
52
+
53
+ networkName := fmt .Sprintf ("tf-test-firewall-%s" , randString (t , 10 ))
54
+ firewallName := fmt .Sprintf ("tf-test-firewall-%s" , randString (t , 10 ))
55
+
56
+ vcrTest (t , resource.TestCase {
57
+ PreCheck : func () { testAccPreCheck (t ) },
58
+ Providers : testAccProviders ,
59
+ CheckDestroy : testAccCheckComputeFirewallDestroyProducer (t ),
60
+ Steps : []resource.TestStep {
61
+ {
62
+ Config : testAccComputeFirewall_localRanges (networkName , firewallName ),
63
+ },
64
+ {
65
+ ResourceName : "google_compute_firewall.foobar" ,
66
+ ImportState : true ,
67
+ ImportStateVerify : true ,
68
+ },
69
+ {
70
+ Config : testAccComputeFirewall_localRangesUpdate (networkName , firewallName ),
71
+ },
72
+ {
73
+ ResourceName : "google_compute_firewall.foobar" ,
74
+ ImportState : true ,
75
+ ImportStateVerify : true ,
76
+ },
77
+ {
78
+ Config : testAccComputeFirewall_localRanges (networkName , firewallName ),
79
+ },
80
+ {
81
+ ResourceName : "google_compute_firewall.foobar" ,
82
+ ImportState : true ,
83
+ ImportStateVerify : true ,
84
+ },
85
+ },
86
+ })
87
+ }
88
+
50
89
func TestAccComputeFirewall_priority (t * testing.T ) {
51
90
t .Parallel ()
52
91
@@ -282,6 +321,52 @@ resource "google_compute_firewall" "foobar" {
282
321
` , network , firewall )
283
322
}
284
323
324
+ func testAccComputeFirewall_localRanges (network , firewall string ) string {
325
+ return fmt .Sprintf (`
326
+ resource "google_compute_network" "foobar" {
327
+ name = "%s"
328
+ auto_create_subnetworks = false
329
+ }
330
+
331
+ resource "google_compute_firewall" "foobar" {
332
+ name = "%s"
333
+ description = "Resource created for Terraform acceptance testing"
334
+ network = google_compute_network.foobar.name
335
+ source_tags = ["foo"]
336
+
337
+ source_ranges = ["10.0.0.0/8"]
338
+ destination_ranges = ["192.168.1.0/24"]
339
+
340
+ allow {
341
+ protocol = "icmp"
342
+ }
343
+ }
344
+ ` , network , firewall )
345
+ }
346
+
347
+ func testAccComputeFirewall_localRangesUpdate (network , firewall string ) string {
348
+ return fmt .Sprintf (`
349
+ resource "google_compute_network" "foobar" {
350
+ name = "%s"
351
+ auto_create_subnetworks = false
352
+ }
353
+
354
+ resource "google_compute_firewall" "foobar" {
355
+ name = "%s"
356
+ description = "Resource created for Terraform acceptance testing"
357
+ network = google_compute_network.foobar.name
358
+ source_tags = ["foo"]
359
+
360
+ source_ranges = ["192.168.1.0/24"]
361
+ destination_ranges = ["10.0.0.0/8"]
362
+
363
+ allow {
364
+ protocol = "icmp"
365
+ }
366
+ }
367
+ ` , network , firewall )
368
+ }
369
+
285
370
func testAccComputeFirewall_update (network , firewall string ) string {
286
371
return fmt .Sprintf (`
287
372
resource "google_compute_network" "foobar" {
0 commit comments