terraform-provider-google/google/resource_compute_target_http_proxy_generated_test.go

90 lines
2.4 KiB
Go
Raw Normal View History

// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Magic Modules and manual
// changes will be clobbered when the file is regenerated.
//
// Please read more about how to change this file in
// .github/CONTRIBUTING.md.
//
// ----------------------------------------------------------------------------
package google
import (
"fmt"
"testing"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)
2018-10-24 19:06:09 +00:00
func TestAccComputeTargetHttpProxy_TargetHttpProxyBasicExample(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeTargetHttpProxyDestroy,
Steps: []resource.TestStep{
{
2018-10-24 19:06:09 +00:00
Config: testAccComputeTargetHttpProxy_TargetHttpProxyBasicExample(acctest.RandString(10)),
},
{
ResourceName: "google_compute_target_http_proxy.default",
ImportState: true,
ImportStateVerify: true,
},
},
})
}
2018-10-24 19:06:09 +00:00
func testAccComputeTargetHttpProxy_TargetHttpProxyBasicExample(val string) string {
return fmt.Sprintf(`
resource "google_compute_target_http_proxy" "default" {
name = "test-proxy-%s"
url_map = "${google_compute_url_map.default.self_link}"
}
resource "google_compute_url_map" "default" {
name = "url-map-%s"
default_service = "${google_compute_backend_service.default.self_link}"
host_rule {
hosts = ["mysite.com"]
path_matcher = "allpaths"
}
path_matcher {
name = "allpaths"
default_service = "${google_compute_backend_service.default.self_link}"
path_rule {
paths = ["/*"]
service = "${google_compute_backend_service.default.self_link}"
}
}
}
resource "google_compute_backend_service" "default" {
name = "backend-service-%s"
port_name = "http"
protocol = "HTTP"
timeout_sec = 10
health_checks = ["${google_compute_http_health_check.default.self_link}"]
}
resource "google_compute_http_health_check" "default" {
name = "http-health-check-%s"
request_path = "/"
check_interval_sec = 1
timeout_sec = 1
}
`, val, val, val, val,
)
}