terraform-provider-google/google/resource_compute_firewall_generated_test.go

69 lines
1.6 KiB
Go
Raw Normal View History

// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------
package google
import (
"fmt"
"testing"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)
2018-10-24 19:06:09 +00:00
func TestAccComputeFirewall_FirewallBasicExample(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeFirewallDestroy,
Steps: []resource.TestStep{
{
2018-10-24 19:06:09 +00:00
Config: testAccComputeFirewall_FirewallBasicExample(acctest.RandString(10)),
},
{
ResourceName: "google_compute_firewall.default",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
2018-10-24 19:06:09 +00:00
func testAccComputeFirewall_FirewallBasicExample(val string) string {
return fmt.Sprintf(`
resource "google_compute_firewall" "default" {
name = "test-firewall-%s"
network = "${google_compute_network.default.name}"
allow {
protocol = "icmp"
}
allow {
protocol = "tcp"
ports = ["80", "8080", "1000-2000"]
}
source_tags = ["web"]
}
resource "google_compute_network" "default" {
name = "test-network-%s"
}
`, val, val,
)
}