1+ terraform {
2+ required_providers {
3+ tencentcloud = {
4+ source = " tencentcloudstack/tencentcloud"
5+ # 通过version指定版本
6+ # version = "1.79.10"
7+ }
8+ }
9+ }
10+
11+ # TEO
12+ provider "tencentcloud" {
13+ region = " ap-guangzhou"
14+
15+ secret_id = " "
16+ secret_key = " "
17+
18+ }
19+
20+ # Domain
21+ provider "tencentcloud" {
22+ alias = " tfdomain"
23+ region = " ap-guangzhou"
24+ secret_id = " "
25+ secret_key = " "
26+ }
27+
28+
29+ variable "zone_name" {
30+ default = " tf-teo.com"
31+ }
32+
33+ # cname
34+ resource "tencentcloud_teo_zone" "zone" {
35+ area = " overseas"
36+ alias_zone_name = " tftest"
37+ paused = false
38+ plan_id = " edgeone-2kfv1h391n6w"
39+ tags = {
40+ " createdBy" = " terraform"
41+ }
42+ type = " partial"
43+ zone_name = var. zone_name
44+ }
45+
46+ resource "tencentcloud_dnspod_record" "demo" {
47+ provider = tencentcloud. tfdomain
48+
49+ domain = var. zone_name
50+ record_type = tencentcloud_teo_zone. zone . ownership_verification . 0 . dns_verification . 0 . record_type
51+ record_line = " 默认"
52+ value = tencentcloud_teo_zone. zone . ownership_verification . 0 . dns_verification . 0 . record_value
53+ sub_domain = tencentcloud_teo_zone. zone . ownership_verification . 0 . dns_verification . 0 . subdomain
54+
55+ }
56+
57+ resource "tencentcloud_teo_ownership_verify" "ownership_verify" {
58+ domain = var. zone_name
59+
60+ depends_on = [tencentcloud_dnspod_record . demo ]
61+ }
62+
63+ variable "sub_domain" {
64+ default = " aaa"
65+ }
66+
67+ resource "tencentcloud_teo_acceleration_domain" "acceleration_domain" {
68+ zone_id = tencentcloud_teo_zone. zone . id
69+ domain_name = " ${ var . sub_domain } .${ var . zone_name } "
70+
71+ origin_info {
72+ origin = " 150.109.8.1"
73+ origin_type = " IP_DOMAIN"
74+ }
75+
76+ depends_on = [tencentcloud_teo_ownership_verify . ownership_verify ]
77+ }
78+
79+ resource "tencentcloud_dnspod_record" "acceleration_domain_record" {
80+ provider = tencentcloud. tfdomain
81+
82+ domain = var. zone_name
83+ record_type = " CNAME"
84+ record_line = " 默认"
85+ value = " ${ tencentcloud_teo_acceleration_domain . acceleration_domain . domain_name } .eo.dnse0.com."
86+ sub_domain = var. sub_domain
87+
88+ }
89+
90+ resource "tencentcloud_teo_certificate_config" "certificate" {
91+ host = tencentcloud_teo_acceleration_domain. acceleration_domain . domain_name
92+ mode = " eofreecert"
93+ zone_id = tencentcloud_teo_zone. zone . id
94+
95+ depends_on = [tencentcloud_dnspod_record . acceleration_domain_record ]
96+ }
0 commit comments