mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-09-07 01:26:43 +00:00
99 lines
2.7 KiB
Go
99 lines
2.7 KiB
Go
![]() |
// ----------------------------------------------------------------------------
|
||
|
//
|
||
|
// *** 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"
|
||
|
)
|
||
|
|
||
|
func TestAccComputeTargetHttpsProxy_targetHttpsProxyBasicExample(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
|
||
|
resource.Test(t, resource.TestCase{
|
||
|
PreCheck: func() { testAccPreCheck(t) },
|
||
|
Providers: testAccProviders,
|
||
|
CheckDestroy: testAccCheckComputeTargetHttpsProxyDestroy,
|
||
|
Steps: []resource.TestStep{
|
||
|
{
|
||
|
Config: testAccComputeTargetHttpsProxy_targetHttpsProxyBasicExample(acctest.RandString(10)),
|
||
|
},
|
||
|
{
|
||
|
ResourceName: "google_compute_target_https_proxy.default",
|
||
|
ImportState: true,
|
||
|
ImportStateVerify: true,
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func testAccComputeTargetHttpsProxy_targetHttpsProxyBasicExample(val string) string {
|
||
|
return fmt.Sprintf(`
|
||
|
resource "google_compute_target_https_proxy" "default" {
|
||
|
name = "test-proxy-%s"
|
||
|
url_map = "${google_compute_url_map.default.self_link}"
|
||
|
ssl_certificates = ["${google_compute_ssl_certificate.default.self_link}"]
|
||
|
}
|
||
|
|
||
|
resource "google_compute_ssl_certificate" "default" {
|
||
|
name = "my-certificate-%s"
|
||
|
private_key = "${file("test-fixtures/ssl_cert/test.key")}"
|
||
|
certificate = "${file("test-fixtures/ssl_cert/test.crt")}"
|
||
|
}
|
||
|
|
||
|
resource "google_compute_url_map" "default" {
|
||
|
name = "url-map-%s"
|
||
|
description = "a description"
|
||
|
|
||
|
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, val,
|
||
|
)
|
||
|
}
|