github.com/koding/terraform@v0.6.4-0.20170608090606-5d7e0339779d/builtin/providers/vcd/resource_vcd_edgegateway_vpn_test.go (about) 1 package vcd 2 3 import ( 4 "fmt" 5 "os" 6 "testing" 7 8 "github.com/hashicorp/terraform/helper/resource" 9 "github.com/hashicorp/terraform/terraform" 10 ) 11 12 func TestAccVcdVpn_Basic(t *testing.T) { 13 14 resource.Test(t, resource.TestCase{ 15 PreCheck: func() { testAccPreCheck(t) }, 16 Providers: testAccProviders, 17 CheckDestroy: testAccCheckVcdVpnDestroy, 18 Steps: []resource.TestStep{ 19 resource.TestStep{ 20 Config: fmt.Sprintf(testAccCheckVcdVpn_basic, os.Getenv("VCD_EDGE_GATEWAY")), 21 Check: resource.ComposeTestCheckFunc( 22 resource.TestCheckResourceAttr( 23 "vcd_edgegateway_vpn.vpn", "encryption_protocol", "AES256"), 24 ), 25 }, 26 }, 27 }) 28 } 29 30 func testAccCheckVcdVpnDestroy(s *terraform.State) error { 31 32 for _, rs := range s.RootModule().Resources { 33 if rs.Type != "vcd_edgegateway_vpn" { 34 continue 35 } 36 37 return nil 38 } 39 40 return nil 41 } 42 43 const testAccCheckVcdVpn_basic = ` 44 resource "vcd_edgegateway_vpn" "vpn" { 45 edge_gateway = "%s" 46 name = "west-to-east" 47 description = "Description" 48 encryption_protocol = "AES256" 49 mtu = 1400 50 peer_id = "51.179.218.195" 51 peer_ip_address = "51.179.218.195" 52 local_id = "51.179.218.196" 53 local_ip_address = "51.179.218.196" 54 shared_secret = "yZ4B8pxS5334m6ho692hjbtb7zo2vbesn7pe8ry5hyud86M433tbnnfxt6Dqn73g" 55 56 peer_subnets { 57 peer_subnet_name = "DMZ_WEST" 58 peer_subnet_gateway = "10.0.10.1" 59 peer_subnet_mask = "255.255.255.0" 60 } 61 62 peer_subnets { 63 peer_subnet_name = "WEB_WEST" 64 peer_subnet_gateway = "10.0.20.1" 65 peer_subnet_mask = "255.255.255.0" 66 } 67 68 local_subnets { 69 local_subnet_name = "DMZ_EAST" 70 local_subnet_gateway = "10.0.1.1" 71 local_subnet_mask = "255.255.255.0" 72 } 73 74 local_subnets { 75 local_subnet_name = "WEB_EAST" 76 local_subnet_gateway = "10.0.22.1" 77 local_subnet_mask = "255.255.255.0" 78 } 79 } 80 `