terraform/builtin/providers/opc/import_sec_rule_test.go

60 lines
1.2 KiB
Go

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