Skip to content

Commit 572f3a8

Browse files
committed
Configure DCDN domain name
1 parent 64d696f commit 572f3a8

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
## Providers
3+
4+
| Name | Version |
5+
|------|---------|
6+
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | n/a |
7+
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
8+
9+
## Modules
10+
11+
No modules.
12+
13+
## Resources
14+
15+
| Name | Type |
16+
|------|------|
17+
| [alicloud_dcdn_domain.domain](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/dcdn_domain) | resource |
18+
| [alicloud_dcdn_domain_config.config-ip](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/dcdn_domain_config) | resource |
19+
| [random_integer.default](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer) | resource |
20+
21+
## Inputs
22+
23+
No inputs.
24+
<!-- END_TF_DOCS -->
25+
## Documentation
26+
<!-- docs-link -->
27+
28+
The template is based on Aliyun document: [Configure DCDN domain name](http://help.aliyun.com/document_detail/434131.htm)
29+
30+
<!-- docs-link -->
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
resource "random_integer" "default" {
2+
min = 10000
3+
max = 99999
4+
}
5+
6+
# 添加一个加速域名
7+
resource "alicloud_dcdn_domain" "domain" {
8+
domain_name = "mydcdndomain-${random_integer.default.result}.alicloud-provider.cn"
9+
scope = "overseas"
10+
sources {
11+
content = "myoss-${random_integer.default.result}.oss-rg-china-mainland.aliyuncs.com"
12+
type = "oss"
13+
priority = "20"
14+
port = 80
15+
weight = "15"
16+
}
17+
}
18+
19+
// # 为加速域名配置访问IP白名单
20+
resource "alicloud_dcdn_domain_config" "config-ip" {
21+
domain_name = alicloud_dcdn_domain.domain.domain_name
22+
function_name = "ip_allow_list_set"
23+
function_args {
24+
arg_name = "ip_list"
25+
arg_value = "192.168.0.1"
26+
}
27+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_providers {
3+
alicloud = {
4+
source = "aliyun/alicloud"
5+
}
6+
}
7+
}

0 commit comments

Comments
 (0)