mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Merge pull request #13270 from JDiPierro/google_address_importability
Google address importability
This commit is contained in:
commit
d34006bbbf
28
builtin/providers/google/import_compute_address_test.go
Normal file
28
builtin/providers/google/import_compute_address_test.go
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAccComputeAddress_importBasic(t *testing.T) {
|
||||||
|
resourceName := "google_compute_address.foobar"
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckComputeAddressDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccComputeAddress_basic,
|
||||||
|
},
|
||||||
|
|
||||||
|
resource.TestStep{
|
||||||
|
ResourceName: resourceName,
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateVerify: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package google
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAccComputeGlobalAddress_importBasic(t *testing.T) {
|
||||||
|
resourceName := "google_compute_global_address.foobar"
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testAccCheckComputeGlobalAddressDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccComputeGlobalAddress_basic,
|
||||||
|
},
|
||||||
|
|
||||||
|
resource.TestStep{
|
||||||
|
ResourceName: resourceName,
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateVerify: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
@ -14,7 +14,12 @@ func resourceComputeAddress() *schema.Resource {
|
|||||||
Create: resourceComputeAddressCreate,
|
Create: resourceComputeAddressCreate,
|
||||||
Read: resourceComputeAddressRead,
|
Read: resourceComputeAddressRead,
|
||||||
Delete: resourceComputeAddressDelete,
|
Delete: resourceComputeAddressDelete,
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
|
||||||
|
d.Set("name", d.Id())
|
||||||
|
return []*schema.ResourceData{d}, nil
|
||||||
|
},
|
||||||
|
},
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"name": &schema.Schema{
|
"name": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
|
@ -14,7 +14,12 @@ func resourceComputeGlobalAddress() *schema.Resource {
|
|||||||
Create: resourceComputeGlobalAddressCreate,
|
Create: resourceComputeGlobalAddressCreate,
|
||||||
Read: resourceComputeGlobalAddressRead,
|
Read: resourceComputeGlobalAddressRead,
|
||||||
Delete: resourceComputeGlobalAddressDelete,
|
Delete: resourceComputeGlobalAddressDelete,
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
|
||||||
|
d.Set("name", d.Id())
|
||||||
|
return []*schema.ResourceData{d}, nil
|
||||||
|
},
|
||||||
|
},
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"name": &schema.Schema{
|
"name": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
|
@ -141,9 +141,11 @@ To make a resource importable, please see the
|
|||||||
|
|
||||||
### Google
|
### Google
|
||||||
|
|
||||||
|
* google_compute_address
|
||||||
* google_compute_autoscaler
|
* google_compute_autoscaler
|
||||||
* google_compute_firewall
|
* google_compute_firewall
|
||||||
* google_compute_forwarding_rule
|
* google_compute_forwarding_rule
|
||||||
|
* google_compute_global_address
|
||||||
* google_compute_http_health_check
|
* google_compute_http_health_check
|
||||||
* google_compute_instance_group_manager
|
* google_compute_instance_group_manager
|
||||||
* google_compute_instance_template
|
* google_compute_instance_template
|
||||||
|
Loading…
Reference in New Issue
Block a user