diff --git a/.changelog/2573.txt b/.changelog/2573.txt new file mode 100644 index 0000000000..d79ff504f2 --- /dev/null +++ b/.changelog/2573.txt @@ -0,0 +1,7 @@ +```release-note:deprecation +resource/tencentcloud_vpc_ipv6_eni_address +``` + +```release-note:new-resource +tencentcloud_eni_ipv6_address +``` \ No newline at end of file diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index 3fe7c1c23f..d18fad5b2f 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -1050,6 +1050,7 @@ func Provider() *schema.Provider { "tencentcloud_eni": vpc.ResourceTencentCloudEni(), "tencentcloud_eni_attachment": vpc.ResourceTencentCloudEniAttachment(), "tencentcloud_eni_sg_attachment": vpc.ResourceTencentCloudEniSgAttachment(), + "tencentcloud_eni_ipv6_address": vpc.ResourceTencentCloudEniIpv6Address(), "tencentcloud_ccn": ccn.ResourceTencentCloudCcn(), "tencentcloud_ccn_attachment": ccn.ResourceTencentCloudCcnAttachment(), "tencentcloud_ccn_bandwidth_limit": ccn.ResourceTencentCloudCcnBandwidthLimit(), diff --git a/tencentcloud/provider.md b/tencentcloud/provider.md index 87b0768f27..f2a8644174 100644 --- a/tencentcloud/provider.md +++ b/tencentcloud/provider.md @@ -1199,6 +1199,7 @@ Virtual Private Cloud(VPC) tencentcloud_eni tencentcloud_eni_attachment tencentcloud_eni_sg_attachment + tencentcloud_eni_ipv6_address tencentcloud_vpc tencentcloud_vpc_acl tencentcloud_vpc_acl_attachment diff --git a/tencentcloud/services/vpc/resource_tc_eni_ipv6_address.go b/tencentcloud/services/vpc/resource_tc_eni_ipv6_address.go new file mode 100644 index 0000000000..08429373d8 --- /dev/null +++ b/tencentcloud/services/vpc/resource_tc_eni_ipv6_address.go @@ -0,0 +1,251 @@ +package vpc + +import ( + "context" + "fmt" + "log" + "time" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312" + + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func ResourceTencentCloudEniIpv6Address() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudEniIpv6AddressCreate, + Read: resourceTencentCloudEniIpv6AddressRead, + Delete: resourceTencentCloudEniIpv6AddressDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "network_interface_id": { + Required: true, + Type: schema.TypeString, + ForceNew: true, + Description: "ENI instance `ID`, in the form of `eni-m6dyj72l`.", + }, + + "ipv6_addresses": { + Optional: true, + Type: schema.TypeSet, + Computed: true, + ForceNew: true, + ConflictsWith: []string{"ipv6_address_count"}, + Description: "The specified `IPv6` address list, up to 10 can be specified at a time. Combined with the input parameter `Ipv6AddressCount` to calculate the quota. Mandatory one with Ipv6AddressCount.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "address": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "`IPv6` address, in the form of: `3402:4e00:20:100:0:8cd9:2a67:71f3`.", + }, + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "Description.", + }, + "primary": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + ForceNew: true, + Description: "Whether to master `IP`.", + }, + "address_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: "`EIP` instance `ID`, such as:`eip-hxlqja90`.", + }, + "is_wan_ip_blocked": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + ForceNew: true, + Description: "Whether the public network IP is blocked.", + }, + "state": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: "`IPv6` address status: `PENDING`: pending, `MIGRATING`: migrating, `DELETING`: deleting, `AVAILABLE`: available.", + }, + }, + }, + }, + + "ipv6_address_count": { + Optional: true, + Computed: true, + ForceNew: true, + Type: schema.TypeInt, + ConflictsWith: []string{"ipv6_addresses"}, + Description: "The number of automatically assigned IPv6 addresses and the total number of private IP addresses cannot exceed the quota. This should be combined with the input parameter `ipv6_addresses` for quota calculation. At least one of them, either this or 'Ipv6Addresses', must be provided.", + }, + }, + } +} + +func resourceTencentCloudEniIpv6AddressCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_eni_ipv6_address.create")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + var ( + request = vpc.NewAssignIpv6AddressesRequest() + response = vpc.NewAssignIpv6AddressesResponse() + networkInterfaceId string + ) + + if v, ok := d.GetOk("network_interface_id"); ok { + networkInterfaceId = v.(string) + request.NetworkInterfaceId = helper.String(v.(string)) + } + + if v, ok := d.GetOk("ipv6_addresses"); ok { + for _, item := range v.(*schema.Set).List() { + dMap := item.(map[string]interface{}) + ipv6Address := vpc.Ipv6Address{} + if v, ok := dMap["address"]; ok { + ipv6Address.Address = helper.String(v.(string)) + } + if v, ok := dMap["primary"]; ok { + ipv6Address.Primary = helper.Bool(v.(bool)) + } + if v, ok := dMap["address_id"]; ok { + ipv6Address.AddressId = helper.String(v.(string)) + } + if v, ok := dMap["description"]; ok { + ipv6Address.Description = helper.String(v.(string)) + } + if v, ok := dMap["is_wan_ip_blocked"]; ok { + ipv6Address.IsWanIpBlocked = helper.Bool(v.(bool)) + } + if v, ok := dMap["state"]; ok { + ipv6Address.State = helper.String(v.(string)) + } + request.Ipv6Addresses = append(request.Ipv6Addresses, &ipv6Address) + } + } + + if v, ok := d.GetOkExists("ipv6_address_count"); ok { + request.Ipv6AddressCount = helper.IntUint64(v.(int)) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseVpcClient().AssignIpv6Addresses(request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s create vpc ipv6EniAddress failed, reason:%+v", logId, err) + return err + } + + addressSet := response.Response.Ipv6AddressSet + if len(addressSet) < 1 { + return fmt.Errorf("assign ipv6 addresses failed.") + } + + time.Sleep(5 * time.Second) + + d.SetId(networkInterfaceId) + + return resourceTencentCloudEniIpv6AddressRead(d, meta) +} + +func resourceTencentCloudEniIpv6AddressRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_eni_ipv6_address.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := context.WithValue(context.TODO(), tccommon.LogIdKey, logId) + + service := VpcService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + networkInterfaceId := d.Id() + + enis, err := service.DescribeEniById(ctx, []string{networkInterfaceId}) + + if err != nil { + return err + } + + if len(enis) < 1 { + d.SetId("") + log.Printf("[WARN]%s resource `VpcIpv6EniAddress` [%s] not found, please check if it has been deleted.\n", logId, d.Id()) + return nil + } + + eni := enis[0] + + ipv6s := make([]map[string]interface{}, 0, len(eni.Ipv6AddressSet)) + for _, ipv6 := range eni.Ipv6AddressSet { + ipv6s = append(ipv6s, map[string]interface{}{ + "address": ipv6.Address, + "primary": ipv6.Primary, + "address_id": ipv6.AddressId, + "description": ipv6.Description, + "is_wan_ip_blocked": ipv6.IsWanIpBlocked, + "state": ipv6.State, + }) + } + + _ = d.Set("network_interface_id", networkInterfaceId) + _ = d.Set("ipv6_addresses", ipv6s) + _ = d.Set("ipv6_address_count", len(eni.Ipv6AddressSet)) + + return nil +} + +func resourceTencentCloudEniIpv6AddressDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_eni_ipv6_address.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + ctx := context.WithValue(context.TODO(), tccommon.LogIdKey, logId) + + service := VpcService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + networkInterfaceId := d.Id() + + enis, err := service.DescribeEniById(ctx, []string{networkInterfaceId}) + + if err != nil { + return err + } + + if len(enis) < 1 { + d.SetId("") + log.Printf("[WARN]%s resource `VpcIpv6EniAddress` [%s] not found, please check if it has been deleted.\n", logId, d.Id()) + return nil + } + + eni := enis[0] + ipv6s := make([]*string, 0, len(eni.Ipv6AddressSet)) + for _, ipv6 := range eni.Ipv6AddressSet { + ipv6s = append(ipv6s, ipv6.Address) + } + + if err := service.DeleteEniIpv6AddressById(ctx, networkInterfaceId, ipv6s); err != nil { + return err + } + + return nil +} diff --git a/tencentcloud/services/vpc/resource_tc_eni_ipv6_address.md b/tencentcloud/services/vpc/resource_tc_eni_ipv6_address.md new file mode 100644 index 0000000000..1e0d38021e --- /dev/null +++ b/tencentcloud/services/vpc/resource_tc_eni_ipv6_address.md @@ -0,0 +1,53 @@ +Provides a resource to create a vpc eni_ipv6_address + +Example Usage + +```hcl +data "tencentcloud_availability_zones" "zones" {} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc-example" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = data.tencentcloud_availability_zones.zones.zones.0.name + name = "subnet-example" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.0.0/16" + is_multicast = false +} + +resource "tencentcloud_eni" "eni" { + name = "eni-example" + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + description = "eni desc." + ipv4_count = 1 +} + +resource "tencentcloud_vpc_ipv6_cidr_block" "example" { + vpc_id = tencentcloud_vpc.vpc.id +} + +resource "tencentcloud_vpc_ipv6_subnet_cidr_block" "example" { + vpc_id = tencentcloud_vpc.vpc.id + ipv6_subnet_cidr_blocks { + subnet_id = tencentcloud_subnet.subnet.id + ipv6_cidr_block = "2402:4e00:1018:6700::/64" + } +} + +resource "tencentcloud_eni_ipv6_address" "ipv6_eni_address" { + network_interface_id = tencentcloud_eni.eni.id + ipv6_address_count = 1 +} +``` + +Import + +vpc eni_ipv6_address can be imported using the id, e.g. + +``` +terraform import tencentcloud_eni_ipv6_address.ipv6_eni_address eni_id +``` \ No newline at end of file diff --git a/tencentcloud/services/vpc/resource_tc_eni_ipv6_address_test.go b/tencentcloud/services/vpc/resource_tc_eni_ipv6_address_test.go new file mode 100644 index 0000000000..ba55b7e568 --- /dev/null +++ b/tencentcloud/services/vpc/resource_tc_eni_ipv6_address_test.go @@ -0,0 +1,84 @@ +package vpc_test + +import ( + "testing" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccTencentCloudNeedFixEniIpv6AddressResource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{ + { + Config: testAccEniIpv6Address, + Check: resource.ComposeTestCheckFunc( + //testAccCheckBandwidthPackageAttachmentExists("tencentcloud_vpc_ipv6_eni_address"), + resource.TestCheckResourceAttrSet("tencentcloud_eni_ipv6_address.ipv6_eni_address", "network_interface_id"), + resource.TestCheckResourceAttrSet("tencentcloud_eni_ipv6_address.ipv6_eni_address", "ipv6_addresses.0.address"), + resource.TestCheckResourceAttrSet("tencentcloud_eni_ipv6_address.ipv6_eni_address", "ipv6_addresses.0.primary"), + resource.TestCheckResourceAttrSet("tencentcloud_eni_ipv6_address.ipv6_eni_address", "ipv6_addresses.0.address_id"), + resource.TestCheckResourceAttrSet("tencentcloud_eni_ipv6_address.ipv6_eni_address", "ipv6_addresses.0.description"), + resource.TestCheckResourceAttrSet("tencentcloud_eni_ipv6_address.ipv6_eni_address", "ipv6_addresses.0.is_wan_ip_blocked"), + resource.TestCheckResourceAttrSet("tencentcloud_eni_ipv6_address.ipv6_eni_address", "ipv6_addresses.0.state"), + ), + }, + { + ResourceName: "tencentcloud_eni_ipv6_address.ipv6_eni_address", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +const testAccEniIpv6Address = ` + +data "tencentcloud_availability_zones" "zones" {} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc-example-ipv6" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = data.tencentcloud_availability_zones.zones.zones.0.name + name = "subnet-example-ipv6" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.0.0/16" + is_multicast = false +} + +resource "tencentcloud_eni" "eni" { + name = "eni-example-ipv6" + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + description = "eni desc." + ipv4_count = 1 +} + +resource "tencentcloud_vpc_ipv6_cidr_block" "example" { + vpc_id = tencentcloud_vpc.vpc.id +} + +resource "tencentcloud_vpc_ipv6_subnet_cidr_block" "example" { + vpc_id = tencentcloud_vpc.vpc.id + ipv6_subnet_cidr_blocks { + subnet_id = tencentcloud_subnet.subnet.id + ipv6_cidr_block = "2402:4e00:1018:6700::/64" + } +} + +resource "tencentcloud_eni_ipv6_address" "ipv6_eni_address" { + network_interface_id = tencentcloud_eni.eni.id + ipv6_address_count = 1 +} + +` diff --git a/tencentcloud/services/vpc/resource_tc_security_group_rule.go b/tencentcloud/services/vpc/resource_tc_security_group_rule.go index ac1a6e9e96..98f0451670 100644 --- a/tencentcloud/services/vpc/resource_tc_security_group_rule.go +++ b/tencentcloud/services/vpc/resource_tc_security_group_rule.go @@ -18,7 +18,7 @@ import ( func ResourceTencentCloudSecurityGroupRule() *schema.Resource { return &schema.Resource{ - DeprecationMessage: "This resource will be offline and no longer supported, beacause single security rule is hardly ordered. Please use 'tencentcloud_security_group_rule_set' instead.", + DeprecationMessage: "This resource will be offline and no longer supported, because single security rule is hardly ordered. Please use 'tencentcloud_security_group_rule_set' instead.", Create: resourceTencentCloudSecurityGroupRuleCreate, Read: resourceTencentCloudSecurityGroupRuleRead, Delete: resourceTencentCloudSecurityGroupRuleDelete, diff --git a/tencentcloud/services/vpc/resource_tc_vpc_ipv6_eni_address.go b/tencentcloud/services/vpc/resource_tc_vpc_ipv6_eni_address.go index 3b79d2dc02..8f72d5c5fe 100644 --- a/tencentcloud/services/vpc/resource_tc_vpc_ipv6_eni_address.go +++ b/tencentcloud/services/vpc/resource_tc_vpc_ipv6_eni_address.go @@ -18,10 +18,11 @@ import ( func ResourceTencentCloudVpcIpv6EniAddress() *schema.Resource { return &schema.Resource{ - Create: resourceTencentCloudVpcIpv6EniAddressCreate, - Read: resourceTencentCloudVpcIpv6EniAddressRead, - Update: resourceTencentCloudVpcIpv6EniAddressUpdate, - Delete: resourceTencentCloudVpcIpv6EniAddressDelete, + Create: resourceTencentCloudVpcIpv6EniAddressCreate, + Read: resourceTencentCloudVpcIpv6EniAddressRead, + Update: resourceTencentCloudVpcIpv6EniAddressUpdate, + Delete: resourceTencentCloudVpcIpv6EniAddressDelete, + DeprecationMessage: "This resource has been deprecated in Terraform TencentCloud provider version 1.81.85. Please use 'tencentcloud_eni_ipv6_address' instead.", Schema: map[string]*schema.Schema{ "vpc_id": { Required: true, diff --git a/tencentcloud/services/vpc/resource_tc_vpc_ipv6_eni_address.md b/tencentcloud/services/vpc/resource_tc_vpc_ipv6_eni_address.md index e5bc8335f4..6f7abd38ce 100644 --- a/tencentcloud/services/vpc/resource_tc_vpc_ipv6_eni_address.md +++ b/tencentcloud/services/vpc/resource_tc_vpc_ipv6_eni_address.md @@ -1,5 +1,7 @@ Provides a resource to create a vpc ipv6_eni_address +~> **NOTE:** It has been deprecated and replaced by `tencentcloud_eni_ipv6_address`. + Example Usage ```hcl @@ -34,7 +36,7 @@ resource "tencentcloud_vpc_ipv6_eni_address" "ipv6_eni_address" { vpc_id = tencentcloud_vpc.vpc.id network_interface_id = tencentcloud_eni.eni.id ipv6_addresses { - address = tencentcloud_vpc_ipv6_cidr_block.example.ipv6_cidr_block + address = "xxxxxxxxxxxxxx" description = "desc." } } diff --git a/tencentcloud/services/vpc/resource_tc_vpc_ipv6_subnet_cidr_block.md b/tencentcloud/services/vpc/resource_tc_vpc_ipv6_subnet_cidr_block.md index 9a0b514886..7077765a39 100644 --- a/tencentcloud/services/vpc/resource_tc_vpc_ipv6_subnet_cidr_block.md +++ b/tencentcloud/services/vpc/resource_tc_vpc_ipv6_subnet_cidr_block.md @@ -26,7 +26,7 @@ resource "tencentcloud_vpc_ipv6_subnet_cidr_block" "example" { vpc_id = tencentcloud_vpc.vpc.id ipv6_subnet_cidr_blocks { subnet_id = tencentcloud_subnet.subnet.id - ipv6_cidr_block = tencentcloud_vpc_ipv6_cidr_block.example.ipv6_cidr_block + ipv6_cidr_block = "xxxxxxxxx" } } ``` diff --git a/tencentcloud/services/vpc/service_tencentcloud_vpc.go b/tencentcloud/services/vpc/service_tencentcloud_vpc.go index ef85602600..5f35959c2c 100644 --- a/tencentcloud/services/vpc/service_tencentcloud_vpc.go +++ b/tencentcloud/services/vpc/service_tencentcloud_vpc.go @@ -6849,6 +6849,36 @@ func (me *VpcService) DeleteVpcIpv6EniAddressById(ctx context.Context, networkIn return } +func (me *VpcService) DeleteEniIpv6AddressById(ctx context.Context, networkInterfaceId string, ipv6Addresses []*string) (errRet error) { + logId := tccommon.GetLogId(ctx) + + request := vpc.NewUnassignIpv6AddressesRequest() + request.NetworkInterfaceId = &networkInterfaceId + + for _, ipv6Address := range ipv6Addresses { + address := vpc.Ipv6Address{} + address.Address = ipv6Address + request.Ipv6Addresses = append(request.Ipv6Addresses, &address) + } + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + ratelimit.Check(request.GetAction()) + + response, err := me.client.UseVpcClient().UnassignIpv6Addresses(request) + if err != nil { + errRet = err + return + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + + return +} + func (me *VpcService) DescribeVpcLocalGatewayById(ctx context.Context, localGatewayId string) (localGateway *vpc.LocalGateway, errRet error) { logId := tccommon.GetLogId(ctx) diff --git a/website/docs/r/eni_ipv6_address.html.markdown b/website/docs/r/eni_ipv6_address.html.markdown new file mode 100644 index 0000000000..b83e7b8bdc --- /dev/null +++ b/website/docs/r/eni_ipv6_address.html.markdown @@ -0,0 +1,90 @@ +--- +subcategory: "Virtual Private Cloud(VPC)" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_eni_ipv6_address" +sidebar_current: "docs-tencentcloud-resource-eni_ipv6_address" +description: |- + Provides a resource to create a vpc eni_ipv6_address +--- + +# tencentcloud_eni_ipv6_address + +Provides a resource to create a vpc eni_ipv6_address + +## Example Usage + +```hcl +data "tencentcloud_availability_zones" "zones" {} + +resource "tencentcloud_vpc" "vpc" { + name = "vpc-example" + cidr_block = "10.0.0.0/16" +} + +resource "tencentcloud_subnet" "subnet" { + availability_zone = data.tencentcloud_availability_zones.zones.zones.0.name + name = "subnet-example" + vpc_id = tencentcloud_vpc.vpc.id + cidr_block = "10.0.0.0/16" + is_multicast = false +} + +resource "tencentcloud_eni" "eni" { + name = "eni-example" + vpc_id = tencentcloud_vpc.vpc.id + subnet_id = tencentcloud_subnet.subnet.id + description = "eni desc." + ipv4_count = 1 +} + +resource "tencentcloud_vpc_ipv6_cidr_block" "example" { + vpc_id = tencentcloud_vpc.vpc.id +} + +resource "tencentcloud_vpc_ipv6_subnet_cidr_block" "example" { + vpc_id = tencentcloud_vpc.vpc.id + ipv6_subnet_cidr_blocks { + subnet_id = tencentcloud_subnet.subnet.id + ipv6_cidr_block = "2402:4e00:1018:6700::/64" + } +} + +resource "tencentcloud_eni_ipv6_address" "ipv6_eni_address" { + network_interface_id = tencentcloud_eni.eni.id + ipv6_address_count = 1 +} +``` + +## Argument Reference + +The following arguments are supported: + +* `network_interface_id` - (Required, String, ForceNew) ENI instance `ID`, in the form of `eni-m6dyj72l`. +* `ipv6_address_count` - (Optional, Int, ForceNew) The number of automatically assigned IPv6 addresses and the total number of private IP addresses cannot exceed the quota. This should be combined with the input parameter `ipv6_addresses` for quota calculation. At least one of them, either this or 'Ipv6Addresses', must be provided. +* `ipv6_addresses` - (Optional, Set, ForceNew) The specified `IPv6` address list, up to 10 can be specified at a time. Combined with the input parameter `Ipv6AddressCount` to calculate the quota. Mandatory one with Ipv6AddressCount. + +The `ipv6_addresses` object supports the following: + +* `address` - (Required, String, ForceNew) `IPv6` address, in the form of: `3402:4e00:20:100:0:8cd9:2a67:71f3`. +* `address_id` - (Optional, String, ForceNew) `EIP` instance `ID`, such as:`eip-hxlqja90`. +* `description` - (Optional, String, ForceNew) Description. +* `is_wan_ip_blocked` - (Optional, Bool, ForceNew) Whether the public network IP is blocked. +* `primary` - (Optional, Bool, ForceNew) Whether to master `IP`. +* `state` - (Optional, String, ForceNew) `IPv6` address status: `PENDING`: pending, `MIGRATING`: migrating, `DELETING`: deleting, `AVAILABLE`: available. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. + + + +## Import + +vpc eni_ipv6_address can be imported using the id, e.g. + +``` +terraform import tencentcloud_eni_ipv6_address.ipv6_eni_address eni_id +``` + diff --git a/website/docs/r/vpc_ipv6_eni_address.html.markdown b/website/docs/r/vpc_ipv6_eni_address.html.markdown index 7c0584f858..a2c9f869e9 100644 --- a/website/docs/r/vpc_ipv6_eni_address.html.markdown +++ b/website/docs/r/vpc_ipv6_eni_address.html.markdown @@ -11,6 +11,8 @@ description: |- Provides a resource to create a vpc ipv6_eni_address +~> **NOTE:** It has been deprecated and replaced by `tencentcloud_eni_ipv6_address`. + ## Example Usage ```hcl @@ -45,7 +47,7 @@ resource "tencentcloud_vpc_ipv6_eni_address" "ipv6_eni_address" { vpc_id = tencentcloud_vpc.vpc.id network_interface_id = tencentcloud_eni.eni.id ipv6_addresses { - address = tencentcloud_vpc_ipv6_cidr_block.example.ipv6_cidr_block + address = "xxxxxxxxxxxxxx" description = "desc." } } diff --git a/website/docs/r/vpc_ipv6_subnet_cidr_block.html.markdown b/website/docs/r/vpc_ipv6_subnet_cidr_block.html.markdown index 5421fdeacf..9fc2dea1a6 100644 --- a/website/docs/r/vpc_ipv6_subnet_cidr_block.html.markdown +++ b/website/docs/r/vpc_ipv6_subnet_cidr_block.html.markdown @@ -37,7 +37,7 @@ resource "tencentcloud_vpc_ipv6_subnet_cidr_block" "example" { vpc_id = tencentcloud_vpc.vpc.id ipv6_subnet_cidr_blocks { subnet_id = tencentcloud_subnet.subnet.id - ipv6_cidr_block = tencentcloud_vpc_ipv6_cidr_block.example.ipv6_cidr_block + ipv6_cidr_block = "xxxxxxxxx" } } ``` diff --git a/website/tencentcloud.erb b/website/tencentcloud.erb index 989f098632..aa15228b6c 100644 --- a/website/tencentcloud.erb +++ b/website/tencentcloud.erb @@ -6046,6 +6046,9 @@
  • tencentcloud_eni_attachment
  • +
  • + tencentcloud_eni_ipv6_address +
  • tencentcloud_eni_sg_attachment