Skip to content

Commit

Permalink
Add default url redirect to url maps (#3379) (#6203)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Apr 24, 2020
1 parent e8e6316 commit d003fbf
Show file tree
Hide file tree
Showing 6 changed files with 635 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changelog/3379.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:enhancement
compute: Added support for default URL redirects to `google_compute_url_map`
```
```release-note:enhancement
compute: Added support for default URL redirects to `google_compute_region_url_map`
```
40 changes: 40 additions & 0 deletions google/resource_compute_target_http_proxy_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,46 @@ resource "google_compute_http_health_check" "default" {
`, context)
}

func TestAccComputeTargetHttpProxy_targetHttpProxyHttpsRedirectExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckComputeTargetHttpProxyDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccComputeTargetHttpProxy_targetHttpProxyHttpsRedirectExample(context),
},
{
ResourceName: "google_compute_target_http_proxy.default",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccComputeTargetHttpProxy_targetHttpProxyHttpsRedirectExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_compute_target_http_proxy" "default" {
name = "tf-test-test-https-redirect-proxy%{random_suffix}"
url_map = google_compute_url_map.default.self_link
}
resource "google_compute_url_map" "default" {
name = "tf-test-url-map%{random_suffix}"
default_url_redirect {
https_redirect = true
}
}
`, context)
}

func testAccCheckComputeTargetHttpProxyDestroyProducer(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
for name, rs := range s.RootModule().Resources {
Expand Down
Loading

0 comments on commit d003fbf

Please sign in to comment.