mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-04 17:51:11 +00:00
Make network name unique between each test run (#826)
* Make network name unique between each test run * make fmt
This commit is contained in:
parent
e8cd017aac
commit
9bebdd02f5
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
"github.com/hashicorp/terraform/terraform"
|
"github.com/hashicorp/terraform/terraform"
|
||||||
)
|
)
|
||||||
@ -16,7 +17,7 @@ func TestAccDataSourceGoogleSubnetwork(t *testing.T) {
|
|||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: TestAccDataSourceGoogleSubnetworkConfig,
|
Config: testAccDataSourceGoogleSubnetwork(),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccDataSourceGoogleSubnetworkCheck("data.google_compute_subnetwork.my_subnetwork", "google_compute_subnetwork.foobar"),
|
testAccDataSourceGoogleSubnetworkCheck("data.google_compute_subnetwork.my_subnetwork", "google_compute_subnetwork.foobar"),
|
||||||
),
|
),
|
||||||
@ -66,10 +67,11 @@ func testAccDataSourceGoogleSubnetworkCheck(data_source_name string, resource_na
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var TestAccDataSourceGoogleSubnetworkConfig = `
|
func testAccDataSourceGoogleSubnetwork() string {
|
||||||
|
return fmt.Sprintf(`
|
||||||
|
|
||||||
resource "google_compute_network" "foobar" {
|
resource "google_compute_network" "foobar" {
|
||||||
name = "network-test"
|
name = "%s"
|
||||||
description = "my-description"
|
description = "my-description"
|
||||||
}
|
}
|
||||||
resource "google_compute_subnetwork" "foobar" {
|
resource "google_compute_subnetwork" "foobar" {
|
||||||
@ -87,4 +89,5 @@ resource "google_compute_subnetwork" "foobar" {
|
|||||||
data "google_compute_subnetwork" "my_subnetwork" {
|
data "google_compute_subnetwork" "my_subnetwork" {
|
||||||
name = "${google_compute_subnetwork.foobar.name}"
|
name = "${google_compute_subnetwork.foobar.name}"
|
||||||
}
|
}
|
||||||
`
|
`, acctest.RandomWithPrefix("network-test"))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user