mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-06-29 06:42:36 +00:00
Remove outdated tests (superseded by generated ones) (#2836)
<!-- This change is generated by MagicModules. --> /cc @rileykarson
This commit is contained in:
parent
c727484c29
commit
4af5438dc2
|
@ -35,27 +35,6 @@ func TestAccCloudBuildTrigger_basic(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestAccCloudBuildTrigger_filename(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckCloudbuildTriggerDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testGoogleCloudBuildTrigger_filename(),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_cloudbuild_trigger.filename_build_trigger",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func testGoogleCloudBuildTrigger_basic() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_cloudbuild_trigger" "build_trigger" {
|
||||
|
@ -115,20 +94,3 @@ resource "google_cloudbuild_trigger" "build_trigger" {
|
|||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func testGoogleCloudBuildTrigger_filename() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_cloudbuild_trigger" "filename_build_trigger" {
|
||||
description = "acceptance test build trigger"
|
||||
trigger_template {
|
||||
branch_name = "master"
|
||||
repo_name = "some-repo"
|
||||
}
|
||||
substitutions = {
|
||||
_FOO = "bar"
|
||||
_BAZ = "qux"
|
||||
}
|
||||
filename = "cloudbuild.yaml"
|
||||
}
|
||||
`)
|
||||
}
|
|
@ -8,26 +8,6 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccComputeAddress_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeAddressDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeAddress_basic(acctest.RandString(10)),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_address.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeAddress_networkTier(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -78,13 +58,6 @@ func TestAccComputeAddress_internal(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccComputeAddress_basic(i string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_address" "foobar" {
|
||||
name = "address-test-%s"
|
||||
}`, i)
|
||||
}
|
||||
|
||||
func testAccComputeAddress_internal(i string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_address" "internal" {
|
||||
|
|
|
@ -11,38 +11,6 @@ import (
|
|||
"google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeAutoscaler_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var ascaler compute.Autoscaler
|
||||
|
||||
var it_name = fmt.Sprintf("autoscaler-test-%s", acctest.RandString(10))
|
||||
var tp_name = fmt.Sprintf("autoscaler-test-%s", acctest.RandString(10))
|
||||
var igm_name = fmt.Sprintf("autoscaler-test-%s", acctest.RandString(10))
|
||||
var autoscaler_name = fmt.Sprintf("autoscaler-test-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeAutoscalerDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeAutoscalerExists(
|
||||
"google_compute_autoscaler.foobar", &ascaler),
|
||||
),
|
||||
},
|
||||
|
||||
{
|
||||
ResourceName: "google_compute_autoscaler.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeAutoscaler_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -10,38 +10,6 @@ import (
|
|||
"google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeBackendBucket_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
backendName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
|
||||
storageName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
|
||||
var svc compute.BackendBucket
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeBackendBucketDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeBackendBucket_basic(backendName, storageName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeBackendBucketExists(
|
||||
"google_compute_backend_bucket.foobar", &svc),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_backend_bucket.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if svc.BucketName != storageName {
|
||||
t.Errorf("Expected BucketName to be %q, got %q", storageName, svc.BucketName)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccComputeBackendBucket_basicModified(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -205,35 +205,6 @@ func TestAccComputeDisk_imageDiffSuppressPublicVendorsFamilyNames(t *testing.T)
|
|||
}
|
||||
}
|
||||
|
||||
func TestAccComputeDisk_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
|
||||
var disk compute.Disk
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeDiskDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeDisk_basic(diskName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeDiskExists(
|
||||
"google_compute_disk.foobar", getTestProjectFromEnv(), &disk),
|
||||
testAccCheckComputeDiskHasLabel(&disk, "my-label", "my-label-value"),
|
||||
testAccCheckComputeDiskHasLabelFingerprint(&disk, "google_compute_disk.foobar"),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_disk.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeDisk_timeout(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -13,35 +13,6 @@ import (
|
|||
"google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeFirewall_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var firewall compute.Firewall
|
||||
networkName := fmt.Sprintf("firewall-test-%s", acctest.RandString(10))
|
||||
firewallName := fmt.Sprintf("firewall-test-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeFirewallDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeFirewall_basic(networkName, firewallName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeFirewallExists(
|
||||
"google_compute_firewall.foobar", &firewall),
|
||||
testAccCheckComputeFirewallApiVersion(&firewall),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_firewall.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeFirewall_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -11,35 +11,6 @@ import (
|
|||
"google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeGlobalAddress_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var addr compute.Address
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeGlobalAddressDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeGlobalAddress_basic(),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeGlobalAddressExists(
|
||||
"google_compute_global_address.foobar", &addr),
|
||||
|
||||
// implicitly IPV4 - if we don't send an ip_version, we don't get one back.
|
||||
testAccCheckComputeGlobalAddressIpVersion("google_compute_global_address.foobar", ""),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_global_address.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeGlobalAddress_ipv6(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -122,14 +93,6 @@ func testAccCheckComputeGlobalAddressIpVersion(n, version string) resource.TestC
|
|||
}
|
||||
}
|
||||
|
||||
func testAccComputeGlobalAddress_basic() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_global_address" "foobar" {
|
||||
name = "address-test-%s"
|
||||
description = "Created for Terraform acceptance testing"
|
||||
}`, acctest.RandString(10))
|
||||
}
|
||||
|
||||
func testAccComputeGlobalAddress_ipv6() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_global_address" "foobar" {
|
||||
|
|
|
@ -10,38 +10,6 @@ import (
|
|||
"google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeHttpHealthCheck_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var healthCheck compute.HttpHealthCheck
|
||||
|
||||
hhckName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeHttpHealthCheckDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeHttpHealthCheck_basic(hhckName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeHttpHealthCheckExists(
|
||||
"google_compute_http_health_check.foobar", &healthCheck),
|
||||
testAccCheckComputeHttpHealthCheckRequestPath(
|
||||
"/health_check", &healthCheck),
|
||||
testAccCheckComputeHttpHealthCheckThresholds(
|
||||
3, 3, &healthCheck),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_http_health_check.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeHttpHealthCheck_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -133,22 +101,6 @@ func testAccCheckComputeHttpHealthCheckThresholds(healthy, unhealthy int64, heal
|
|||
}
|
||||
}
|
||||
|
||||
func testAccComputeHttpHealthCheck_basic(hhckName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_http_health_check" "foobar" {
|
||||
name = "%s"
|
||||
check_interval_sec = 3
|
||||
description = "Resource created for Terraform acceptance testing"
|
||||
healthy_threshold = 3
|
||||
host = "foobar"
|
||||
port = "80"
|
||||
request_path = "/health_check"
|
||||
timeout_sec = 2
|
||||
unhealthy_threshold = 3
|
||||
}
|
||||
`, hhckName)
|
||||
}
|
||||
|
||||
func testAccComputeHttpHealthCheck_update1(hhckName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_http_health_check" "foobar" {
|
||||
|
|
|
@ -10,38 +10,6 @@ import (
|
|||
"google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeHttpsHealthCheck_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var healthCheck compute.HttpsHealthCheck
|
||||
|
||||
hhckName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeHttpsHealthCheckDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeHttpsHealthCheck_basic(hhckName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeHttpsHealthCheckExists(
|
||||
"google_compute_https_health_check.foobar", &healthCheck),
|
||||
testAccCheckComputeHttpsHealthCheckRequestPath(
|
||||
"/health_check", &healthCheck),
|
||||
testAccCheckComputeHttpsHealthCheckThresholds(
|
||||
3, 3, &healthCheck),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_https_health_check.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeHttpsHealthCheck_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -133,22 +101,6 @@ func testAccCheckComputeHttpsHealthCheckThresholds(healthy, unhealthy int64, hea
|
|||
}
|
||||
}
|
||||
|
||||
func testAccComputeHttpsHealthCheck_basic(hhckName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_https_health_check" "foobar" {
|
||||
check_interval_sec = 3
|
||||
description = "Resource created for Terraform acceptance testing"
|
||||
healthy_threshold = 3
|
||||
host = "foobar"
|
||||
name = "%s"
|
||||
port = "80"
|
||||
request_path = "/health_check"
|
||||
timeout_sec = 2
|
||||
unhealthy_threshold = 3
|
||||
}
|
||||
`, hhckName)
|
||||
}
|
||||
|
||||
func testAccComputeHttpsHealthCheck_update1(hhckName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_https_health_check" "foobar" {
|
||||
|
|
|
@ -10,32 +10,6 @@ import (
|
|||
"google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeImage_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var image compute.Image
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeImageDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeImage_basic("image-test-" + acctest.RandString(10)),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeImageExists(
|
||||
"google_compute_image.foobar", &image),
|
||||
testAccCheckComputeImageDescription(&image, "description-test"),
|
||||
testAccCheckComputeImageFamily(&image, "family-test"),
|
||||
testAccCheckComputeImageContainsLabel(&image, "my-label", "my-label-value"),
|
||||
testAccCheckComputeImageContainsLabel(&image, "empty-label", ""),
|
||||
testAccCheckComputeImageHasComputedFingerprint(&image, "google_compute_image.foobar"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeImage_withLicense(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -11,35 +11,6 @@ import (
|
|||
"google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeRegionAutoscaler_basic(t *testing.T) {
|
||||
var ascaler compute.Autoscaler
|
||||
|
||||
var it_name = fmt.Sprintf("region-autoscaler-test-%s", acctest.RandString(10))
|
||||
var tp_name = fmt.Sprintf("region-autoscaler-test-%s", acctest.RandString(10))
|
||||
var igm_name = fmt.Sprintf("region-autoscaler-test-%s", acctest.RandString(10))
|
||||
var autoscaler_name = fmt.Sprintf("region-autoscaler-test-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeRegionAutoscalerDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeRegionAutoscaler_basic(it_name, tp_name, igm_name, autoscaler_name),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeRegionAutoscalerExists(
|
||||
"google_compute_region_autoscaler.foobar", &ascaler),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_region_autoscaler.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeRegionAutoscaler_update(t *testing.T) {
|
||||
var ascaler compute.Autoscaler
|
||||
|
||||
|
|
|
@ -11,34 +11,6 @@ import (
|
|||
"google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeRoute_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var route compute.Route
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeRouteDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeRoute_basic(),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeRouteExists(
|
||||
"google_compute_route.foobar", &route),
|
||||
resource.TestMatchResourceAttr(
|
||||
"google_compute_route.foobar", "description", regexp.MustCompile("This is a route")),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_route.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeRoute_defaultInternetGateway(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -124,23 +96,6 @@ func testAccCheckComputeRouteExists(n string, route *compute.Route) resource.Tes
|
|||
}
|
||||
}
|
||||
|
||||
func testAccComputeRoute_basic() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_network" "foobar" {
|
||||
name = "route-test-%s"
|
||||
auto_create_subnetworks = false
|
||||
ipv4_range = "10.0.0.0/16"
|
||||
}
|
||||
|
||||
resource "google_compute_route" "foobar" {
|
||||
name = "route-test-%s"
|
||||
description = "This is a route"
|
||||
dest_range = "15.0.0.0/24"
|
||||
network = "${google_compute_network.foobar.name}"
|
||||
next_hop_ip = "10.0.1.5"
|
||||
}`, acctest.RandString(10), acctest.RandString(10))
|
||||
}
|
||||
|
||||
func testAccComputeRoute_defaultInternetGateway() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_route" "foobar" {
|
||||
|
|
|
@ -8,39 +8,6 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccComputeSnapshot_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
snapshotName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
|
||||
diskName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeSnapshotDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeSnapshot_basic(snapshotName, diskName, "my-value"),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_snapshot.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
ImportStateVerifyIgnore: []string{"zone"},
|
||||
},
|
||||
{
|
||||
Config: testAccComputeSnapshot_basic(snapshotName, diskName, "my-updated-value"),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_snapshot.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
ImportStateVerifyIgnore: []string{"zone"},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeSnapshot_encryption(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -65,31 +32,6 @@ func TestAccComputeSnapshot_encryption(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccComputeSnapshot_basic(snapshotName, diskName, labelValue string) string {
|
||||
return fmt.Sprintf(`
|
||||
data "google_compute_image" "my_image" {
|
||||
family = "debian-9"
|
||||
project = "debian-cloud"
|
||||
}
|
||||
|
||||
resource "google_compute_disk" "foobar" {
|
||||
name = "%s"
|
||||
image = "${data.google_compute_image.my_image.self_link}"
|
||||
size = 10
|
||||
type = "pd-ssd"
|
||||
zone = "us-central1-a"
|
||||
}
|
||||
|
||||
resource "google_compute_snapshot" "foobar" {
|
||||
name = "%s"
|
||||
source_disk = "${google_compute_disk.foobar.name}"
|
||||
zone = "us-central1-a"
|
||||
labels = {
|
||||
my_label = "%s"
|
||||
}
|
||||
}`, diskName, snapshotName, labelValue)
|
||||
}
|
||||
|
||||
func testAccComputeSnapshot_encryption(snapshotName string, diskName string) string {
|
||||
return fmt.Sprintf(`
|
||||
data "google_compute_image" "my_image" {
|
||||
|
|
|
@ -4,36 +4,10 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccComputeSslCertificate_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeSslCertificate_basic(),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeSslCertificateExists(
|
||||
"google_compute_ssl_certificate.foobar"),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_ssl_certificate.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
ImportStateVerifyIgnore: []string{"private_key"},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeSslCertificate_no_name(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -59,31 +33,6 @@ func TestAccComputeSslCertificate_no_name(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestAccComputeSslCertificate_name_prefix(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeSslCertificate_name_prefix(),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeSslCertificateExists(
|
||||
"google_compute_ssl_certificate.foobar"),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_ssl_certificate.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
ImportStateVerifyIgnore: []string{"private_key", "name_prefix"},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckComputeSslCertificateExists(n string) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
rs, ok := s.RootModule().Resources[n]
|
||||
|
@ -111,17 +60,6 @@ func testAccCheckComputeSslCertificateExists(n string) resource.TestCheckFunc {
|
|||
}
|
||||
}
|
||||
|
||||
func testAccComputeSslCertificate_basic() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_ssl_certificate" "foobar" {
|
||||
name = "sslcert-test-%s"
|
||||
description = "very descriptive"
|
||||
private_key = "${file("test-fixtures/ssl_cert/test.key")}"
|
||||
certificate = "${file("test-fixtures/ssl_cert/test.crt")}"
|
||||
}
|
||||
`, acctest.RandString(10))
|
||||
}
|
||||
|
||||
func testAccComputeSslCertificate_no_name() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_ssl_certificate" "foobar" {
|
||||
|
@ -131,14 +69,3 @@ resource "google_compute_ssl_certificate" "foobar" {
|
|||
}
|
||||
`)
|
||||
}
|
||||
|
||||
func testAccComputeSslCertificate_name_prefix() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_ssl_certificate" "foobar" {
|
||||
name_prefix = "sslcert-test-%s-"
|
||||
description = "extremely descriptive"
|
||||
private_key = "${file("test-fixtures/ssl_cert/test.key")}"
|
||||
certificate = "${file("test-fixtures/ssl_cert/test.crt")}"
|
||||
}
|
||||
`, acctest.RandString(10))
|
||||
}
|
||||
|
|
|
@ -10,67 +10,6 @@ import (
|
|||
compute "google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeSslPolicy_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var sslPolicy compute.SslPolicy
|
||||
sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeSslPolicyBasic(sslPolicyName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeSslPolicyExists(
|
||||
"google_compute_ssl_policy.basic", &sslPolicy),
|
||||
// test attribute default values
|
||||
resource.TestCheckResourceAttr(
|
||||
"google_compute_ssl_policy.basic", "profile", "COMPATIBLE"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"google_compute_ssl_policy.basic", "min_tls_version", "TLS_1_0"),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_ssl_policy.basic",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeSslPolicy_profile(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var sslPolicy compute.SslPolicy
|
||||
sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeSslPolicyProfile(sslPolicyName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeSslPolicyExists(
|
||||
"google_compute_ssl_policy.profile", &sslPolicy),
|
||||
resource.TestCheckResourceAttr(
|
||||
"google_compute_ssl_policy.profile", "profile", "MODERN"),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_ssl_policy.profile",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeSslPolicy_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -118,66 +57,6 @@ func TestAccComputeSslPolicy_update(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestAccComputeSslPolicy_tls_version(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var sslPolicy compute.SslPolicy
|
||||
sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeSslPolicyTlsVersion(sslPolicyName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeSslPolicyExists(
|
||||
"google_compute_ssl_policy.tlsversion", &sslPolicy),
|
||||
resource.TestCheckResourceAttr(
|
||||
"google_compute_ssl_policy.tlsversion", "min_tls_version", "TLS_1_2"),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_ssl_policy.tlsversion",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeSslPolicy_custom(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var sslPolicy compute.SslPolicy
|
||||
sslPolicyName := fmt.Sprintf("test-ssl-policy-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeSslPolicyCustom(sslPolicyName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeSslPolicyExists(
|
||||
"google_compute_ssl_policy.custom", &sslPolicy),
|
||||
resource.TestCheckResourceAttr(
|
||||
"google_compute_ssl_policy.custom", "min_tls_version", "TLS_1_2"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"google_compute_ssl_policy.custom", "profile", "CUSTOM"),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_ssl_policy.custom",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeSslPolicy_update_to_custom(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -308,25 +187,6 @@ func testAccCheckComputeSslPolicyExists(n string, sslPolicy *compute.SslPolicy)
|
|||
}
|
||||
}
|
||||
|
||||
func testAccComputeSslPolicyBasic(resourceName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_ssl_policy" "basic" {
|
||||
name = "%s"
|
||||
description = "Generated by TF provider acceptance test"
|
||||
}
|
||||
`, resourceName)
|
||||
}
|
||||
|
||||
func testAccComputeSslPolicyProfile(resourceName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_ssl_policy" "profile" {
|
||||
name = "%s"
|
||||
description = "Generated by TF provider acceptance test"
|
||||
profile = "MODERN"
|
||||
}
|
||||
`, resourceName)
|
||||
}
|
||||
|
||||
func testAccComputeSslUpdate1(resourceName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_ssl_policy" "update" {
|
||||
|
@ -360,25 +220,3 @@ resource "google_compute_ssl_policy" "update" {
|
|||
}
|
||||
`, resourceName)
|
||||
}
|
||||
|
||||
func testAccComputeSslPolicyTlsVersion(resourceName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_ssl_policy" "tlsversion" {
|
||||
name = "%s"
|
||||
description = "Generated by TF provider acceptance test"
|
||||
min_tls_version = "TLS_1_2"
|
||||
}
|
||||
`, resourceName)
|
||||
}
|
||||
|
||||
func testAccComputeSslPolicyCustom(resourceName string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_ssl_policy" "custom" {
|
||||
name = "%s"
|
||||
description = "Generated by TF provider acceptance test"
|
||||
min_tls_version = "TLS_1_2"
|
||||
profile = "CUSTOM"
|
||||
custom_features = ["TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"]
|
||||
}
|
||||
`, resourceName)
|
||||
}
|
||||
|
|
|
@ -9,36 +9,6 @@ import (
|
|||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccComputeTargetHttpProxy_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
target := fmt.Sprintf("thttp-test-%s", acctest.RandString(10))
|
||||
backend := fmt.Sprintf("thttp-test-%s", acctest.RandString(10))
|
||||
hc := fmt.Sprintf("thttp-test-%s", acctest.RandString(10))
|
||||
urlmap1 := fmt.Sprintf("thttp-test-%s", acctest.RandString(10))
|
||||
urlmap2 := fmt.Sprintf("thttp-test-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeTargetHttpProxyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeTargetHttpProxy_basic1(target, backend, hc, urlmap1, urlmap2),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeTargetHttpProxyExists(
|
||||
"google_compute_target_http_proxy.foobar"),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_target_http_proxy.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeTargetHttpProxy_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -14,35 +14,6 @@ const (
|
|||
canonicalSslCertificateTemplate = "https://www.googleapis.com/compute/v1/projects/%s/global/sslCertificates/%s"
|
||||
)
|
||||
|
||||
func TestAccComputeTargetHttpsProxy_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
var proxy compute.TargetHttpsProxy
|
||||
resourceSuffix := acctest.RandString(10)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeTargetHttpsProxyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeTargetHttpsProxy_basic1(resourceSuffix),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeTargetHttpsProxyExists(
|
||||
"google_compute_target_https_proxy.foobar", &proxy),
|
||||
testAccComputeTargetHttpsProxyDescription("Resource created for Terraform acceptance testing", &proxy),
|
||||
testAccComputeTargetHttpsProxyHasSslCertificate("httpsproxy-test-cert1-"+resourceSuffix, &proxy),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_target_https_proxy.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeTargetHttpsProxy_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -9,34 +9,6 @@ import (
|
|||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccComputeTargetSslProxy_basic(t *testing.T) {
|
||||
target := fmt.Sprintf("tssl-test-%s", acctest.RandString(10))
|
||||
sslPolicy := fmt.Sprintf("tssl-test-%s", acctest.RandString(10))
|
||||
cert := fmt.Sprintf("tssl-test-%s", acctest.RandString(10))
|
||||
backend := fmt.Sprintf("tssl-test-%s", acctest.RandString(10))
|
||||
hc := fmt.Sprintf("tssl-test-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeTargetSslProxyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeTargetSslProxy_basic1(target, sslPolicy, cert, backend, hc),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeTargetSslProxy(
|
||||
"google_compute_target_ssl_proxy.foobar", "NONE", cert),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_target_ssl_proxy.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeTargetSslProxy_update(t *testing.T) {
|
||||
target := fmt.Sprintf("tssl-test-%s", acctest.RandString(10))
|
||||
sslPolicy := fmt.Sprintf("tssl-test-%s", acctest.RandString(10))
|
||||
|
|
|
@ -9,34 +9,6 @@ import (
|
|||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccComputeTargetTcpProxy_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
target := fmt.Sprintf("ttcp-test-%s", acctest.RandString(10))
|
||||
backend := fmt.Sprintf("ttcp-test-%s", acctest.RandString(10))
|
||||
hc := fmt.Sprintf("ttcp-test-%s", acctest.RandString(10))
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeTargetTcpProxyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeTargetTcpProxy_basic1(target, backend, hc),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeTargetTcpProxyExists(
|
||||
"google_compute_target_tcp_proxy.foobar"),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_target_tcp_proxy.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeTargetTcpProxy_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -9,34 +9,6 @@ import (
|
|||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccComputeUrlMap_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
bsName := fmt.Sprintf("urlmap-test-%s", acctest.RandString(10))
|
||||
hcName := fmt.Sprintf("urlmap-test-%s", acctest.RandString(10))
|
||||
umName := fmt.Sprintf("urlmap-test-%s", acctest.RandString(10))
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeUrlMapDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeUrlMap_basic1(bsName, hcName, umName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeUrlMapExists(
|
||||
"google_compute_url_map.foobar"),
|
||||
),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_url_map.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
ImportStateVerifyIgnore: []string{"host_rule", "path_matcher", "test"},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeUrlMap_update_path_matcher(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
package google
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
|
||||
"google.golang.org/api/compute/v1"
|
||||
)
|
||||
|
||||
func TestAccComputeVpnGateway_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeVpnGatewayDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeVpnGateway_basic(),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckComputeVpnGatewayExists(
|
||||
"google_compute_vpn_gateway.foobar"),
|
||||
testAccCheckComputeVpnGatewayExists(
|
||||
"google_compute_vpn_gateway.baz"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckComputeVpnGatewayExists(n string) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
rs, ok := s.RootModule().Resources[n]
|
||||
if !ok {
|
||||
return fmt.Errorf("Not found: %s", n)
|
||||
}
|
||||
|
||||
if rs.Primary.ID == "" {
|
||||
return fmt.Errorf("No ID is set")
|
||||
}
|
||||
|
||||
config := testAccProvider.Meta().(*Config)
|
||||
name := rs.Primary.Attributes["name"]
|
||||
region := rs.Primary.Attributes["region"]
|
||||
project := config.Project
|
||||
|
||||
vpnGatewaysService := compute.NewTargetVpnGatewaysService(config.clientCompute)
|
||||
_, err := vpnGatewaysService.Get(project, region, name).Do()
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error Reading VPN Gateway %s: %s", name, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func testAccComputeVpnGateway_basic() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_network" "foobar" {
|
||||
name = "gateway-test-%s"
|
||||
auto_create_subnetworks = false
|
||||
ipv4_range = "10.0.0.0/16"
|
||||
}
|
||||
|
||||
resource "google_compute_vpn_gateway" "foobar" {
|
||||
name = "gateway-test-%s"
|
||||
network = "${google_compute_network.foobar.self_link}"
|
||||
region = "us-central1"
|
||||
}
|
||||
resource "google_compute_vpn_gateway" "baz" {
|
||||
name = "gateway-test-%s"
|
||||
network = "${google_compute_network.foobar.name}"
|
||||
region = "us-central1"
|
||||
}`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10))
|
||||
}
|
|
@ -8,27 +8,6 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccComputeVpnTunnel_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckComputeVpnTunnelDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccComputeVpnTunnel_basic(),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_compute_vpn_tunnel.foobar",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
ImportStateVerifyIgnore: []string{"shared_secret"},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccComputeVpnTunnel_regionFromGateway(t *testing.T) {
|
||||
t.Parallel()
|
||||
region := "us-central1"
|
||||
|
@ -101,63 +80,6 @@ func TestAccComputeVpnTunnel_defaultTrafficSelectors(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccComputeVpnTunnel_basic() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_network" "foobar" {
|
||||
name = "tunnel-test-%s"
|
||||
auto_create_subnetworks = false
|
||||
}
|
||||
resource "google_compute_subnetwork" "foobar" {
|
||||
name = "tunnel-test-subnetwork-%s"
|
||||
network = "${google_compute_network.foobar.self_link}"
|
||||
ip_cidr_range = "10.0.0.0/16"
|
||||
region = "us-central1"
|
||||
}
|
||||
resource "google_compute_address" "foobar" {
|
||||
name = "tunnel-test-%s"
|
||||
region = "${google_compute_subnetwork.foobar.region}"
|
||||
}
|
||||
resource "google_compute_vpn_gateway" "foobar" {
|
||||
name = "tunnel-test-%s"
|
||||
network = "${google_compute_network.foobar.self_link}"
|
||||
region = "${google_compute_subnetwork.foobar.region}"
|
||||
}
|
||||
resource "google_compute_forwarding_rule" "foobar_esp" {
|
||||
name = "tunnel-test-%s"
|
||||
region = "${google_compute_vpn_gateway.foobar.region}"
|
||||
ip_protocol = "ESP"
|
||||
ip_address = "${google_compute_address.foobar.address}"
|
||||
target = "${google_compute_vpn_gateway.foobar.self_link}"
|
||||
}
|
||||
resource "google_compute_forwarding_rule" "foobar_udp500" {
|
||||
name = "tunnel-test-%s"
|
||||
region = "${google_compute_forwarding_rule.foobar_esp.region}"
|
||||
ip_protocol = "UDP"
|
||||
port_range = "500-500"
|
||||
ip_address = "${google_compute_address.foobar.address}"
|
||||
target = "${google_compute_vpn_gateway.foobar.self_link}"
|
||||
}
|
||||
resource "google_compute_forwarding_rule" "foobar_udp4500" {
|
||||
name = "tunnel-test-%s"
|
||||
region = "${google_compute_forwarding_rule.foobar_udp500.region}"
|
||||
ip_protocol = "UDP"
|
||||
port_range = "4500-4500"
|
||||
ip_address = "${google_compute_address.foobar.address}"
|
||||
target = "${google_compute_vpn_gateway.foobar.self_link}"
|
||||
}
|
||||
resource "google_compute_vpn_tunnel" "foobar" {
|
||||
name = "tunnel-test-%s"
|
||||
region = "${google_compute_forwarding_rule.foobar_udp4500.region}"
|
||||
target_vpn_gateway = "${google_compute_vpn_gateway.foobar.self_link}"
|
||||
shared_secret = "unguessable"
|
||||
peer_ip = "8.8.8.8"
|
||||
local_traffic_selector = ["${google_compute_subnetwork.foobar.ip_cidr_range}"]
|
||||
remote_traffic_selector = ["192.168.0.0/24", "192.168.1.0/24"]
|
||||
}`, acctest.RandString(10), acctest.RandString(10), acctest.RandString(10),
|
||||
acctest.RandString(10), acctest.RandString(10), acctest.RandString(10),
|
||||
acctest.RandString(10), acctest.RandString(10))
|
||||
}
|
||||
|
||||
func testAccComputeVpnTunnel_regionFromGateway(region string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_network" "foobar" {
|
||||
|
|
|
@ -8,28 +8,6 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccRedisInstance_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
name := acctest.RandomWithPrefix("tf-test")
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckRedisInstanceDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccRedisInstance_basic(name),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_redis_instance.test",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccRedisInstance_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -60,38 +38,6 @@ func TestAccRedisInstance_update(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestAccRedisInstance_full(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
name := acctest.RandomWithPrefix("tf-test")
|
||||
network := acctest.RandomWithPrefix("tf-test")
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckRedisInstanceDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccRedisInstance_full(name, network),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_redis_instance.test",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccRedisInstance_basic(name string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_redis_instance" "test" {
|
||||
name = "%s"
|
||||
memory_size_gb = 1
|
||||
region = "us-central1"
|
||||
}`, name)
|
||||
}
|
||||
|
||||
func testAccRedisInstance_update(name string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_redis_instance" "test" {
|
||||
|
@ -130,36 +76,3 @@ resource "google_redis_instance" "test" {
|
|||
}
|
||||
}`, name)
|
||||
}
|
||||
|
||||
func testAccRedisInstance_full(name, network string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_compute_network" "test" {
|
||||
name = "%s"
|
||||
}
|
||||
|
||||
resource "google_redis_instance" "test" {
|
||||
name = "%s"
|
||||
tier = "STANDARD_HA"
|
||||
memory_size_gb = 1
|
||||
|
||||
authorized_network = "${google_compute_network.test.self_link}"
|
||||
|
||||
region = "us-central1"
|
||||
location_id = "us-central1-a"
|
||||
alternative_location_id = "us-central1-f"
|
||||
|
||||
redis_version = "REDIS_3_2"
|
||||
display_name = "Terraform Test Instance"
|
||||
reserved_ip_range = "192.168.0.0/29"
|
||||
|
||||
labels = {
|
||||
my_key = "my_val"
|
||||
other_key = "other_val"
|
||||
}
|
||||
|
||||
redis_configs {
|
||||
maxmemory-policy = "allkeys-lru"
|
||||
notify-keyspace-events = "KEA"
|
||||
}
|
||||
}`, network, name)
|
||||
}
|
||||
|
|
|
@ -5,35 +5,8 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccStorageDefaultObjectAccessControl_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
bucketName := testBucketName()
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
if errObjectAcl != nil {
|
||||
panic(errObjectAcl)
|
||||
}
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccStorageDefaultObjectAccessControlDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testGoogleStorageDefaultObjectAccessControlBasic(bucketName, "READER", "allUsers"),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_storage_default_object_access_control.default",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccStorageDefaultObjectAccessControl_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -46,7 +19,7 @@ func TestAccStorageDefaultObjectAccessControl_update(t *testing.T) {
|
|||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccStorageDefaultObjectAccessControlDestroy,
|
||||
CheckDestroy: testAccCheckStorageDefaultObjectAccessControlDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testGoogleStorageDefaultObjectAccessControlBasic(bucketName, "READER", "allUsers"),
|
||||
|
@ -68,33 +41,6 @@ func TestAccStorageDefaultObjectAccessControl_update(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccStorageDefaultObjectAccessControlDestroy(s *terraform.State) error {
|
||||
config := testAccProvider.Meta().(*Config)
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "google_storage_bucket_acl" {
|
||||
continue
|
||||
}
|
||||
|
||||
bucket := rs.Primary.Attributes["bucket"]
|
||||
entity := rs.Primary.Attributes["entity"]
|
||||
|
||||
rePairs, err := config.clientStorage.DefaultObjectAccessControls.List(bucket).Do()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Can't list role entity acl for bucket %s", bucket)
|
||||
}
|
||||
|
||||
for _, v := range rePairs.Items {
|
||||
if v.Entity == entity {
|
||||
return fmt.Errorf("found entity %s as role entity acl entry in bucket %s", entity, bucket)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testGoogleStorageDefaultObjectAccessControlBasic(bucketName, role, entity string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_storage_bucket" "bucket" {
|
||||
|
|
|
@ -6,38 +6,8 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccStorageObjectAccessControl_basic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
bucketName := testBucketName()
|
||||
objectName := testAclObjectName()
|
||||
objectData := []byte("data data data")
|
||||
ioutil.WriteFile(tfObjectAcl.Name(), objectData, 0644)
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
if errObjectAcl != nil {
|
||||
panic(errObjectAcl)
|
||||
}
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccStorageObjectAccessControlDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testGoogleStorageObjectAccessControlBasic(bucketName, objectName, "READER", "allUsers"),
|
||||
},
|
||||
{
|
||||
ResourceName: "google_storage_object_access_control.default",
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccStorageObjectAccessControl_update(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
@ -53,7 +23,7 @@ func TestAccStorageObjectAccessControl_update(t *testing.T) {
|
|||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccStorageObjectAccessControlDestroy,
|
||||
CheckDestroy: testAccCheckStorageObjectAccessControlDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testGoogleStorageObjectAccessControlBasic(bucketName, objectName, "READER", "allUsers"),
|
||||
|
@ -75,34 +45,6 @@ func TestAccStorageObjectAccessControl_update(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func testAccStorageObjectAccessControlDestroy(s *terraform.State) error {
|
||||
config := testAccProvider.Meta().(*Config)
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "google_storage_bucket_acl" {
|
||||
continue
|
||||
}
|
||||
|
||||
bucket := rs.Primary.Attributes["bucket"]
|
||||
object := rs.Primary.Attributes["object"]
|
||||
entity := rs.Primary.Attributes["entity"]
|
||||
|
||||
rePairs, err := config.clientStorage.ObjectAccessControls.List(bucket, object).Do()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Can't list role entity acl for object %s in bucket %s", object, bucket)
|
||||
}
|
||||
|
||||
for _, v := range rePairs.Items {
|
||||
if v.Entity == entity {
|
||||
return fmt.Errorf("found entity %s as role entity acl entry for object %s in bucket %s", entity, object, bucket)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testGoogleStorageObjectAccessControlBasic(bucketName, objectName, role, entity string) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "google_storage_bucket" "bucket" {
|
||||
|
|
Loading…
Reference in New Issue
Block a user