-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: region name validate, fix bucket config
[Object Storage] update: change payload list sub user [Object Storage] update: fix lifecycle, acl, access keys data source [Object Storage] update: fix config bucket lifecycle cannot create [Object Storage] fix: fix payload bucket lifecycle [WIP] [Object Storage] fix: bucket cors cannot delete Update: cors example
- Loading branch information
hoanglm
committed
Nov 18, 2024
1 parent
d4c536e
commit 92b2df3
Showing
46 changed files
with
1,570 additions
and
621 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
examples/data-sources/fptcloud_object_storage/datasource_list_access_keys.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
data "fptcloud_object_storage_access_key" "keys" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region_name" | ||
} | ||
// for raw data and all access keys from region_name will be listed | ||
output "access_key" { | ||
value = data.fptcloud_object_storage_access_key.keys | ||
} |
9 changes: 9 additions & 0 deletions
9
examples/data-sources/fptcloud_object_storage/datasource_list_bucket_acl.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
data "fptcloud_object_storage_bucket_acl" "example_bucket_acl" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region_name" | ||
bucket_name = "your_bucket_name" | ||
} | ||
|
||
output "bucket_acl" { | ||
value = data.fptcloud_object_storage_bucket_acl.example_bucket_acl | ||
} |
11 changes: 11 additions & 0 deletions
11
examples/data-sources/fptcloud_object_storage/datasource_list_bucket_cors.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
data "fptcloud_object_storage_bucket_cors" "example_bucket_cors" { | ||
vpc_id = "1b413c55-b752-4183-abad-06c4b5aca6ad" | ||
region_name = "HCM-02" | ||
bucket_name = "hoanglm3-test-terraform-static-website" | ||
page = 1 | ||
page_size = 100 | ||
} | ||
|
||
output "bucket_cors" { | ||
value = data.fptcloud_object_storage_bucket_cors.example_bucket_cors | ||
} |
11 changes: 11 additions & 0 deletions
11
examples/data-sources/fptcloud_object_storage/datasource_list_bucket_lifecycle.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
data "fptcloud_object_storage_bucket_lifecycle" "example_bucket_lifecycle" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region_name" | ||
bucket_name = "your_bucket_name" | ||
page = 1 | ||
page_size = 100 | ||
} | ||
|
||
output "bucket_lifecycle" { | ||
value = data.fptcloud_object_storage_bucket_lifecycle.example_bucket_lifecycle | ||
} |
9 changes: 9 additions & 0 deletions
9
examples/data-sources/fptcloud_object_storage/datasource_list_bucket_policy.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
data "fptcloud_object_storage_bucket_policy" "example_bucket_policy" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region_name" | ||
bucket_name = "your_bucket_name" | ||
} | ||
|
||
output "bucket_policy" { | ||
value = data.fptcloud_object_storage_bucket_policy.example_bucket_policy.policy | ||
} |
9 changes: 9 additions & 0 deletions
9
examples/data-sources/fptcloud_object_storage/datasource_list_bucket_static_website.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
data "fptcloud_object_storage_bucket_static_website" "example_bucket_static_website" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region_name" | ||
bucket_name = "your_bucket_name" | ||
} | ||
|
||
output "bucket_static_website" { | ||
value = data.fptcloud_object_storage_bucket_static_website.example_bucket_static_website | ||
} |
9 changes: 9 additions & 0 deletions
9
examples/data-sources/fptcloud_object_storage/datasource_list_bucket_versioning.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
data "fptcloud_object_storage_bucket_versioning" "example_bucket_versioning" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region_name" | ||
bucket_name = "your_bucket_name" | ||
} | ||
|
||
output "bucket_versioning" { | ||
value = data.fptcloud_object_storage_bucket_versioning.example_bucket_versioning | ||
} |
10 changes: 10 additions & 0 deletions
10
examples/data-sources/fptcloud_object_storage/datasource_list_buckets.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
data "fptcloud_object_storage_bucket" "hoanglm32" { | ||
vpc_id = "your_vpc_id" | ||
page = 1 | ||
page_size = 100000 | ||
region_name = "your_region_name" | ||
} | ||
// for raw data and all buckets will be listed | ||
output "name" { | ||
value = data.fptcloud_object_storage_bucket.hoanglm32.list_bucket_result | ||
} |
18 changes: 18 additions & 0 deletions
18
examples/data-sources/fptcloud_object_storage/datasource_list_enable_services.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
data "fptcloud_s3_service_enable" "hoanglm32" { | ||
vpc_id = "your_vpc_id" | ||
} | ||
// All regions formatted | ||
output "all_regions_formatted" { | ||
value = { | ||
for region in data.fptcloud_s3_service_enable.hoanglm32.s3_enable_services : | ||
region.s3_service_name => { | ||
id = region.s3_service_id | ||
platform = region.s3_platform | ||
region_name = region.s3_service_name | ||
} | ||
} | ||
} | ||
// Region name only, * for all if you want specific index, use [0], [1], ... | ||
output "region_name" { | ||
value = data.fptcloud_s3_service_enable.hoanglm32.s3_enable_services[*].s3_service_name | ||
} |
10 changes: 10 additions & 0 deletions
10
examples/data-sources/fptcloud_object_storage/datasource_list_sub_user.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
data "fptcloud_object_storage_sub_user" "hoanglm32" { | ||
vpc_id = "your_vpc_id" | ||
page = 1 | ||
page_size = 100000 | ||
region_name = "your_region_name" | ||
} | ||
// for raw data and all sub users will be listed | ||
output "list_sub_user" { | ||
value = data.fptcloud_object_storage_sub_user.hoanglm32.list_sub_user | ||
} |
6 changes: 6 additions & 0 deletions
6
examples/resources/fptcloud_object_storage/resource_bucket_acl.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
resource "fptcloud_object_storage_bucket_acl" "bucket_acl" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_bucket_region" | ||
bucket_name = "your_bucket_name" | ||
canned_acl = "private" | ||
} |
23 changes: 23 additions & 0 deletions
23
examples/resources/fptcloud_object_storage/resource_bucket_cors..tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
resource "fptcloud_object_storage_bucket_cors" "example_bucket_cors" { | ||
vpc_id = "1b413c55-b752-4183-abad-06c4b5aca6ad" | ||
region_name = "HCM-02" | ||
bucket_name = "a-hoanglm32-test" | ||
|
||
# Option 1: Load cors config from file | ||
cors_config_file = file("${path.module}/your_bucket_cors_config.json") | ||
|
||
# Option 2: Inline cors_config | ||
# cors_config = jsonencode({ | ||
# { | ||
# "ID": "a9099", | ||
# "AllowedOrigins": ["http://www.example.com", "http://www.example2.com"], | ||
# "AllowedMethods": ["GET", "PUT", "DELETE"], | ||
# "MaxAgeSeconds": 3000, | ||
# "ExposeHeaders": ["Etag", "x-amz"], | ||
# "AllowedHeaders": ["*", "demo"] | ||
# } | ||
# }) | ||
} | ||
output "bucket_cors" { | ||
value = fptcloud_object_storage_bucket_cors.example_bucket_cors.status | ||
} |
12 changes: 12 additions & 0 deletions
12
examples/resources/fptcloud_object_storage/resource_bucket_lifecycle.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
resource "fptcloud_object_storage_bucket_lifecycle" "example_bucket_lifecycle" { | ||
bucket_name = "your_bucket_name" | ||
region_name = "your_region_name" | ||
vpc_id = "your_vpc_id" | ||
|
||
# Option 1: Load policy from file | ||
life_cycle_rule_file = file("${path.module}/your_bucket_lifecycle.json") | ||
} | ||
|
||
output "bucket_lifecycle" { | ||
value = fptcloud_object_storage_bucket_lifecycle.example_bucket_lifecycle | ||
} |
26 changes: 26 additions & 0 deletions
26
examples/resources/fptcloud_object_storage/resource_bucket_policy.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
resource "fptcloud_object_storage_bucket_policy" "example_bucket_policy" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region_name" | ||
bucket_name = "your_bucket_name" | ||
|
||
// Option 1: Load policy from file | ||
policy_file = file("${path.module}/your_bucket_policy_json_content.json") | ||
|
||
// Option 2: Inline policy | ||
// policy = jsonencode({ | ||
// Version = "2012-10-17" | ||
// Statement = [ | ||
// { | ||
// Sid = "PublicReadGetObject" | ||
// Effect = "Allow" | ||
// Principal = "*" | ||
// Action = "s3:GetObject" | ||
// Resource = "arn:aws:s3:::example-bucket/*" | ||
// } | ||
// ] | ||
// }) | ||
} | ||
// NOTE: In case wanna delete bucket policy, just ignore policy_file and policy fields | ||
output "bucket_policy" { | ||
value = fptcloud_object_storage_bucket_policy.example_bucket_policy.status | ||
} |
7 changes: 7 additions & 0 deletions
7
examples/resources/fptcloud_object_storage/resource_bucket_static_website.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resource "fptcloud_object_storage_bucket_static_website" "example_static_website" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region" | ||
bucket_name = "your_bucket_name" | ||
index_document_suffix = "your_index_document_suffix" | ||
error_document_key = "your_error_document_suffix" | ||
} |
7 changes: 7 additions & 0 deletions
7
examples/resources/fptcloud_object_storage/resource_bucket_versioning.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resource "fptcloud_object_storage_bucket_versioning" "versioning" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_bucket_region" | ||
bucket_name = "your_bucket_name" | ||
versioning_status = "Suspended" // or "Enabled" | ||
} | ||
|
6 changes: 6 additions & 0 deletions
6
examples/resources/fptcloud_object_storage/resource_sub_user.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
resource "fptcloud_object_storage_sub_user" "example" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region_name" | ||
user_id = "your_user_id" | ||
role = "your_role" | ||
} |
5 changes: 5 additions & 0 deletions
5
examples/resources/fptcloud_object_storage/resource_sub_user_access_key.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resource "fptcloud_object_storage_user_key" "test_key" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region_name" | ||
user_id = "your_user_id" | ||
} |
4 changes: 4 additions & 0 deletions
4
examples/resources/fptcloud_object_storage/resource_user_key.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resource "fptcloud_object_storage_access_key" "test_key" { | ||
vpc_id = "your_vpc_id" | ||
region_name = "your_region_name" | ||
} |
Oops, something went wrong.