Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4bd56c9

Browse files
committedApr 14, 2025·
add
1 parent 0d20e79 commit 4bd56c9

File tree

3 files changed

+125
-15
lines changed

3 files changed

+125
-15
lines changed
 
Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,72 @@
1-
Provides a resource to create a vpc eni_ipv4_address
1+
Provides a resource to create a vpc eni ipv4 address
22

33
Example Usage
44

55
```hcl
6-
data "tencentcloud_enis" "eni" {
7-
name = "Primary ENI"
6+
resource "tencentcloud_vpc" "vpc" {
7+
name = "vpc-example"
8+
cidr_block = "10.0.0.0/16"
89
}
910
10-
resource "tencentcloud_eni_ipv4_address" "eni_ipv4_address" {
11-
network_interface_id = data.tencentcloud_enis.eni.enis.0.id
11+
resource "tencentcloud_subnet" "subnet" {
12+
availability_zone = "ap-guangzhou-6"
13+
name = "subnet-example"
14+
vpc_id = tencentcloud_vpc.vpc.id
15+
cidr_block = "10.0.0.0/16"
16+
is_multicast = false
17+
}
18+
19+
resource "tencentcloud_security_group" "example" {
20+
name = "tf-example"
21+
description = "sg desc."
22+
project_id = 0
23+
24+
tags = {
25+
createBy = "Terraform"
26+
}
27+
}
28+
29+
resource "tencentcloud_eni" "example" {
30+
name = "tf-example"
31+
vpc_id = tencentcloud_vpc.vpc.id
32+
subnet_id = tencentcloud_subnet.subnet.id
33+
description = "eni desc."
34+
ipv4_count = 1
35+
security_groups = [
36+
tencentcloud_security_group.example.id,
37+
]
38+
}
39+
40+
resource "tencentcloud_eni_ipv4_address" "example" {
41+
network_interface_id = tencentcloud_eni.example.id
42+
qos_level = "DEFAULT"
1243
secondary_private_ip_address_count = 3
1344
}
1445
```
1546

47+
Or
48+
49+
```hcl
50+
resource "tencentcloud_eni_ipv4_address" "example" {
51+
network_interface_id = tencentcloud_eni.example.id
52+
private_ip_addresses {
53+
is_wan_ip_blocked = false
54+
private_ip_address = "10.0.0.15"
55+
qos_level = "DEFAULT"
56+
}
57+
58+
private_ip_addresses {
59+
is_wan_ip_blocked = false
60+
private_ip_address = "10.0.0.4"
61+
qos_level = "DEFAULT"
62+
}
63+
}
64+
```
65+
1666
Import
1767

18-
vpc eni_ipv4_address can be imported using the id, e.g.
68+
vpc eni ipv4 address can be imported using the id, e.g.
1969

2070
```
21-
terraform import tencentcloud_eni_ipv4_address.eni_ipv4_address eni_id
71+
terraform import tencentcloud_eni_ipv4_address.example eni-65369ozn
2272
```

‎tencentcloud/services/vpc/service_tencentcloud_vpc.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7105,6 +7105,16 @@ func (me *VpcService) DeleteEniIpv4AddressById(ctx context.Context, networkInter
71057105
}
71067106
log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString())
71077107

7108+
// wait
7109+
if response.Response.RequestId != nil {
7110+
err = me.DescribeVpcTaskResult(ctx, response.Response.RequestId)
7111+
if err != nil {
7112+
return err
7113+
}
7114+
} else {
7115+
time.Sleep(15 * time.Second)
7116+
}
7117+
71087118
return
71097119
}
71107120

‎website/docs/r/eni_ipv4_address.html.markdown

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,76 @@ layout: "tencentcloud"
44
page_title: "TencentCloud: tencentcloud_eni_ipv4_address"
55
sidebar_current: "docs-tencentcloud-resource-eni_ipv4_address"
66
description: |-
7-
Provides a resource to create a vpc eni_ipv4_address
7+
Provides a resource to create a vpc eni ipv4 address
88
---
99

1010
# tencentcloud_eni_ipv4_address
1111

12-
Provides a resource to create a vpc eni_ipv4_address
12+
Provides a resource to create a vpc eni ipv4 address
1313

1414
## Example Usage
1515

1616
```hcl
17-
data "tencentcloud_enis" "eni" {
18-
name = "Primary ENI"
17+
resource "tencentcloud_vpc" "vpc" {
18+
name = "vpc-example"
19+
cidr_block = "10.0.0.0/16"
1920
}
2021
21-
resource "tencentcloud_eni_ipv4_address" "eni_ipv4_address" {
22-
network_interface_id = data.tencentcloud_enis.eni.enis.0.id
22+
resource "tencentcloud_subnet" "subnet" {
23+
availability_zone = "ap-guangzhou-6"
24+
name = "subnet-example"
25+
vpc_id = tencentcloud_vpc.vpc.id
26+
cidr_block = "10.0.0.0/16"
27+
is_multicast = false
28+
}
29+
30+
resource "tencentcloud_security_group" "example" {
31+
name = "tf-example"
32+
description = "sg desc."
33+
project_id = 0
34+
35+
tags = {
36+
createBy = "Terraform"
37+
}
38+
}
39+
40+
resource "tencentcloud_eni" "example" {
41+
name = "tf-example"
42+
vpc_id = tencentcloud_vpc.vpc.id
43+
subnet_id = tencentcloud_subnet.subnet.id
44+
description = "eni desc."
45+
ipv4_count = 1
46+
security_groups = [
47+
tencentcloud_security_group.example.id,
48+
]
49+
}
50+
51+
resource "tencentcloud_eni_ipv4_address" "example" {
52+
network_interface_id = tencentcloud_eni.example.id
53+
qos_level = "DEFAULT"
2354
secondary_private_ip_address_count = 3
2455
}
2556
```
2657

58+
### Or
59+
60+
```hcl
61+
resource "tencentcloud_eni_ipv4_address" "example" {
62+
network_interface_id = tencentcloud_eni.example.id
63+
private_ip_addresses {
64+
is_wan_ip_blocked = false
65+
private_ip_address = "10.0.0.15"
66+
qos_level = "DEFAULT"
67+
}
68+
69+
private_ip_addresses {
70+
is_wan_ip_blocked = false
71+
private_ip_address = "10.0.0.4"
72+
qos_level = "DEFAULT"
73+
}
74+
}
75+
```
76+
2777
## Argument Reference
2878

2979
The following arguments are supported:
@@ -54,9 +104,9 @@ In addition to all arguments above, the following attributes are exported:
54104

55105
## Import
56106

57-
vpc eni_ipv4_address can be imported using the id, e.g.
107+
vpc eni ipv4 address can be imported using the id, e.g.
58108

59109
```
60-
terraform import tencentcloud_eni_ipv4_address.eni_ipv4_address eni_id
110+
terraform import tencentcloud_eni_ipv4_address.example eni-65369ozn
61111
```
62112

0 commit comments

Comments
 (0)
Please sign in to comment.