Merge pull request #7626 from hashicorp/import-arm-lng
provider/azurerm: Support Import `azurerm_local_network_gateway`
This commit is contained in:
commit
25c786898f
|
@ -0,0 +1,30 @@
|
||||||
|
package azurerm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/hashicorp/terraform/helper/resource"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestAccAzureRMLocalNetworkGateway_importBasic(t *testing.T) {
|
||||||
|
resourceName := "azurerm_local_network_gateway.test"
|
||||||
|
|
||||||
|
resource.Test(t, resource.TestCase{
|
||||||
|
PreCheck: func() { testAccPreCheck(t) },
|
||||||
|
Providers: testAccProviders,
|
||||||
|
CheckDestroy: testCheckAzureRMLocalNetworkGatewayDestroy,
|
||||||
|
Steps: []resource.TestStep{
|
||||||
|
resource.TestStep{
|
||||||
|
Config: testAccAzureRMLocalNetworkGatewayConfig_basic,
|
||||||
|
},
|
||||||
|
|
||||||
|
resource.TestStep{
|
||||||
|
ResourceName: resourceName,
|
||||||
|
ImportState: true,
|
||||||
|
ImportStateVerify: true,
|
||||||
|
ImportStateVerifyIgnore: []string{"resource_group_name"},
|
||||||
|
//this isn't returned from the API!
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
|
@ -14,6 +14,9 @@ func resourceArmLocalNetworkGateway() *schema.Resource {
|
||||||
Read: resourceArmLocalNetworkGatewayRead,
|
Read: resourceArmLocalNetworkGatewayRead,
|
||||||
Update: resourceArmLocalNetworkGatewayCreate,
|
Update: resourceArmLocalNetworkGatewayCreate,
|
||||||
Delete: resourceArmLocalNetworkGatewayDelete,
|
Delete: resourceArmLocalNetworkGatewayDelete,
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: schema.ImportStatePassthrough,
|
||||||
|
},
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"name": {
|
"name": {
|
||||||
|
@ -115,6 +118,8 @@ func resourceArmLocalNetworkGatewayRead(d *schema.ResourceData, meta interface{}
|
||||||
return fmt.Errorf("Error reading the state of Azure ARM local network gateway '%s': %s", name, err)
|
return fmt.Errorf("Error reading the state of Azure ARM local network gateway '%s': %s", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.Set("name", resp.Name)
|
||||||
|
d.Set("location", resp.Location)
|
||||||
d.Set("gateway_address", resp.Properties.GatewayIPAddress)
|
d.Set("gateway_address", resp.Properties.GatewayIPAddress)
|
||||||
|
|
||||||
prefs := []string{}
|
prefs := []string{}
|
||||||
|
|
Loading…
Reference in New Issue