alicloud_cdn_domain
Provides a CDN Accelerated Domain resource.
Example Usage
# Add a CDN Accelerated Domain with configs. resource "alicloud_cdn_domain" "domain" { domain_name = "${your_cdn_domain_name}" cdn_type = "web" source_type = "domain" sources = ["${your_cdn_domain_source1}", "${your_cdn_domain_source2}"] // configs optimize_enable = "off" page_compress_enable = "off" range_enable = "off" video_seek_enable = "off" block_ips = ["1.2.3.4", "111.222.111.111"] parameter_filter_config = [ { enable = "on" hash_key_args = ["hello", "youyouyou"] }] page_404_config = [ { page_type = "other" custom_page_url = "http://${your_cdn_domain_name}/notfound/" }] refer_config = [ { refer_type = "block" refer_list = ["www.xxxx.com", "www.xxxx.cn"] allow_empty = "off" }] auth_config = [ { auth_type = "type_a" master_key = "helloworld1" slave_key = "helloworld2" }] http_header_config = [ { header_key = "Content-Type", header_value = "text/plain" }, { header_key = "Access-Control-Allow-Origin", header_value = "*" }] cache_config = [ { cache_content = "/hello/world", ttl = 1000 cache_type = "path" }, { cache_content = "/hello/world/youyou", ttl = 1000 cache_type = "path" }, { cache_content = "txt,jpg,png", ttl = 2000 cache_type = "suffix" }] }
Argument Reference
The following arguments are supported:
-
domain_name
- (Required) Name of the accelerated domain. This name without suffix can have a string of 1 to 63 characters, must contain only alphanumeric characters or "-", and must not begin or end with "-", and "-" must not in the 3th and 4th character positions at the same time. Suffix.sh
and.tel
are not supported. -
cdn_type
- (Required) Cdn type of the accelerated domain. Valid values areweb
,download
,video
,liveStream
. -
source_type
- (Optional) Source type of the accelerated domain. Valid values areipaddr
,domain
,oss
. You must set this parameter whencdn_type
value is notliveStream
. -
source_port
- (Optional) Source port of the accelerated domain. Valid values are80
and443
. Default value is80
. You must use80
when thesource_type
isoss
. -
sources
- (Optional, Type: list) Sources of the accelerated domain. It's a list of domain names or IP address and consists of at most 20 items. You must set this parameter whencdn_type
value is notliveStream
. -
scope
- (Optional) Scope of the accelerated domain. Valid values aredomestic
,overseas
,global
. Default value isdomestic
. This parameter's setting is valid Only for the international users and domestic L3 and above users .
Domain config
The config supports the following:
-
optimize_enable
- (Optional) Page Optimize config of the accelerated domain. Valid values areon
andoff
. Default value isoff
. It can effectively remove the page redundant content, reduce the file size and improve the speed of distribution when this parameter value ison
. -
page_compress_enable
- (Optional) Page Compress config of the accelerated domain. Valid values areon
andoff
. Default value isoff
. -
range_enable
- (Optional) Range Source config of the accelerated domain. Valid values areon
andoff
. Default value isoff
. -
video_seek_enable
- (Optional) Video Seek config of the accelerated domain. Valid values areon
andoff
. Default value isoff
. -
parameter_filter_config
- (Optional, Type: set) Parameter filter config of the accelerated domain. It's a set and consists of at most one item.-
enable
- (Optional) This parameter indicates whether or not theparameter_filter_config
is enable. Valid values areon
andoff
. Default value isoff
.
-
hash_key_args
- (Optional, Type: list) Reserved parameters ofparameter_filter_config
. It's a list of string and consists of at most 10 items.
-
-
page_404_config
- (Optional, Type: set) Error Page config of the accelerated domain. It's a set and consists of at most one item.-
page_type
- (Optional) Page type of the error page. Valid values aredefault
,charity
,other
. Default value isdefault
. -
custom_page_url
- (Optional) Custom page url of the error page. It must be the full path under the accelerated domain name. It's value must behttp://promotion.alicdn.com/help/oss/error.html
whenpage_type
value ischarity
and It can not be set whenpage_type
value isdefault
.
-
-
refer_config
- (Optional, Type: set) Refer anti-theft chain config of the accelerated domain. It's a set and consists of at most 1 item.-
refer_type
- (Optional) Refer type of the refer config. Valid values areblock
andallow
. Default value isblock
. -
refer_list
- (Required, Type: list) A list of domain names of the refer config. -
allow_empty
- (Optional) This parameter indicates whether or not to allow empty refer access. Valid values areon
andoff
. Default value ison
.
-
-
auth_config
- (Optional, Type: set) Auth config of the accelerated domain. It's a set and consist of at most 1 item.-
auth_type
- (Optional) Auth type of the auth config. Valid values areno_auth
,type_a
,type_b
andtype_c
. Default value isno_auth
. -
master_key
- (Optional) Master authentication key of the auth config. This parameter can have a string of 6 to 32 characters and must contain only alphanumeric characters. -
slave_key
- (Optional) Slave authentication key of the auth config. This parameter can have a string of 6 to 32 characters and must contain only alphanumeric characters. -
timeout
- (Optional, Type: int) Authentication cache time of the auth config. Default value is1800
. It's value is valid only when theauth_type
istype_b
ortype_c
.
-
-
http_header_config
- (Optional, Type: set) Http header config of the accelerated domain. It's a set and consist of at most 8 items. Theheader_key
for each item can not be repeated.-
header_key
- (Required) Header key of the http header. Valid values areContent-Type
,Cache-Control
,Content-Disposition
,Content-Language
,Expires
,Access-Control-Allow-Origin
,Access-Control-Allow-Methods
andAccess-Control-Max-Age
. -
header_value
- (Required) Header value of the http header.
-
-
cache_config
- (Optional, Type: set) Cache config of the accelerated domain. It's a set and each item'scache_content
can not be repeated.-
cache_type
- (Required) Cache type of the cache config. Valid values aresuffix
andpath
. -
cache_content
- (Required) Cache content of the cache config. It's value is a path string when thecache_type
ispath
. When thecache_type
issuffix
, it's value is a string which contains multiple file suffixes separated by commas. -
ttl
- (Required, Type: int) Cache time of the cache config. -
weight
- (Optional, Type: int) Weight of the cache config. This parameter's value is between 1 and 99. Default value is1
. The higher the value, the higher the priority
-
Attributes Reference
The following attributes are exported:
-
domain_name
- The accelerated domain name. -
sources
- The accelerated domain sources. -
cdn_type
- The cdn type of the accelerated domain. -
source_type
- The source type ot the accelerated domain. -
scope
- The accelerated domain scope. -
optimize_enable
- The page optimize config of the accelerated domain. -
page_compress_enable
- The page compress config of the accelerated domain. -
range_enable
- The range source config of the accelerated domain. -
video_seek_enable
- The video seek config of the accelerated domain. -
parameter_filter_config
- The parameter filter config of the accelerated domain. -
page_404_config
- The error page config of the accelerated domain. -
refer_config
- The refer config of the accelerated domain. -
auth_config
- The auth config of the accelerated domain. -
http_header_config
- The http header configs of the accelerated domain. -
cache_config
- The cache configs of the accelerated domain.
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/alicloud/r/cdn_domain.html