diff --git a/examples/obs/basic/README.md b/examples/obs/basic/README.md new file mode 100644 index 0000000000..a66eda6258 --- /dev/null +++ b/examples/obs/basic/README.md @@ -0,0 +1,2 @@ +## Example: Basic OBS +This example provisions a OBS and put a file. diff --git a/examples/obs/basic/hello.txt b/examples/obs/basic/hello.txt new file mode 100644 index 0000000000..0005ba05f6 --- /dev/null +++ b/examples/obs/basic/hello.txt @@ -0,0 +1 @@ +Hello, I am an object. diff --git a/examples/obs/basic/main.tf b/examples/obs/basic/main.tf new file mode 100644 index 0000000000..7e79ee7cc3 --- /dev/null +++ b/examples/obs/basic/main.tf @@ -0,0 +1,32 @@ +resource "huaweicloud_obs_bucket" "myexample" { + bucket = "myexample-bucket" + acl = "private" + + tags = { + type = "bucket" + env = "Test" + } +} + +# put myobject1 by content +resource "huaweicloud_obs_bucket_object" "myobject1" { + bucket = huaweicloud_obs_bucket.myexample.bucket + key = "myobject1" + content = "content of myobject1" + content_type = "application/xml" +} + +# put myobject2 by source file +resource "huaweicloud_obs_bucket_object" "myobject2" { + bucket = huaweicloud_obs_bucket.myexample.bucket + key = "myobject2" + source = "hello.txt" +} + +# put myobject3 by source file and encryption with default key +resource "huaweicloud_obs_bucket_object" "myobject3" { + bucket = huaweicloud_obs_bucket.myexample.bucket + key = "myobject3" + source = "hello.txt" + encryption = true +} diff --git a/examples/obs/website/README.md b/examples/obs/website/README.md new file mode 100644 index 0000000000..595611026b --- /dev/null +++ b/examples/obs/website/README.md @@ -0,0 +1,2 @@ +## Example: OBS with Static Website Hosting +This example provisions a OBS with static website hosting. diff --git a/examples/obs/website/error.html b/examples/obs/website/error.html new file mode 100644 index 0000000000..d4aab11e02 --- /dev/null +++ b/examples/obs/website/error.html @@ -0,0 +1,10 @@ + +
+Welcome to use OBS static website hosting.
+This is the 404 error page.
+ + diff --git a/examples/obs/website/index.html b/examples/obs/website/index.html new file mode 100644 index 0000000000..d590c31b84 --- /dev/null +++ b/examples/obs/website/index.html @@ -0,0 +1,10 @@ + + +Welcome to use OBS static website hosting.
+This is the homepage.
+ + diff --git a/examples/obs/website/main.tf b/examples/obs/website/main.tf new file mode 100644 index 0000000000..3ea58c1dc4 --- /dev/null +++ b/examples/obs/website/main.tf @@ -0,0 +1,40 @@ +resource "huaweicloud_obs_bucket" "mywebsite" { + bucket = "mywebsite" + + website { + index_document = "index.html" + error_document = "error.html" + } +} + +# granting the Read-Only permission to anonymous users +resource "huaweicloud_obs_bucket_policy" "policy" { + bucket = huaweicloud_obs_bucket.mywebsite.bucket + policy = <