@@ -4,29 +4,29 @@ variable "region" {
4
4
5
5
# 域名(改为您的域名)
6
6
variable "domain_home" {
7
- default = " Change to your domain name "
7
+ default = " tf-example.com "
8
8
description = " your domain name"
9
9
}
10
10
11
+ # 主机记录
12
+ variable "host_record" {
13
+ type = string
14
+ default = " image"
15
+ description = " Host Record,like image"
16
+ }
17
+
11
18
# 是否创建ECS
12
19
variable "creater_ecs" {
13
20
default = true
14
21
type = bool
15
22
description = " Do you want to create a ECS instance"
16
23
}
17
24
18
- # ECS地址
19
- variable "existed_ecs_address" {
20
- default = " "
21
- type = string
22
- description = " The address of your existed ecs "
23
- }
24
-
25
- # ECS端口
26
- variable "existed_ecs_port" {
25
+ # 已有ECS地址
26
+ variable "existed_ecs_ip" {
27
27
default = " "
28
28
type = string
29
- description = " The port of your existed ecs "
29
+ description = " The ip of your existed ecs "
30
30
}
31
31
32
32
locals {
@@ -61,7 +61,7 @@ resource "alicloud_vpc" "vpc" {
61
61
62
62
resource "alicloud_security_group" "group" {
63
63
count = var. creater_ecs ? 1 : 0
64
- security_group_name = " test_ ${ random_integer . default . result } "
64
+ security_group_name = " tf_test_ ${ random_integer . default . result } "
65
65
vpc_id = alicloud_vpc. vpc . 0 . id
66
66
}
67
67
@@ -109,7 +109,7 @@ resource "alicloud_cdn_domain_new" "example" {
109
109
cdn_type = " web"
110
110
scope = " overseas"
111
111
sources {
112
- content = var. creater_ecs ? alicloud_instance. instance . 0 . public_ip : var. existed_ecs_address
112
+ content = var. creater_ecs ? alicloud_instance. instance . 0 . public_ip : var. existed_ecs_ip
113
113
type = " ipaddr"
114
114
priority = " 20"
115
115
port = 80
@@ -120,7 +120,7 @@ resource "alicloud_cdn_domain_new" "example" {
120
120
resource "alicloud_alidns_record" "example" {
121
121
domain_name = var. domain_home
122
122
type = " CNAME"
123
- rr = " image "
123
+ rr = var . host_record
124
124
value = alicloud_cdn_domain_new. example . cname
125
125
ttl = 600
126
126
}
0 commit comments