Skip to content

Commit 0e68579

Browse files
lsy1968shanye997
authored andcommitted
Manage OSS
1 parent 1213141 commit 0e68579

File tree

3 files changed

+73
-0
lines changed

3 files changed

+73
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Introduction
2+
3+
<!-- DOCS_DESCRIPTION_CN -->
4+
本示例用于在阿里云上通过Terraform创建Bucket,涉及到OSS存储空间的创建与存储空间访问权限的配置。
5+
详情可查看[通过Terraform创建Bucket](http://help.aliyun.com/document_detail/98855.htm)
6+
<!-- DOCS_DESCRIPTION_CN -->
7+
8+
<!-- DOCS_DESCRIPTION_EN -->
9+
This example is used to manage Object Storage Service on Alibaba Cloud, which involves the creation of OSS bucket and configuration of OSS bucket ACL.
10+
More details in [Use Terraform to manage OSS](http://help.aliyun.com/document_detail/98855.htm).
11+
<!-- DOCS_DESCRIPTION_EN -->
12+
13+
<!-- BEGIN_TF_DOCS -->
14+
## Providers
15+
16+
| Name | Version |
17+
|------|---------|
18+
| <a name="provider_alicloud"></a> [alicloud](#provider\_alicloud) | n/a |
19+
| <a name="provider_random"></a> [random](#provider\_random) | n/a |
20+
21+
## Modules
22+
23+
No modules.
24+
25+
## Resources
26+
27+
| Name | Type |
28+
|------|------|
29+
| [alicloud_oss_bucket.bucket](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/oss_bucket) | resource |
30+
| [alicloud_oss_bucket_acl.bucket-ac](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/oss_bucket_acl) | resource |
31+
| [random_uuid.default](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/uuid) | resource |
32+
33+
## Inputs
34+
35+
| Name | Description | Type | Default | Required |
36+
|------|-------------|------|---------|:--------:|
37+
| <a name="input_region"></a> [region](#input\_region) | n/a | `string` | `"cn-beijing"` | no |
38+
<!-- END_TF_DOCS -->
39+
40+
## Documentation
41+
<!-- docs-link -->
42+
43+
The template is based on Aliyun document: [Manage OSS](http://help.aliyun.com/document_detail/98855.htm)
44+
45+
<!-- docs-link -->
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
variable "region" {
2+
default = "cn-beijing"
3+
}
4+
5+
provider "alicloud" {
6+
region = var.region
7+
}
8+
9+
resource "random_uuid" "default" {
10+
}
11+
12+
# 创建存储空间
13+
resource "alicloud_oss_bucket" "bucket" {
14+
bucket = substr("tf-example-${replace(random_uuid.default.result, "-", "")}", 0, 16)
15+
}
16+
17+
# 设置存储空间的访问权限
18+
resource "alicloud_oss_bucket_acl" "bucket-ac" {
19+
bucket = alicloud_oss_bucket.bucket.id
20+
acl = "private"
21+
}
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)