mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-01 07:42:40 +00:00
Cleanup from two overlapping magic modules PRs. (#2787)
This commit is contained in:
parent
75f54dce7c
commit
f703fb0aa8
|
@ -16,6 +16,7 @@ package google
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/terraform/helper/acctest"
|
"github.com/hashicorp/terraform/helper/acctest"
|
||||||
|
@ -71,10 +72,13 @@ resource "google_appengine_firewall_rule" "rule" {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccCheckAppengineFirewallRuleDestroy(s *terraform.State) error {
|
func testAccCheckAppengineFirewallRuleDestroy(s *terraform.State) error {
|
||||||
for _, rs := range s.RootModule().Resources {
|
for name, rs := range s.RootModule().Resources {
|
||||||
if rs.Type != "google_appengine_firewall_rule" {
|
if rs.Type != "google_appengine_firewall_rule" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(name, "data.") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
config := testAccProvider.Meta().(*Config)
|
config := testAccProvider.Meta().(*Config)
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,17 @@ import (
|
||||||
func TestAccComputeImage_imageBasicExample(t *testing.T) {
|
func TestAccComputeImage_imageBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
context := map[string]interface{}{
|
||||||
|
"random_suffix": acctest.RandString(10),
|
||||||
|
}
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckComputeImageDestroy,
|
CheckDestroy: testAccCheckComputeImageDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeImage_imageBasicExample(acctest.RandString(10)),
|
Config: testAccComputeImage_imageBasicExample(context),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_image.example",
|
ResourceName: "google_compute_image.example",
|
||||||
|
@ -45,17 +49,16 @@ func TestAccComputeImage_imageBasicExample(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeImage_imageBasicExample(val string) string {
|
func testAccComputeImage_imageBasicExample(context map[string]interface{}) string {
|
||||||
return fmt.Sprintf(`
|
return Nprintf(`
|
||||||
resource "google_compute_image" "example" {
|
resource "google_compute_image" "example" {
|
||||||
name = "example-image-%s"
|
name = "example-image-%{random_suffix}"
|
||||||
|
|
||||||
raw_disk {
|
raw_disk {
|
||||||
source = "https://storage.googleapis.com/bosh-cpi-artifacts/bosh-stemcell-3262.4-google-kvm-ubuntu-trusty-go_agent-raw.tar.gz"
|
source = "https://storage.googleapis.com/bosh-cpi-artifacts/bosh-stemcell-3262.4-google-kvm-ubuntu-trusty-go_agent-raw.tar.gz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`, val,
|
`, context)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccCheckComputeImageDestroy(s *terraform.State) error {
|
func testAccCheckComputeImageDestroy(s *terraform.State) error {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user