mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-03 08:42:39 +00:00
Support import for google_compute_https_health_check (#213)
This commit is contained in:
parent
236c0f5d24
commit
f4db3fd1aa
28
google/import_compute_https_health_check_test.go
Normal file
28
google/import_compute_https_health_check_test.go
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||||||
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAccComputeHttpsHealthCheck_importBasic(t *testing.T) {
|
||||||
|
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{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccComputeHttpsHealthCheck_basic(hhckName),
|
||||||
|
},
|
||||||
|
resource.TestStep{
|
||||||
|
ResourceName: "google_compute_https_health_check.foobar",
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateVerify: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
|
@ -14,6 +14,9 @@ func resourceComputeHttpsHealthCheck() *schema.Resource {
|
||||||
Read: resourceComputeHttpsHealthCheckRead,
|
Read: resourceComputeHttpsHealthCheckRead,
|
||||||
Delete: resourceComputeHttpsHealthCheckDelete,
|
Delete: resourceComputeHttpsHealthCheckDelete,
|
||||||
Update: resourceComputeHttpsHealthCheckUpdate,
|
Update: resourceComputeHttpsHealthCheckUpdate,
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: schema.ImportStatePassthrough,
|
||||||
|
},
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"name": &schema.Schema{
|
"name": &schema.Schema{
|
||||||
|
@ -208,10 +211,12 @@ func resourceComputeHttpsHealthCheckRead(d *schema.ResourceData, meta interface{
|
||||||
return handleNotFoundError(err, d, fmt.Sprintf("HTTPS Health Check %q", d.Get("name").(string)))
|
return handleNotFoundError(err, d, fmt.Sprintf("HTTPS Health Check %q", d.Get("name").(string)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.Set("name", hchk.Name)
|
||||||
|
d.Set("description", hchk.Description)
|
||||||
d.Set("host", hchk.Host)
|
d.Set("host", hchk.Host)
|
||||||
d.Set("request_path", hchk.RequestPath)
|
d.Set("request_path", hchk.RequestPath)
|
||||||
d.Set("check_interval_sec", hchk.CheckIntervalSec)
|
d.Set("check_interval_sec", hchk.CheckIntervalSec)
|
||||||
d.Set("health_threshold", hchk.HealthyThreshold)
|
d.Set("healthy_threshold", hchk.HealthyThreshold)
|
||||||
d.Set("port", hchk.Port)
|
d.Set("port", hchk.Port)
|
||||||
d.Set("timeout_sec", hchk.TimeoutSec)
|
d.Set("timeout_sec", hchk.TimeoutSec)
|
||||||
d.Set("unhealthy_threshold", hchk.UnhealthyThreshold)
|
d.Set("unhealthy_threshold", hchk.UnhealthyThreshold)
|
||||||
|
|
|
@ -61,3 +61,11 @@ The following arguments are supported:
|
||||||
The following attributes are exported:
|
The following attributes are exported:
|
||||||
|
|
||||||
* `self_link` - The URL of the created resource.
|
* `self_link` - The URL of the created resource.
|
||||||
|
|
||||||
|
## Import
|
||||||
|
|
||||||
|
HTTPS health checks can be imported using the `name`, e.g.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ terraform import google_compute_https_health_check.default test
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue
Block a user