@@ -12,11 +12,23 @@ func TestAccTencentCloudVpcIpv6EniAddressResource_basic(t *testing.T) {
1212 PreCheck : func () {
1313 testAccPreCheck (t )
1414 },
15+ //CheckDestroy: testAccCheckVpcIpv6EniAddressDestroy,
1516 Providers : testAccProviders ,
1617 Steps : []resource.TestStep {
1718 {
1819 Config : testAccVpcIpv6EniAddress ,
19- Check : resource .ComposeTestCheckFunc (resource .TestCheckResourceAttrSet ("tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" , "id" )),
20+ Check : resource .ComposeTestCheckFunc (
21+ //testAccCheckBandwidthPackageAttachmentExists("tencentcloud_vpc_ipv6_eni_address"),
22+ resource .TestCheckResourceAttrSet ("tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" , "vpc_id" ),
23+ resource .TestCheckResourceAttrSet ("tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" , "network_interface_id" ),
24+ resource .TestCheckResourceAttrSet ("tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" , "ipv6_addresses" ),
25+ resource .TestCheckResourceAttrSet ("tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" , "ipv6_addresses.0.address" ),
26+ resource .TestCheckResourceAttrSet ("tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" , "ipv6_addresses.0.primary" ),
27+ resource .TestCheckResourceAttrSet ("tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" , "ipv6_addresses.0.address_id" ),
28+ resource .TestCheckResourceAttrSet ("tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" , "ipv6_addresses.0.description" ),
29+ resource .TestCheckResourceAttrSet ("tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" , "ipv6_addresses.0.is_wan_ip_blocked" ),
30+ resource .TestCheckResourceAttrSet ("tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" , "ipv6_addresses.0.state" ),
31+ ),
2032 },
2133 {
2234 ResourceName : "tencentcloud_vpc_ipv6_eni_address.ipv6_eni_address" ,
@@ -27,6 +39,74 @@ func TestAccTencentCloudVpcIpv6EniAddressResource_basic(t *testing.T) {
2739 })
2840}
2941
42+ //
43+ //func testAccCheckVpcIpv6EniAddressDestroy(s *terraform.State) error {
44+ // logId := getLogId(contextNil)
45+ // ctx := context.WithValue(context.TODO(), logIdKey, logId)
46+ // service := VpcService{client: testAccProvider.Meta().(*TencentCloudClient).apiV3Conn}
47+ // for _, rs := range s.RootModule().Resources {
48+ // if rs.Type != "tencentcloud_vpc_bandwidth_package_attachment" {
49+ // continue
50+ // }
51+ // idSplit := strings.Split(rs.Primary.ID, FILED_SP)
52+ // if len(idSplit) != 2 {
53+ // return fmt.Errorf("id is broken,%s", rs.Primary.ID)
54+ // }
55+ // bandwidthPackageId := idSplit[0]
56+ // resourceId := idSplit[1]
57+ //
58+ // bandwidthPackageResources, err := service.DescribeVpcBandwidthPackageAttachment(ctx, bandwidthPackageId, resourceId)
59+ // if err != nil {
60+ // log.Printf("[CRITAL]%s read VPN connection failed, reason:%s\n", logId, err.Error())
61+ // ee, ok := err.(*errors.TencentCloudSDKError)
62+ // if !ok {
63+ // return err
64+ // }
65+ // fmt.Print(ee)
66+ // if ee.Code == "InvalidParameterValue.BandwidthPackageNotFound" {
67+ // return nil
68+ // } else {
69+ // return err
70+ // }
71+ // } else {
72+ // if bandwidthPackageResources != nil {
73+ // return fmt.Errorf("vpc bandwidthPackageResources %s still exists", rs.Primary.ID)
74+ // }
75+ // }
76+ // }
77+ // return nil
78+ //}
79+ //
80+ //func testAccCheckVpcIpv6EniAddressExists(r string) resource.TestCheckFunc {
81+ // return func(s *terraform.State) error {
82+ // logId := getLogId(contextNil)
83+ // ctx := context.WithValue(context.TODO(), logIdKey, logId)
84+ //
85+ // rs, ok := s.RootModule().Resources[r]
86+ // if !ok {
87+ // return fmt.Errorf("resource %s is not found", r)
88+ // }
89+ //
90+ // idSplit := strings.Split(rs.Primary.ID, FILED_SP)
91+ // if len(idSplit) != 2 {
92+ // return fmt.Errorf("id is broken,%s", rs.Primary.ID)
93+ // }
94+ // bandwidthPackageId := idSplit[0]
95+ // resourceId := idSplit[1]
96+ //
97+ // service := VpcService{client: testAccProvider.Meta().(*TencentCloudClient).apiV3Conn}
98+ // bandwidthPackageResources, err := service.DescribeVpcBandwidthPackageAttachment(ctx, bandwidthPackageId, resourceId)
99+ // if bandwidthPackageResources == nil {
100+ // return fmt.Errorf("vpc bandwidthPackageResources %s is not found", rs.Primary.ID)
101+ // }
102+ // if err != nil {
103+ // return err
104+ // }
105+ //
106+ // return nil
107+ // }
108+ //}
109+
30110const testAccVpcIpv6EniAddress = `
31111
32112resource "tencentcloud_vpc_ipv6_eni_address" "ipv6_eni_address" {
0 commit comments