Skip to content

Commit 688a8d4

Browse files
author
王超
committed
improves the module examples/complete
1 parent db52c20 commit 688a8d4

File tree

9 files changed

+83
-15
lines changed

9 files changed

+83
-15
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# used for testing
2-
*.tfvars
32

43
# Compiled files
54
*.tfstate

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ You can use this in your terraform template with the following steps.
5151
5252
Authors
5353
-------
54-
Created and maintained by He Guimin(@xiaozhu36, heguimin36@163.com)
54+
Created and maintained by Alibaba Cloud Terraform Team(terraform@alibabacloud.com)
5555
5656
Reference
5757
---------

examples/complete/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Alicloud OSS Terraform Module On Alibaba Cloud
2+
terraform-alicloud-oss-object
3+
=====================================================================
4+
5+
Terraform module which creates OSS bucket and upload object to the bucket on Alibaba Cloud.
6+
7+
These types of resources are supported:
8+
9+
* [OSS](https://www.terraform.io/docs/providers/alicloud/d/oss_bucket_objects.html)
10+
11+
----------------------
12+
13+
Usage
14+
-----
15+
You can use this in your terraform template with the following steps.
16+
17+
1. Adding a module resource to your template, e.g. main.tf
18+
19+
```
20+
module "oss-object" {
21+
source = "terraform-alicloud-modules/oss-object/alicloud"
22+
bucketName = "your-bucket-name"
23+
sourceFile = "test.txt"
24+
object-key = "test-1.txt"
25+
}
26+
```
27+
28+
2. Setting `access_key` and `secret_key` values through environment variables:
29+
30+
- ALICLOUD_ACCESS_KEY
31+
- ALICLOUD_SECRET_KEY
32+
- ALICLOUD_REGION
33+
34+
## Inputs
35+
36+
| Name | Description | Type | Default | Required |
37+
|------|-------------|:----:|:-----:|:-----:|
38+
| Name | Description | Type | Default | Required |
39+
|------|-------------|:----:|:-----:|:-----:|
40+
| bucketName | the bucket you want to create and operate | string | - | yes |
41+
| object-key | object key like general file name | string | - | yes |
42+
| sourceFile | local file name | string | - | yes |
43+
44+
45+
## Outputs
46+
47+
| Name | Description |
48+
|------|-------------|
49+
| this_dest_file | the target object key |
50+
| this_source_file | the source file |

examples/complete/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Upload file without encryption
2+
module "oss-object" {
3+
source = "../.."
4+
bucketName = var.bucketName
5+
sourceFile = var.sourceFile
6+
object-key = var.object-key
7+
}
File renamed without changes.

examples/complete/test2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oss-object
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
##############################################################
2+
#variables for alicloud_oss_bucket_object
3+
##############################################################
4+
bucketName = "bucket-terraform-20220111"
5+
sourceFile = "test2.txt"
6+
object-key = "test-2.txt"
7+

examples/complete/variables.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
variable "bucketName" {
2+
description = "The name of the bucket to put the file in."
3+
type = "string"
4+
default = "bucket-terraform-20220110"
5+
}
6+
7+
variable "object-key" {
8+
description = "The name of the object once it is in the bucket."
9+
type = "string"
10+
default = "test-1.txt"
11+
}
12+
13+
variable "sourceFile" {
14+
description = "The path to the source file being uploaded to the bucket."
15+
type = "string"
16+
default = "test.txt"
17+
}

examples/upload-to-oss/main.tf

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)