mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-04 17:51:11 +00:00
Empty commit with no code changes
This commit is contained in:
parent
1c3da20140
commit
fc81c84ed3
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeAddress_addressBasicExample(t *testing.T) {
|
func TestAccComputeAddress_AddressBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeAddress_addressBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeAddressDestroy,
|
CheckDestroy: testAccCheckComputeAddressDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeAddress_addressBasicExample(acctest.RandString(10)),
|
Config: testAccComputeAddress_AddressBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_address.ip_address",
|
ResourceName: "google_compute_address.ip_address",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeAddress_addressBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeAddress_addressBasicExample(val string) string {
|
func testAccComputeAddress_AddressBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_address" "ip_address" {
|
resource "google_compute_address" "ip_address" {
|
||||||
name = "my-address-%s"
|
name = "my-address-%s"
|
||||||
@ -51,7 +51,7 @@ resource "google_compute_address" "ip_address" {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccComputeAddress_addressWithSubnetworkExample(t *testing.T) {
|
func TestAccComputeAddress_AddressWithSubnetworkExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -60,7 +60,7 @@ func TestAccComputeAddress_addressWithSubnetworkExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeAddressDestroy,
|
CheckDestroy: testAccCheckComputeAddressDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeAddress_addressWithSubnetworkExample(acctest.RandString(10)),
|
Config: testAccComputeAddress_AddressWithSubnetworkExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_address.internal_with_subnet_and_address",
|
ResourceName: "google_compute_address.internal_with_subnet_and_address",
|
||||||
@ -71,7 +71,7 @@ func TestAccComputeAddress_addressWithSubnetworkExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeAddress_addressWithSubnetworkExample(val string) string {
|
func testAccComputeAddress_AddressWithSubnetworkExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_network" "default" {
|
resource "google_compute_network" "default" {
|
||||||
name = "my-network-%s"
|
name = "my-network-%s"
|
||||||
@ -95,7 +95,7 @@ resource "google_compute_address" "internal_with_subnet_and_address" {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccComputeAddress_instanceWithIpExample(t *testing.T) {
|
func TestAccComputeAddress_InstanceWithIpExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -104,7 +104,7 @@ func TestAccComputeAddress_instanceWithIpExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeAddressDestroy,
|
CheckDestroy: testAccCheckComputeAddressDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeAddress_instanceWithIpExample(acctest.RandString(10)),
|
Config: testAccComputeAddress_InstanceWithIpExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_address.static",
|
ResourceName: "google_compute_address.static",
|
||||||
@ -115,7 +115,7 @@ func TestAccComputeAddress_instanceWithIpExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeAddress_instanceWithIpExample(val string) string {
|
func testAccComputeAddress_InstanceWithIpExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_address" "static" {
|
resource "google_compute_address" "static" {
|
||||||
name = "ipv4-address-%s"
|
name = "ipv4-address-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeAutoscaler_autoscalerBasicExample(t *testing.T) {
|
func TestAccComputeAutoscaler_AutoscalerBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeAutoscaler_autoscalerBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeAutoscalerDestroy,
|
CheckDestroy: testAccCheckComputeAutoscalerDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeAutoscaler_autoscalerBasicExample(acctest.RandString(10)),
|
Config: testAccComputeAutoscaler_AutoscalerBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_autoscaler.foobar",
|
ResourceName: "google_compute_autoscaler.foobar",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeAutoscaler_autoscalerBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeAutoscaler_autoscalerBasicExample(val string) string {
|
func testAccComputeAutoscaler_AutoscalerBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_autoscaler" "foobar" {
|
resource "google_compute_autoscaler" "foobar" {
|
||||||
name = "my-autoscaler-%s"
|
name = "my-autoscaler-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeBackendBucket_backendBucketBasicExample(t *testing.T) {
|
func TestAccComputeBackendBucket_BackendBucketBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeBackendBucket_backendBucketBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeBackendBucketDestroy,
|
CheckDestroy: testAccCheckComputeBackendBucketDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeBackendBucket_backendBucketBasicExample(acctest.RandString(10)),
|
Config: testAccComputeBackendBucket_BackendBucketBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_backend_bucket.image_backend",
|
ResourceName: "google_compute_backend_bucket.image_backend",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeBackendBucket_backendBucketBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeBackendBucket_backendBucketBasicExample(val string) string {
|
func testAccComputeBackendBucket_BackendBucketBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_backend_bucket" "image_backend" {
|
resource "google_compute_backend_bucket" "image_backend" {
|
||||||
name = "image-backend-bucket-%s"
|
name = "image-backend-bucket-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeDisk_diskBasicExample(t *testing.T) {
|
func TestAccComputeDisk_DiskBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeDisk_diskBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeDiskDestroy,
|
CheckDestroy: testAccCheckComputeDiskDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeDisk_diskBasicExample(acctest.RandString(10)),
|
Config: testAccComputeDisk_DiskBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_disk.default",
|
ResourceName: "google_compute_disk.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeDisk_diskBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeDisk_diskBasicExample(val string) string {
|
func testAccComputeDisk_DiskBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_disk" "default" {
|
resource "google_compute_disk" "default" {
|
||||||
name = "test-disk-%s"
|
name = "test-disk-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeFirewall_firewallBasicExample(t *testing.T) {
|
func TestAccComputeFirewall_FirewallBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeFirewall_firewallBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeFirewallDestroy,
|
CheckDestroy: testAccCheckComputeFirewallDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeFirewall_firewallBasicExample(acctest.RandString(10)),
|
Config: testAccComputeFirewall_FirewallBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_firewall.default",
|
ResourceName: "google_compute_firewall.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeFirewall_firewallBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeFirewall_firewallBasicExample(val string) string {
|
func testAccComputeFirewall_FirewallBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_firewall" "default" {
|
resource "google_compute_firewall" "default" {
|
||||||
name = "test-firewall-%s"
|
name = "test-firewall-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeForwardingRule_forwardingRuleBasicExample(t *testing.T) {
|
func TestAccComputeForwardingRule_ForwardingRuleBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeForwardingRule_forwardingRuleBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeForwardingRuleDestroy,
|
CheckDestroy: testAccCheckComputeForwardingRuleDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeForwardingRule_forwardingRuleBasicExample(acctest.RandString(10)),
|
Config: testAccComputeForwardingRule_ForwardingRuleBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_forwarding_rule.default",
|
ResourceName: "google_compute_forwarding_rule.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeForwardingRule_forwardingRuleBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeForwardingRule_forwardingRuleBasicExample(val string) string {
|
func testAccComputeForwardingRule_ForwardingRuleBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_forwarding_rule" "default" {
|
resource "google_compute_forwarding_rule" "default" {
|
||||||
name = "website-forwarding-rule-%s"
|
name = "website-forwarding-rule-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeGlobalAddress_globalAddressBasicExample(t *testing.T) {
|
func TestAccComputeGlobalAddress_GlobalAddressBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeGlobalAddress_globalAddressBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeGlobalAddressDestroy,
|
CheckDestroy: testAccCheckComputeGlobalAddressDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeGlobalAddress_globalAddressBasicExample(acctest.RandString(10)),
|
Config: testAccComputeGlobalAddress_GlobalAddressBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_global_address.default",
|
ResourceName: "google_compute_global_address.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeGlobalAddress_globalAddressBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeGlobalAddress_globalAddressBasicExample(val string) string {
|
func testAccComputeGlobalAddress_GlobalAddressBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_global_address" "default" {
|
resource "google_compute_global_address" "default" {
|
||||||
name = "global-appserver-ip-%s"
|
name = "global-appserver-ip-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeHealthCheck_healthCheckBasicExample(t *testing.T) {
|
func TestAccComputeHealthCheck_HealthCheckBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeHealthCheck_healthCheckBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
|
CheckDestroy: testAccCheckComputeHealthCheckDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeHealthCheck_healthCheckBasicExample(acctest.RandString(10)),
|
Config: testAccComputeHealthCheck_HealthCheckBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_health_check.internal-health-check",
|
ResourceName: "google_compute_health_check.internal-health-check",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeHealthCheck_healthCheckBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeHealthCheck_healthCheckBasicExample(val string) string {
|
func testAccComputeHealthCheck_HealthCheckBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_health_check" "internal-health-check" {
|
resource "google_compute_health_check" "internal-health-check" {
|
||||||
name = "internal-service-health-check-%s"
|
name = "internal-service-health-check-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeHttpHealthCheck_httpHealthCheckBasicExample(t *testing.T) {
|
func TestAccComputeHttpHealthCheck_HttpHealthCheckBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeHttpHealthCheck_httpHealthCheckBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeHttpHealthCheckDestroy,
|
CheckDestroy: testAccCheckComputeHttpHealthCheckDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeHttpHealthCheck_httpHealthCheckBasicExample(acctest.RandString(10)),
|
Config: testAccComputeHttpHealthCheck_HttpHealthCheckBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_http_health_check.default",
|
ResourceName: "google_compute_http_health_check.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeHttpHealthCheck_httpHealthCheckBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeHttpHealthCheck_httpHealthCheckBasicExample(val string) string {
|
func testAccComputeHttpHealthCheck_HttpHealthCheckBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_http_health_check" "default" {
|
resource "google_compute_http_health_check" "default" {
|
||||||
name = "authentication-health-check-%s"
|
name = "authentication-health-check-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeHttpsHealthCheck_httpsHealthCheckBasicExample(t *testing.T) {
|
func TestAccComputeHttpsHealthCheck_HttpsHealthCheckBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeHttpsHealthCheck_httpsHealthCheckBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeHttpsHealthCheckDestroy,
|
CheckDestroy: testAccCheckComputeHttpsHealthCheckDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeHttpsHealthCheck_httpsHealthCheckBasicExample(acctest.RandString(10)),
|
Config: testAccComputeHttpsHealthCheck_HttpsHealthCheckBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_https_health_check.default",
|
ResourceName: "google_compute_https_health_check.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeHttpsHealthCheck_httpsHealthCheckBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeHttpsHealthCheck_httpsHealthCheckBasicExample(val string) string {
|
func testAccComputeHttpsHealthCheck_HttpsHealthCheckBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_https_health_check" "default" {
|
resource "google_compute_https_health_check" "default" {
|
||||||
name = "authentication-health-check-%s"
|
name = "authentication-health-check-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeRegionAutoscaler_regionAutoscalerBasicExample(t *testing.T) {
|
func TestAccComputeRegionAutoscaler_RegionAutoscalerBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeRegionAutoscaler_regionAutoscalerBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeRegionAutoscalerDestroy,
|
CheckDestroy: testAccCheckComputeRegionAutoscalerDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeRegionAutoscaler_regionAutoscalerBasicExample(acctest.RandString(10)),
|
Config: testAccComputeRegionAutoscaler_RegionAutoscalerBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_region_autoscaler.foobar",
|
ResourceName: "google_compute_region_autoscaler.foobar",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeRegionAutoscaler_regionAutoscalerBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeRegionAutoscaler_regionAutoscalerBasicExample(val string) string {
|
func testAccComputeRegionAutoscaler_RegionAutoscalerBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_region_autoscaler" "foobar" {
|
resource "google_compute_region_autoscaler" "foobar" {
|
||||||
name = "my-region-autoscaler-%s"
|
name = "my-region-autoscaler-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeRegionDisk_regionDiskBasicExample(t *testing.T) {
|
func TestAccComputeRegionDisk_RegionDiskBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeRegionDisk_regionDiskBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeRegionDiskDestroy,
|
CheckDestroy: testAccCheckComputeRegionDiskDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeRegionDisk_regionDiskBasicExample(acctest.RandString(10)),
|
Config: testAccComputeRegionDisk_RegionDiskBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_region_disk.regiondisk",
|
ResourceName: "google_compute_region_disk.regiondisk",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeRegionDisk_regionDiskBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeRegionDisk_regionDiskBasicExample(val string) string {
|
func testAccComputeRegionDisk_RegionDiskBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_region_disk" "regiondisk" {
|
resource "google_compute_region_disk" "regiondisk" {
|
||||||
name = "my-region-disk-%s"
|
name = "my-region-disk-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeRoute_routeBasicExample(t *testing.T) {
|
func TestAccComputeRoute_RouteBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeRoute_routeBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeRouteDestroy,
|
CheckDestroy: testAccCheckComputeRouteDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeRoute_routeBasicExample(acctest.RandString(10)),
|
Config: testAccComputeRoute_RouteBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_route.default",
|
ResourceName: "google_compute_route.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeRoute_routeBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeRoute_routeBasicExample(val string) string {
|
func testAccComputeRoute_RouteBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_route" "default" {
|
resource "google_compute_route" "default" {
|
||||||
name = "network-route-%s"
|
name = "network-route-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeRouter_routerBasicExample(t *testing.T) {
|
func TestAccComputeRouter_RouterBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeRouter_routerBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeRouterDestroy,
|
CheckDestroy: testAccCheckComputeRouterDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeRouter_routerBasicExample(acctest.RandString(10)),
|
Config: testAccComputeRouter_RouterBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_router.foobar",
|
ResourceName: "google_compute_router.foobar",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeRouter_routerBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeRouter_routerBasicExample(val string) string {
|
func testAccComputeRouter_RouterBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_router" "foobar" {
|
resource "google_compute_router" "foobar" {
|
||||||
name = "my-router-%s"
|
name = "my-router-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeSslCertificate_sslCertificateBasicExample(t *testing.T) {
|
func TestAccComputeSslCertificate_SslCertificateBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeSslCertificate_sslCertificateBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
|
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeSslCertificate_sslCertificateBasicExample(acctest.RandString(10)),
|
Config: testAccComputeSslCertificate_SslCertificateBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_ssl_certificate.default",
|
ResourceName: "google_compute_ssl_certificate.default",
|
||||||
@ -43,7 +43,7 @@ func TestAccComputeSslCertificate_sslCertificateBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeSslCertificate_sslCertificateBasicExample(val string) string {
|
func testAccComputeSslCertificate_SslCertificateBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_ssl_certificate" "default" {
|
resource "google_compute_ssl_certificate" "default" {
|
||||||
name_prefix = "my-certificate-"
|
name_prefix = "my-certificate-"
|
||||||
@ -59,7 +59,7 @@ resource "google_compute_ssl_certificate" "default" {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccComputeSslCertificate_sslCertificateRandomProviderExample(t *testing.T) {
|
func TestAccComputeSslCertificate_SslCertificateRandomProviderExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -68,7 +68,7 @@ func TestAccComputeSslCertificate_sslCertificateRandomProviderExample(t *testing
|
|||||||
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
|
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeSslCertificate_sslCertificateRandomProviderExample(acctest.RandString(10)),
|
Config: testAccComputeSslCertificate_SslCertificateRandomProviderExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_ssl_certificate.default",
|
ResourceName: "google_compute_ssl_certificate.default",
|
||||||
@ -80,7 +80,7 @@ func TestAccComputeSslCertificate_sslCertificateRandomProviderExample(t *testing
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeSslCertificate_sslCertificateRandomProviderExample(val string) string {
|
func testAccComputeSslCertificate_SslCertificateRandomProviderExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
# You may also want to control name generation explicitly:
|
# You may also want to control name generation explicitly:
|
||||||
resource "google_compute_ssl_certificate" "default" {
|
resource "google_compute_ssl_certificate" "default" {
|
||||||
@ -109,7 +109,7 @@ resource "random_id" "certificate" {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccComputeSslCertificate_sslCertificateTargetHttpsProxiesExample(t *testing.T) {
|
func TestAccComputeSslCertificate_SslCertificateTargetHttpsProxiesExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -118,7 +118,7 @@ func TestAccComputeSslCertificate_sslCertificateTargetHttpsProxiesExample(t *tes
|
|||||||
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
|
CheckDestroy: testAccCheckComputeSslCertificateDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeSslCertificate_sslCertificateTargetHttpsProxiesExample(acctest.RandString(10)),
|
Config: testAccComputeSslCertificate_SslCertificateTargetHttpsProxiesExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_ssl_certificate.default",
|
ResourceName: "google_compute_ssl_certificate.default",
|
||||||
@ -130,7 +130,7 @@ func TestAccComputeSslCertificate_sslCertificateTargetHttpsProxiesExample(t *tes
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeSslCertificate_sslCertificateTargetHttpsProxiesExample(val string) string {
|
func testAccComputeSslCertificate_SslCertificateTargetHttpsProxiesExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
// Using with Target HTTPS Proxies
|
// Using with Target HTTPS Proxies
|
||||||
//
|
//
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeSslPolicy_sslPolicyBasicExample(t *testing.T) {
|
func TestAccComputeSslPolicy_SslPolicyBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeSslPolicy_sslPolicyBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
|
CheckDestroy: testAccCheckComputeSslPolicyDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeSslPolicy_sslPolicyBasicExample(acctest.RandString(10)),
|
Config: testAccComputeSslPolicy_SslPolicyBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_ssl_policy.prod-ssl-policy",
|
ResourceName: "google_compute_ssl_policy.prod-ssl-policy",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeSslPolicy_sslPolicyBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeSslPolicy_sslPolicyBasicExample(val string) string {
|
func testAccComputeSslPolicy_SslPolicyBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_ssl_policy" "prod-ssl-policy" {
|
resource "google_compute_ssl_policy" "prod-ssl-policy" {
|
||||||
name = "production-ssl-policy-%s"
|
name = "production-ssl-policy-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeSubnetwork_subnetworkBasicExample(t *testing.T) {
|
func TestAccComputeSubnetwork_SubnetworkBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeSubnetwork_subnetworkBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeSubnetworkDestroy,
|
CheckDestroy: testAccCheckComputeSubnetworkDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeSubnetwork_subnetworkBasicExample(acctest.RandString(10)),
|
Config: testAccComputeSubnetwork_SubnetworkBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_subnetwork.network-with-private-secondary-ip-ranges",
|
ResourceName: "google_compute_subnetwork.network-with-private-secondary-ip-ranges",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeSubnetwork_subnetworkBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeSubnetwork_subnetworkBasicExample(val string) string {
|
func testAccComputeSubnetwork_SubnetworkBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges" {
|
resource "google_compute_subnetwork" "network-with-private-secondary-ip-ranges" {
|
||||||
name = "test-subnetwork-%s"
|
name = "test-subnetwork-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeTargetHttpProxy_targetHttpProxyBasicExample(t *testing.T) {
|
func TestAccComputeTargetHttpProxy_TargetHttpProxyBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeTargetHttpProxy_targetHttpProxyBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeTargetHttpProxyDestroy,
|
CheckDestroy: testAccCheckComputeTargetHttpProxyDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeTargetHttpProxy_targetHttpProxyBasicExample(acctest.RandString(10)),
|
Config: testAccComputeTargetHttpProxy_TargetHttpProxyBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_target_http_proxy.default",
|
ResourceName: "google_compute_target_http_proxy.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeTargetHttpProxy_targetHttpProxyBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeTargetHttpProxy_targetHttpProxyBasicExample(val string) string {
|
func testAccComputeTargetHttpProxy_TargetHttpProxyBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_target_http_proxy" "default" {
|
resource "google_compute_target_http_proxy" "default" {
|
||||||
name = "test-proxy-%s"
|
name = "test-proxy-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeTargetHttpsProxy_targetHttpsProxyBasicExample(t *testing.T) {
|
func TestAccComputeTargetHttpsProxy_TargetHttpsProxyBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeTargetHttpsProxy_targetHttpsProxyBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeTargetHttpsProxyDestroy,
|
CheckDestroy: testAccCheckComputeTargetHttpsProxyDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeTargetHttpsProxy_targetHttpsProxyBasicExample(acctest.RandString(10)),
|
Config: testAccComputeTargetHttpsProxy_TargetHttpsProxyBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_target_https_proxy.default",
|
ResourceName: "google_compute_target_https_proxy.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeTargetHttpsProxy_targetHttpsProxyBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeTargetHttpsProxy_targetHttpsProxyBasicExample(val string) string {
|
func testAccComputeTargetHttpsProxy_TargetHttpsProxyBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_target_https_proxy" "default" {
|
resource "google_compute_target_https_proxy" "default" {
|
||||||
name = "test-proxy-%s"
|
name = "test-proxy-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeTargetSslProxy_targetSslProxyBasicExample(t *testing.T) {
|
func TestAccComputeTargetSslProxy_TargetSslProxyBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeTargetSslProxy_targetSslProxyBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeTargetSslProxyDestroy,
|
CheckDestroy: testAccCheckComputeTargetSslProxyDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeTargetSslProxy_targetSslProxyBasicExample(acctest.RandString(10)),
|
Config: testAccComputeTargetSslProxy_TargetSslProxyBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_target_ssl_proxy.default",
|
ResourceName: "google_compute_target_ssl_proxy.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeTargetSslProxy_targetSslProxyBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeTargetSslProxy_targetSslProxyBasicExample(val string) string {
|
func testAccComputeTargetSslProxy_TargetSslProxyBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_target_ssl_proxy" "default" {
|
resource "google_compute_target_ssl_proxy" "default" {
|
||||||
name = "test-proxy-%s"
|
name = "test-proxy-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeTargetTcpProxy_targetTcpProxyBasicExample(t *testing.T) {
|
func TestAccComputeTargetTcpProxy_TargetTcpProxyBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeTargetTcpProxy_targetTcpProxyBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeTargetTcpProxyDestroy,
|
CheckDestroy: testAccCheckComputeTargetTcpProxyDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeTargetTcpProxy_targetTcpProxyBasicExample(acctest.RandString(10)),
|
Config: testAccComputeTargetTcpProxy_TargetTcpProxyBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_target_tcp_proxy.default",
|
ResourceName: "google_compute_target_tcp_proxy.default",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeTargetTcpProxy_targetTcpProxyBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeTargetTcpProxy_targetTcpProxyBasicExample(val string) string {
|
func testAccComputeTargetTcpProxy_TargetTcpProxyBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_target_tcp_proxy" "default" {
|
resource "google_compute_target_tcp_proxy" "default" {
|
||||||
name = "test-proxy-%s"
|
name = "test-proxy-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeUrlMap_urlMapBasicExample(t *testing.T) {
|
func TestAccComputeUrlMap_UrlMapBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeUrlMap_urlMapBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeUrlMapDestroy,
|
CheckDestroy: testAccCheckComputeUrlMapDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeUrlMap_urlMapBasicExample(acctest.RandString(10)),
|
Config: testAccComputeUrlMap_UrlMapBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_url_map.urlmap",
|
ResourceName: "google_compute_url_map.urlmap",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeUrlMap_urlMapBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeUrlMap_urlMapBasicExample(val string) string {
|
func testAccComputeUrlMap_UrlMapBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_url_map" "urlmap" {
|
resource "google_compute_url_map" "urlmap" {
|
||||||
name = "urlmap-%s"
|
name = "urlmap-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeVpnGateway_targetVpnGatewayBasicExample(t *testing.T) {
|
func TestAccComputeVpnGateway_TargetVpnGatewayBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeVpnGateway_targetVpnGatewayBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeVpnGatewayDestroy,
|
CheckDestroy: testAccCheckComputeVpnGatewayDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeVpnGateway_targetVpnGatewayBasicExample(acctest.RandString(10)),
|
Config: testAccComputeVpnGateway_TargetVpnGatewayBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_vpn_gateway.target_gateway",
|
ResourceName: "google_compute_vpn_gateway.target_gateway",
|
||||||
@ -42,7 +42,7 @@ func TestAccComputeVpnGateway_targetVpnGatewayBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeVpnGateway_targetVpnGatewayBasicExample(val string) string {
|
func testAccComputeVpnGateway_TargetVpnGatewayBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_vpn_gateway" "target_gateway" {
|
resource "google_compute_vpn_gateway" "target_gateway" {
|
||||||
name = "vpn1-%s"
|
name = "vpn1-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccComputeVpnTunnel_vpnTunnelBasicExample(t *testing.T) {
|
func TestAccComputeVpnTunnel_VpnTunnelBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccComputeVpnTunnel_vpnTunnelBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckComputeVpnTunnelDestroy,
|
CheckDestroy: testAccCheckComputeVpnTunnelDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccComputeVpnTunnel_vpnTunnelBasicExample(acctest.RandString(10)),
|
Config: testAccComputeVpnTunnel_VpnTunnelBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_compute_vpn_tunnel.tunnel1",
|
ResourceName: "google_compute_vpn_tunnel.tunnel1",
|
||||||
@ -43,7 +43,7 @@ func TestAccComputeVpnTunnel_vpnTunnelBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccComputeVpnTunnel_vpnTunnelBasicExample(val string) string {
|
func testAccComputeVpnTunnel_VpnTunnelBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_compute_vpn_tunnel" "tunnel1" {
|
resource "google_compute_vpn_tunnel" "tunnel1" {
|
||||||
name = "tunnel1-%s"
|
name = "tunnel1-%s"
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"github.com/hashicorp/terraform/helper/resource"
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccRedisInstance_redisInstanceBasicExample(t *testing.T) {
|
func TestAccRedisInstance_RedisInstanceBasicExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -31,7 +31,7 @@ func TestAccRedisInstance_redisInstanceBasicExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckRedisInstanceDestroy,
|
CheckDestroy: testAccCheckRedisInstanceDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccRedisInstance_redisInstanceBasicExample(acctest.RandString(10)),
|
Config: testAccRedisInstance_RedisInstanceBasicExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_redis_instance.cache",
|
ResourceName: "google_redis_instance.cache",
|
||||||
@ -43,7 +43,7 @@ func TestAccRedisInstance_redisInstanceBasicExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccRedisInstance_redisInstanceBasicExample(val string) string {
|
func testAccRedisInstance_RedisInstanceBasicExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_redis_instance" "cache" {
|
resource "google_redis_instance" "cache" {
|
||||||
name = "memory-cache-%s"
|
name = "memory-cache-%s"
|
||||||
@ -53,7 +53,7 @@ resource "google_redis_instance" "cache" {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccRedisInstance_redisInstanceFullExample(t *testing.T) {
|
func TestAccRedisInstance_RedisInstanceFullExample(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
@ -62,7 +62,7 @@ func TestAccRedisInstance_redisInstanceFullExample(t *testing.T) {
|
|||||||
CheckDestroy: testAccCheckRedisInstanceDestroy,
|
CheckDestroy: testAccCheckRedisInstanceDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccRedisInstance_redisInstanceFullExample(acctest.RandString(10)),
|
Config: testAccRedisInstance_RedisInstanceFullExample(acctest.RandString(10)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_redis_instance.cache",
|
ResourceName: "google_redis_instance.cache",
|
||||||
@ -74,7 +74,7 @@ func TestAccRedisInstance_redisInstanceFullExample(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccRedisInstance_redisInstanceFullExample(val string) string {
|
func testAccRedisInstance_RedisInstanceFullExample(val string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_redis_instance" "cache" {
|
resource "google_redis_instance" "cache" {
|
||||||
name = "ha-memory-cache-%s"
|
name = "ha-memory-cache-%s"
|
||||||
|
@ -13,20 +13,17 @@ import (
|
|||||||
"google.golang.org/api/spanner/v1"
|
"google.golang.org/api/spanner/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
spannerDatabaseNameFormat = "^[a-z][a-z0-9_-]*[a-z0-9]$"
|
|
||||||
)
|
|
||||||
|
|
||||||
func resourceSpannerDatabase() *schema.Resource {
|
func resourceSpannerDatabase() *schema.Resource {
|
||||||
return &schema.Resource{
|
return &schema.Resource{
|
||||||
Create: resourceSpannerDatabaseCreate,
|
Create: resourceSpannerDatabaseCreate,
|
||||||
Read: resourceSpannerDatabaseRead,
|
Read: resourceSpannerDatabaseRead,
|
||||||
Delete: resourceSpannerDatabaseDelete,
|
Delete: resourceSpannerDatabaseDelete,
|
||||||
Importer: &schema.ResourceImporter{
|
Importer: &schema.ResourceImporter{
|
||||||
State: resourceSpannerDatabaseImport,
|
State: resourceSpannerDatabaseImportState,
|
||||||
},
|
},
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
|
|
||||||
"instance": &schema.Schema{
|
"instance": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
@ -37,7 +34,27 @@ func resourceSpannerDatabase() *schema.Resource {
|
|||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
ForceNew: true,
|
ForceNew: true,
|
||||||
ValidateFunc: validateResourceSpannerDatabaseName,
|
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
|
||||||
|
value := v.(string)
|
||||||
|
|
||||||
|
if len(value) < 2 && len(value) > 30 {
|
||||||
|
errors = append(errors, fmt.Errorf(
|
||||||
|
"%q must be between 2 and 30 characters in length", k))
|
||||||
|
}
|
||||||
|
if !regexp.MustCompile("^[a-z0-9-]+$").MatchString(value) {
|
||||||
|
errors = append(errors, fmt.Errorf(
|
||||||
|
"%q can only contain lowercase letters, numbers and hyphens", k))
|
||||||
|
}
|
||||||
|
if !regexp.MustCompile("^[a-z]").MatchString(value) {
|
||||||
|
errors = append(errors, fmt.Errorf(
|
||||||
|
"%q must start with a letter", k))
|
||||||
|
}
|
||||||
|
if !regexp.MustCompile("[a-z0-9]$").MatchString(value) {
|
||||||
|
errors = append(errors, fmt.Errorf(
|
||||||
|
"%q must end with a number or a letter", k))
|
||||||
|
}
|
||||||
|
return
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
"project": {
|
"project": {
|
||||||
@ -137,23 +154,25 @@ func resourceSpannerDatabaseDelete(d *schema.ResourceData, meta interface{}) err
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceSpannerDatabaseImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
|
func resourceSpannerDatabaseImportState(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
|
||||||
config := meta.(*Config)
|
config := meta.(*Config)
|
||||||
err := parseImportId([]string{
|
id, err := importSpannerDatabaseId(d.Id())
|
||||||
"projects/(?P<project>[^/]+)/instances/(?P<instance>[^/]+)/databases/(?P<name>[^/]+)",
|
|
||||||
"instances/(?P<instance>[^/]+)/databases/(?P<name>[^/]+)",
|
|
||||||
"(?P<project>[^/]+)/(?P<instance>[^/]+)/(?P<name>[^/]+)",
|
|
||||||
"(?P<instance>[^/]+)/(?P<name>[^/]+)",
|
|
||||||
}, d, config)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Error constructing id: %s", err)
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
id, err := buildSpannerDatabaseId(d, config)
|
if id.Project != "" {
|
||||||
|
d.Set("project", id.Project)
|
||||||
|
} else {
|
||||||
|
project, err := getProject(d, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Error constructing id: %s", err)
|
return nil, err
|
||||||
|
}
|
||||||
|
id.Project = project
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.Set("instance", id.Instance)
|
||||||
|
d.Set("name", id.Database)
|
||||||
d.SetId(id.terraformId())
|
d.SetId(id.terraformId())
|
||||||
|
|
||||||
return []*schema.ResourceData{d}, nil
|
return []*schema.ResourceData{d}, nil
|
||||||
@ -196,8 +215,26 @@ func (s spannerDatabaseId) databaseUri() string {
|
|||||||
return fmt.Sprintf("%s/databases/%s", s.parentInstanceUri(), s.Database)
|
return fmt.Sprintf("%s/databases/%s", s.parentInstanceUri(), s.Database)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func importSpannerDatabaseId(id string) (*spannerDatabaseId, error) {
|
||||||
|
if !regexp.MustCompile("^[a-z0-9-]+/[a-z0-9-]+$").Match([]byte(id)) &&
|
||||||
|
!regexp.MustCompile("^"+ProjectRegex+"/[a-z0-9-]+/[a-z0-9-]+$").Match([]byte(id)) {
|
||||||
|
return nil, fmt.Errorf("Invalid spanner database specifier. " +
|
||||||
|
"Expecting either {projectId}/{instanceId}/{dbId} OR " +
|
||||||
|
"{instanceId}/{dbId} (where project will be derived from the provider)")
|
||||||
|
}
|
||||||
|
|
||||||
|
parts := strings.Split(id, "/")
|
||||||
|
if len(parts) == 2 {
|
||||||
|
log.Printf("[INFO] Spanner database import format of {instanceId}/{dbId} specified: %s", id)
|
||||||
|
return &spannerDatabaseId{Instance: parts[0], Database: parts[1]}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("[INFO] Spanner database import format of {projectId}/{instanceId}/{dbId} specified: %s", id)
|
||||||
|
return extractSpannerDatabaseId(id)
|
||||||
|
}
|
||||||
|
|
||||||
func extractSpannerDatabaseId(id string) (*spannerDatabaseId, error) {
|
func extractSpannerDatabaseId(id string) (*spannerDatabaseId, error) {
|
||||||
if !regexp.MustCompile(fmt.Sprintf("^%s/[a-z0-9-]+/%s$", ProjectRegex, spannerDatabaseNameFormat)).Match([]byte(id)) {
|
if !regexp.MustCompile("^" + ProjectRegex + "/[a-z0-9-]+/[a-z0-9-]+$").Match([]byte(id)) {
|
||||||
return nil, fmt.Errorf("Invalid spanner id format, expecting {projectId}/{instanceId}/{databaseId}")
|
return nil, fmt.Errorf("Invalid spanner id format, expecting {projectId}/{instanceId}/{databaseId}")
|
||||||
}
|
}
|
||||||
parts := strings.Split(id, "/")
|
parts := strings.Split(id, "/")
|
||||||
@ -207,17 +244,3 @@ func extractSpannerDatabaseId(id string) (*spannerDatabaseId, error) {
|
|||||||
Database: parts[2],
|
Database: parts[2],
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateResourceSpannerDatabaseName(v interface{}, k string) (ws []string, errors []error) {
|
|
||||||
value := v.(string)
|
|
||||||
|
|
||||||
if len(value) < 2 && len(value) > 30 {
|
|
||||||
errors = append(errors, fmt.Errorf(
|
|
||||||
"%q must be between 2 and 30 characters in length", k))
|
|
||||||
}
|
|
||||||
|
|
||||||
if !regexp.MustCompile(spannerDatabaseNameFormat).MatchString(value) {
|
|
||||||
errors = append(errors, fmt.Errorf("database name %q must match regexp %q", value, spannerDatabaseNameFormat))
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
@ -3,6 +3,7 @@ package google
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/hashicorp/errwrap"
|
"github.com/hashicorp/errwrap"
|
||||||
@ -13,49 +14,126 @@ import (
|
|||||||
"google.golang.org/api/googleapi"
|
"google.golang.org/api/googleapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Unit Tests
|
||||||
|
|
||||||
|
func TestDatabaseNameForApi(t *testing.T) {
|
||||||
|
id := spannerDatabaseId{
|
||||||
|
Project: "project123",
|
||||||
|
Instance: "instance456",
|
||||||
|
Database: "db789",
|
||||||
|
}
|
||||||
|
actual := id.databaseUri()
|
||||||
|
expected := "projects/project123/instances/instance456/databases/db789"
|
||||||
|
expectEquals(t, expected, actual)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestImportSpannerDatabaseId_InstanceDB(t *testing.T) {
|
||||||
|
id, e := importSpannerDatabaseId("instance456/database789")
|
||||||
|
if e != nil {
|
||||||
|
t.Errorf("Error should have been nil")
|
||||||
|
}
|
||||||
|
expectEquals(t, "", id.Project)
|
||||||
|
expectEquals(t, "instance456", id.Instance)
|
||||||
|
expectEquals(t, "database789", id.Database)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestImportSpannerDatabaseId_ProjectInstanceDB(t *testing.T) {
|
||||||
|
id, e := importSpannerDatabaseId("project123/instance456/database789")
|
||||||
|
if e != nil {
|
||||||
|
t.Errorf("Error should have been nil")
|
||||||
|
}
|
||||||
|
expectEquals(t, "project123", id.Project)
|
||||||
|
expectEquals(t, "instance456", id.Instance)
|
||||||
|
expectEquals(t, "database789", id.Database)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestImportSpannerDatabaseId_projectId(t *testing.T) {
|
||||||
|
shouldPass := []string{
|
||||||
|
"project-id/instance/database",
|
||||||
|
"123123/instance/123",
|
||||||
|
"hashicorptest.net:project-123/instance/123",
|
||||||
|
"123/456/789",
|
||||||
|
}
|
||||||
|
|
||||||
|
shouldFail := []string{
|
||||||
|
"project-id#/instance/database",
|
||||||
|
"project-id/instance#/database",
|
||||||
|
"project-id/instance/database#",
|
||||||
|
"hashicorptest.net:project-123:invalid:project/instance/123",
|
||||||
|
"hashicorptest.net:/instance/123",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, element := range shouldPass {
|
||||||
|
_, e := importSpannerDatabaseId(element)
|
||||||
|
if e != nil {
|
||||||
|
t.Error("importSpannerDatabaseId should pass on '" + element + "' but doesn't")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, element := range shouldFail {
|
||||||
|
_, e := importSpannerDatabaseId(element)
|
||||||
|
if e == nil {
|
||||||
|
t.Error("importSpannerDatabaseId should fail on '" + element + "' but doesn't")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestImportSpannerDatabaseId_invalidLeadingSlash(t *testing.T) {
|
||||||
|
id, e := importSpannerDatabaseId("/instance456/database789")
|
||||||
|
expectInvalidSpannerDbImportId(t, id, e)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestImportSpannerDatabaseId_invalidTrailingSlash(t *testing.T) {
|
||||||
|
id, e := importSpannerDatabaseId("instance456/database789/")
|
||||||
|
expectInvalidSpannerDbImportId(t, id, e)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestImportSpannerDatabaseId_invalidSingleSlash(t *testing.T) {
|
||||||
|
id, e := importSpannerDatabaseId("/")
|
||||||
|
expectInvalidSpannerDbImportId(t, id, e)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestImportSpannerDatabaseId_invalidMultiSlash(t *testing.T) {
|
||||||
|
id, e := importSpannerDatabaseId("project123/instance456/db789/next")
|
||||||
|
expectInvalidSpannerDbImportId(t, id, e)
|
||||||
|
}
|
||||||
|
|
||||||
|
func expectInvalidSpannerDbImportId(t *testing.T, id *spannerDatabaseId, e error) {
|
||||||
|
if id != nil {
|
||||||
|
t.Errorf("Expected spannerDatabaseId to be nil")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if e == nil {
|
||||||
|
t.Errorf("Expected an Error but did not get one")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !strings.HasPrefix(e.Error(), "Invalid spanner database specifier") {
|
||||||
|
t.Errorf("Expecting Error starting with 'Invalid spanner database specifier'")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Acceptance Tests
|
||||||
|
|
||||||
func TestAccSpannerDatabase_basic(t *testing.T) {
|
func TestAccSpannerDatabase_basic(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
project := getTestProjectFromEnv()
|
|
||||||
rnd := acctest.RandString(10)
|
rnd := acctest.RandString(10)
|
||||||
instanceName := fmt.Sprintf("my-instance-%s", rnd)
|
|
||||||
databaseName := fmt.Sprintf("mydb_%s", rnd)
|
|
||||||
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckSpannerDatabaseDestroy,
|
CheckDestroy: testAccCheckSpannerDatabaseDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccSpannerDatabase_basic(instanceName, databaseName),
|
Config: testAccSpannerDatabase_basic(rnd),
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
resource.TestCheckResourceAttrSet("google_spanner_database.basic", "state"),
|
resource.TestCheckResourceAttrSet("google_spanner_database.basic", "state"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Test import with default Terraform ID
|
|
||||||
ResourceName: "google_spanner_database.basic",
|
ResourceName: "google_spanner_database.basic",
|
||||||
ImportState: true,
|
ImportState: true,
|
||||||
ImportStateVerify: true,
|
ImportStateVerify: true,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
ResourceName: "google_spanner_database.basic",
|
|
||||||
ImportStateId: fmt.Sprintf("projects/%s/instances/%s/databases/%s", project, instanceName, databaseName),
|
|
||||||
ImportState: true,
|
|
||||||
ImportStateVerify: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ResourceName: "google_spanner_database.basic",
|
|
||||||
ImportStateId: fmt.Sprintf("instances/%s/databases/%s", instanceName, databaseName),
|
|
||||||
ImportState: true,
|
|
||||||
ImportStateVerify: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ResourceName: "google_spanner_database.basic",
|
|
||||||
ImportStateId: fmt.Sprintf("%s/%s", instanceName, databaseName),
|
|
||||||
ImportState: true,
|
|
||||||
ImportStateVerify: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -64,15 +142,13 @@ func TestAccSpannerDatabase_basicWithInitialDDL(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
rnd := acctest.RandString(10)
|
rnd := acctest.RandString(10)
|
||||||
instanceName := fmt.Sprintf("my-instance-%s", rnd)
|
|
||||||
databaseName := fmt.Sprintf("mydb-%s", rnd)
|
|
||||||
resource.Test(t, resource.TestCase{
|
resource.Test(t, resource.TestCase{
|
||||||
PreCheck: func() { testAccPreCheck(t) },
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
Providers: testAccProviders,
|
Providers: testAccProviders,
|
||||||
CheckDestroy: testAccCheckSpannerDatabaseDestroy,
|
CheckDestroy: testAccCheckSpannerDatabaseDestroy,
|
||||||
Steps: []resource.TestStep{
|
Steps: []resource.TestStep{
|
||||||
{
|
{
|
||||||
Config: testAccSpannerDatabase_basicWithInitialDDL(instanceName, databaseName),
|
Config: testAccSpannerDatabase_basicWithInitialDDL(rnd),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ResourceName: "google_spanner_database.basic",
|
ResourceName: "google_spanner_database.basic",
|
||||||
@ -125,49 +201,37 @@ func testAccCheckSpannerDatabaseDestroy(s *terraform.State) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccSpannerDatabase_basic(instanceName, databaseName string) string {
|
func testAccSpannerDatabase_basic(rnd string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_spanner_instance" "basic" {
|
resource "google_spanner_instance" "basic" {
|
||||||
name = "%s"
|
name = "my-instance-%s"
|
||||||
config = "regional-us-central1"
|
config = "regional-us-central1"
|
||||||
display_name = "display-%s"
|
display_name = "my-displayname-%s"
|
||||||
num_nodes = 1
|
num_nodes = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_spanner_database" "basic" {
|
resource "google_spanner_database" "basic" {
|
||||||
instance = "${google_spanner_instance.basic.name}"
|
instance = "${google_spanner_instance.basic.name}"
|
||||||
name = "%s"
|
name = "my-db-%s"
|
||||||
}
|
}
|
||||||
`, instanceName, instanceName, databaseName)
|
`, rnd, rnd, rnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccSpannerDatabase_basicWithInitialDDL(instanceName, databaseName string) string {
|
func testAccSpannerDatabase_basicWithInitialDDL(rnd string) string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
resource "google_spanner_instance" "basic" {
|
resource "google_spanner_instance" "basic" {
|
||||||
name = "%s"
|
name = "my-instance-%s"
|
||||||
config = "regional-us-central1"
|
config = "regional-us-central1"
|
||||||
display_name = "display-%s"
|
display_name = "my-displayname-%s"
|
||||||
num_nodes = 1
|
num_nodes = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "google_spanner_database" "basic" {
|
resource "google_spanner_database" "basic" {
|
||||||
instance = "${google_spanner_instance.basic.name}"
|
instance = "${google_spanner_instance.basic.name}"
|
||||||
name = "%s"
|
name = "my-db-%s"
|
||||||
ddl = [
|
ddl = [
|
||||||
"CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)",
|
"CREATE TABLE t1 (t1 INT64 NOT NULL,) PRIMARY KEY(t1)",
|
||||||
"CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)" ]
|
"CREATE TABLE t2 (t2 INT64 NOT NULL,) PRIMARY KEY(t2)" ]
|
||||||
}
|
}
|
||||||
`, instanceName, instanceName, databaseName)
|
`, rnd, rnd, rnd)
|
||||||
}
|
|
||||||
|
|
||||||
// Unit Tests for type spannerDatabaseId
|
|
||||||
func TestDatabaseNameForApi(t *testing.T) {
|
|
||||||
id := spannerDatabaseId{
|
|
||||||
Project: "project123",
|
|
||||||
Instance: "instance456",
|
|
||||||
Database: "db789",
|
|
||||||
}
|
|
||||||
actual := id.databaseUri()
|
|
||||||
expected := "projects/project123/instances/instance456/databases/db789"
|
|
||||||
expectEquals(t, expected, actual)
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user