Skip to content

Commit 79a2109

Browse files
authored
Merge pull request #156 from Sherlock-Holo/add-eni-resource
add eni related resources
2 parents 00b1e88 + 3c06023 commit 79a2109

15 files changed

+3290
-0
lines changed

examples/tencentcloud-eni/main.tf

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
resource "tencentcloud_vpc" "foo" {
2+
name = "ci-test-eni-vpc"
3+
cidr_block = "10.0.0.0/16"
4+
}
5+
6+
resource "tencentcloud_subnet" "foo" {
7+
availability_zone = "${var.availability_zone}"
8+
name = "ci-test-eni-subnet"
9+
vpc_id = "${tencentcloud_vpc.foo.id}"
10+
cidr_block = "10.0.0.0/16"
11+
is_multicast = false
12+
}
13+
14+
resource "tencentcloud_security_group" "foo" {
15+
name = "test-ci-eni-sg1"
16+
}
17+
18+
resource "tencentcloud_security_group" "bar" {
19+
name = "test-ci-eni-sg2"
20+
}
21+
22+
resource "tencentcloud_eni" "foo" {
23+
name = "ci-test-eni"
24+
vpc_id = "${tencentcloud_vpc.foo.id}"
25+
subnet_id = "${tencentcloud_subnet.foo.id}"
26+
description = "eni desc"
27+
security_groups = ["${tencentcloud_security_group.foo.id}", "${tencentcloud_security_group.bar.id}"]
28+
29+
ipv4s {
30+
ip = "10.0.0.10"
31+
primary = true
32+
description = "new desc"
33+
}
34+
35+
ipv4s {
36+
ip = "10.0.0.11"
37+
primary = false
38+
}
39+
40+
ipv4s {
41+
ip = "10.0.0.12"
42+
primary = false
43+
}
44+
45+
tags = {
46+
"test" = "test"
47+
}
48+
}
49+
50+
data "tencentcloud_image" "my_favorite_image" {
51+
os_name = "centos"
52+
53+
filter {
54+
name = "image-type"
55+
values = ["PUBLIC_IMAGE"]
56+
}
57+
}
58+
59+
data "tencentcloud_instance_types" "my_favorite_instance_types" {
60+
filter {
61+
name = "instance-family"
62+
values = ["S3"]
63+
}
64+
65+
cpu_core_count = 4
66+
memory_size = 8
67+
}
68+
69+
resource "tencentcloud_instance" "foo" {
70+
instance_name = "ci-test-eni-attach"
71+
availability_zone = "ap-guangzhou-3"
72+
image_id = "${data.tencentcloud_image.my_favorite_image.image_id}"
73+
instance_type = "${data.tencentcloud_instance_types.my_favorite_instance_types.instance_types.0.instance_type}"
74+
system_disk_type = "CLOUD_PREMIUM"
75+
disable_security_service = true
76+
disable_monitor_service = true
77+
vpc_id = "${tencentcloud_vpc.foo.id}"
78+
subnet_id = "${tencentcloud_subnet.foo.id}"
79+
}
80+
81+
resource "tencentcloud_eni_attachment" "foo" {
82+
eni_id = "${tencentcloud_eni.foo.id}"
83+
instance_id = "${tencentcloud_instance.foo.id}"
84+
}
85+
86+
data "tencentcloud_enis" "subnet" {
87+
subnet_id = "${tencentcloud_eni.foo.subnet_id}"
88+
security_group = "${tencentcloud_security_group.foo.id}"
89+
}

examples/tencentcloud-eni/variable.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
variable "availability_zone" {
2+
default = "ap-guangzhou-3"
3+
}

0 commit comments

Comments
 (0)