Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yangdongxu committed May 5, 2023
1 parent 6c4a23f commit 33f9021
Show file tree
Hide file tree
Showing 10 changed files with 445 additions and 218 deletions.
5 changes: 5 additions & 0 deletions ksyun/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ RabbitMQ
Data Source
ksyun_rabbitmqs
Resource
ksyun_rabbitmq_instance
ksyun_rabbitmq_security_rule
Redis
Data Source
Expand Down Expand Up @@ -229,6 +233,7 @@ Tag
ksyun_tag
KS3
Resource
ksyun_ks3_bucket
*/
Expand Down
250 changes: 126 additions & 124 deletions ksyun/resource_ksyun_ks3_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,159 +5,161 @@ Provides an KS3 Bucket resource.
```hcl
# 创建一个名为 "bucket-new" 的 ks3 存储桶资源
resource "ksyun_ks3_bucket" "bucket-new" {
provider = ks3.bj-prod
#指定要创建的虚拟存储桶的名称
bucket = "YOUR_BUCKET"
#桶权限
acl = "public-read"
}
resource "ksyun_ks3_bucket" "bucket-attr" {
provider = ksyun.bj-prod
bucket = "bucket-20230324-1"
#访问日志的存储路径
logging {
target_bucket = "bucket-20230324-2"
target_prefix = "log/"
}
#文件生命周期
lifecycle_rule {
id = "id1"
#如果filter.prefix有值情况下会覆盖这个选项
prefix = "path/1"
enabled = true
#过期删除时间 days or date 只能二选一
expiration {
#设置过期日期
date = "2023-04-10"
#设置过期时间
#days = "40"
}
#添加标签
filter {
prefix = "example_prefix"
#每个标签不能与其他标签重复
tag {
key = "example_key1"
value = "example_value"
}
tag {
key = "example_key2"
value = "example_value"
}
}
resource "ksyun_ks3_bucket" "bucket-new" {
provider = ks3.bj-prod
#指定要创建的虚拟存储桶的名称
bucket = "YOUR_BUCKET"
#桶权限
acl = "public-read"
}
resource "ksyun_ks3_bucket" "bucket-attr" {
provider = ksyun.bj-prod
bucket = "bucket-20230324-1"
#访问日志的存储路径
logging {
target_bucket = "bucket-20230324-2"
target_prefix = "log/"
}
#文件生命周期
lifecycle_rule {
id = "id1"
#如果filter.prefix有值情况下会覆盖这个选项
prefix = "path/1"
enabled = true
#过期删除时间 days or date 只能二选一
expiration {
#设置过期日期
date = "2023-04-10"
#设置过期时间
#days = "40"
}
#添加标签
filter {
prefix = "example_prefix"
#每个标签不能与其他标签重复
tag {
key = "example_key1"
value = "example_value"
}
tag {
key = "example_key2"
value = "example_value"
}
}
}
lifecycle_rule {
id = "id2"
prefix = "path/365"
enabled = true
expiration {
date = "2023-04-10"
}
}
}
#跨域规则
lifecycle_rule {
id = "id2"
prefix = "path/365"
enabled = true
cors_rule {
allowed_origins = [var.allow-origins-star]
allowed_methods = split(",", var.allow-methods-put)
allowed_headers = [var.allowed_headers]
}
expiration {
date = "2023-04-10"
}
}
#跨域规则
cors_rule {
allowed_origins = [var.allow-origins-star]
allowed_methods = split(",", var.allow-methods-put)
allowed_headers = [var.allowed_headers]
}
cors_rule {
allowed_origins = split(",", var.allow-origins-ksyun)
allowed_methods = split(",", var.allow-methods-get)
allowed_headers = [var.allowed_headers]
expose_headers = [var.expose_headers]
max_age_seconds = var.max_age_seconds
}
cors_rule {
allowed_origins = split(",", var.allow-origins-ksyun)
allowed_methods = split(",", var.allow-methods-get)
allowed_headers = [var.allowed_headers]
expose_headers = [var.expose_headers]
max_age_seconds = var.max_age_seconds
}
}
```
# 创建variables.tf (上面var的变量才能引用到)
```hcl
variable "bucket-new" {
default = "bucket-20180423-1"
}
variable "bucket-attr" {
default = "bucket-20180423-2"
}
variable "acl-bj" {
default = "private"
}
variable "bucket-new" {
default = "bucket-20180423-1"
}
variable "bucket-attr" {
default = "bucket-20180423-2"
}
variable "target-prefix" {
default = "log3/"
}
variable "acl-bj" {
default = "private"
}
variable "role-days" {
default = "expirationByDays"
}
variable "target-prefix" {
default = "log3/"
}
variable "rule-days" {
default = 365
}
variable "my_variable" {
type = number
default = 42
}
variable "role-days" {
default = "expirationByDays"
}
variable "rule-days" {
default = 365
}
variable "role-date" {
default = "expirationByDate"
}
variable "my_variable" {
type = number
default = 42
}
variable "rule-date" {
default = "2023-03-18"
}
variable "role-date" {
default = "expirationByDate"
}
variable "rule-prefix" {
default = "path"
}
variable "rule-date" {
default = "2023-03-18"
}
variable "allow-empty" {
default = true
}
variable "rule-prefix" {
default = "path"
}
variable "referers" {
default = "http://www.ksyun.com, https://www.ksyun.com, http://?.ksyun.com"
}
variable "allow-empty" {
default = true
}
variable "referers" {
default = "http://www.ksyun.com, https://www.ksyun.com, http://?.ksyun.com"
}
variable "allow-origins-star" {
default = "*"
}
variable "allow-origins-star" {
default = "*"
}
variable "allow-origins-ksyun" {
default = "http://www.ksyun.com,http://*.ksyun.com"
}
variable "allow-origins-ksyun" {
default = "http://www.ksyun.com,http://*.ksyun.com"
}
variable "allow-methods-get" {
default = "GET"
}
variable "allow-methods-get" {
default = "GET"
}
variable "allow-methods-put" {
default = "PUT,GET"
}
variable "allow-methods-put" {
default = "PUT,GET"
}
variable "allowed_headers" {
default = "*"
}
variable "allowed_headers" {
default = "*"
}
variable "expose_headers" {
default = "x-ks3-test, x-ks3-test1"
}
variable "expose_headers" {
default = "x-ks3-test, x-ks3-test1"
}
variable "max_age_seconds" {
default = 100
}
variable "max_age_seconds" {
default = 100
}
```
*/
Expand Down
Loading

0 comments on commit 33f9021

Please sign in to comment.