github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/opc/import_security_rule_test.go (about) 1 package opc 2 3 import ( 4 "testing" 5 6 "github.com/hashicorp/terraform/helper/acctest" 7 "github.com/hashicorp/terraform/helper/resource" 8 ) 9 10 func TestAccOPCSecurityRule_importBasic(t *testing.T) { 11 resourceName := "opc_compute_security_rule.test" 12 13 ri := acctest.RandInt() 14 config := testAccOPCSecurityRuleConfig_Basic(ri) 15 16 resource.Test(t, resource.TestCase{ 17 PreCheck: func() { 18 testAccPreCheck(t) 19 }, 20 Providers: testAccProviders, 21 CheckDestroy: testAccCheckSecurityRuleDestroy, 22 Steps: []resource.TestStep{ 23 { 24 Config: config, 25 }, 26 { 27 ResourceName: resourceName, 28 ImportState: true, 29 ImportStateVerify: true, 30 }, 31 }, 32 }) 33 } 34 35 func TestAccOPCSecurityRule_importFull(t *testing.T) { 36 resourceName := "opc_compute_security_rule.test" 37 38 ri := acctest.RandInt() 39 config := testAccOPCSecurityRuleConfig_Full(ri) 40 41 resource.Test(t, resource.TestCase{ 42 PreCheck: func() { 43 testAccPreCheck(t) 44 }, 45 Providers: testAccProviders, 46 CheckDestroy: testAccCheckSecurityRuleDestroy, 47 Steps: []resource.TestStep{ 48 { 49 Config: config, 50 }, 51 { 52 ResourceName: resourceName, 53 ImportState: true, 54 ImportStateVerify: true, 55 }, 56 }, 57 }) 58 }