terraform/builtin/providers/opc/import_ssh_key_test.go

60 lines
1.2 KiB
Go
Raw Normal View History

package opc
import (
"fmt"
"testing"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccOPCSSHKey_importBasic(t *testing.T) {
resourceName := "opc_compute_ssh_key.test"
ri := acctest.RandInt()
config := fmt.Sprintf(testAccOPCSSHKeyBasic, ri)
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: testAccOPCCheckSSHKeyDestroy,
Steps: []resource.TestStep{
{
Config: config,
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
func TestAccOPCSSHKey_importDisabled(t *testing.T) {
resourceName := "opc_compute_ssh_key.test"
ri := acctest.RandInt()
config := fmt.Sprintf(testAccOPCSSHKeyDisabled, ri)
resource.Test(t, resource.TestCase{
PreCheck: func() {
testAccPreCheck(t)
},
Providers: testAccProviders,
CheckDestroy: testAccOPCCheckSSHKeyDestroy,
Steps: []resource.TestStep{
{
Config: config,
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}