From 2b1e32be918f3ad9be02950d44c0a295e2f46f33 Mon Sep 17 00:00:00 2001 From: hoanglm Date: Mon, 18 Nov 2024 22:39:45 +0700 Subject: [PATCH] [Object Storage] update: docs for resource and data source tf --- .../data-sources/object_storage_bucket_acl.md | 55 ++++++++++++++++ .../object_storage_bucket_cors.md | 45 ++++++++++++++ .../object_storage_bucket_lifecycle.md | 55 ++++++++++++++++ .../object_storage_bucket_list.md | 47 ++++++++++++++ .../object_storage_bucket_policy.md | 36 +++++++++++ .../object_storage_bucket_static_website.md | 37 +++++++++++ .../object_storage_bucket_versioning.md | 42 +++++++++++++ .../object_storage_service_enable .md | 41 ++++++++++++ docs/data-sources/object_storage_sub_user.md | 51 +++++++++++++++ .../object_storage_sub_user_detail.md | 51 +++++++++++++++ .../data-sources/object_storgae_access_key.md | 42 +++++++++++++ docs/resources/object_storage_access_key.md | 34 ++++++++++ docs/resources/object_storage_bucket_acl.md | 38 ++++++++++++ docs/resources/object_storage_bucket_cors.md | 55 ++++++++++++++++ .../object_storage_bucket_lifecycle.md | 62 +++++++++++++++++++ docs/resources/object_storage_bucket_list.md | 38 ++++++++++++ .../object_storage_bucket_static_website.md | 39 ++++++++++++ .../object_storage_bucket_versioning.md | 36 +++++++++++ docs/resources/object_storage_sub_user.md | 36 +++++++++++ docs/resources/object_storage_sub_user_key.md | 39 ++++++++++++ 20 files changed, 879 insertions(+) create mode 100644 docs/data-sources/object_storage_bucket_acl.md create mode 100644 docs/data-sources/object_storage_bucket_cors.md create mode 100644 docs/data-sources/object_storage_bucket_lifecycle.md create mode 100644 docs/data-sources/object_storage_bucket_list.md create mode 100644 docs/data-sources/object_storage_bucket_policy.md create mode 100644 docs/data-sources/object_storage_bucket_static_website.md create mode 100644 docs/data-sources/object_storage_bucket_versioning.md create mode 100644 docs/data-sources/object_storage_service_enable .md create mode 100644 docs/data-sources/object_storage_sub_user.md create mode 100644 docs/data-sources/object_storage_sub_user_detail.md create mode 100644 docs/data-sources/object_storgae_access_key.md create mode 100644 docs/resources/object_storage_access_key.md create mode 100644 docs/resources/object_storage_bucket_acl.md create mode 100644 docs/resources/object_storage_bucket_cors.md create mode 100644 docs/resources/object_storage_bucket_lifecycle.md create mode 100644 docs/resources/object_storage_bucket_list.md create mode 100644 docs/resources/object_storage_bucket_static_website.md create mode 100644 docs/resources/object_storage_bucket_versioning.md create mode 100644 docs/resources/object_storage_sub_user.md create mode 100644 docs/resources/object_storage_sub_user_key.md diff --git a/docs/data-sources/object_storage_bucket_acl.md b/docs/data-sources/object_storage_bucket_acl.md new file mode 100644 index 0000000..3d601a4 --- /dev/null +++ b/docs/data-sources/object_storage_bucket_acl.md @@ -0,0 +1,55 @@ +--- +page_title: "fptcloud_object_storage_bucket_acl Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves Access Control List (ACL) information for a specific bucket in FPT Cloud Object Storage. +--- + +# fptcloud_object_storage_bucket_acl (Data Source) + +Retrieves the Access Control List (ACL) details for a specific bucket in FPT Cloud Object Storage. + +## Example Usage + +```terraform +data "fptcloud_object_storage_bucket_acl" "example" { + vpc_id = "vpc-12345" + bucket_name = "my-bucket" + region_name = "HCM-02" +} + +output "bucket_acl" { + value = data.fptcloud_object_storage_bucket_acl.example +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC where the bucket is located +- `bucket_name` (String) Name of the bucket to retrieve ACL information +- `region_name` (String) The region name for the S3 service (e.g., HCM-01, HCM-02, HN-01, HN-02) + +### Read-Only + +- `canned_acl` (String) The Access Control List (ACL) status of the bucket (private, public-read, default is private) +- `status` (Boolean) The status of the ACL configuration +- `bucket_acl` (List) Details of the bucket's Access Control List + - `owner` (List) + - `display_name` (String) + - `id` (String) + - `grants` (List) + - `grantee` (List) + - `display_name` (String) + - `id` (String) + - `type` (String) + - `permission` (String) + +## Attributes Reference + +The following attributes are exported: + +- `canned_acl`: Indicates the predefined ACL status of the bucket +- `status`: Confirms whether the ACL retrieval was successful +- `bucket_acl`: Provides detailed ACL information including owner and grant details \ No newline at end of file diff --git a/docs/data-sources/object_storage_bucket_cors.md b/docs/data-sources/object_storage_bucket_cors.md new file mode 100644 index 0000000..7961a78 --- /dev/null +++ b/docs/data-sources/object_storage_bucket_cors.md @@ -0,0 +1,45 @@ +--- +page_title: "fptcloud_object_storage_bucket_cors Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves CORS (Cross-Origin Resource Sharing) configuration for a specific bucket in FPT Cloud Object Storage. +--- + +## Example Usage + +```terraform +data "fptcloud_object_storage_bucket_cors" "example" { + vpc_id = "vpc-12345" + bucket_name = "my-bucket" + region_name = "HCM-02" + page = 1 + page_size = 10 +} + +output "cors_rules" { + value = data.fptcloud_object_storage_bucket_cors.example.cors_rule +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC +- `bucket_name` (String) Name of the bucket +- `region_name` (String) The region name for the S3 service (HCM-01, HCM-02, HN-01, HN-02) + +### Optional + +- `page` (Number) Page number for pagination (default: 1) +- `page_size` (Number) Number of items per page (default: 25) + +### Read-Only + +- `cors_rule` (List) CORS rules for the bucket with the following attributes: + - `id` (String) Unique identifier for the CORS rule + - `allowed_headers` (List of Strings) HTTP headers allowed in preflight requests + - `allowed_methods` (List of Strings) HTTP methods allowed + - `allowed_origins` (List of Strings) Origins allowed to make cross-origin requests + - `expose_headers` (List of Strings, Optional) Headers exposed to the browser + - `max_age_seconds` (Number, Optional) Maximum time browser can cache preflight response diff --git a/docs/data-sources/object_storage_bucket_lifecycle.md b/docs/data-sources/object_storage_bucket_lifecycle.md new file mode 100644 index 0000000..935d4a0 --- /dev/null +++ b/docs/data-sources/object_storage_bucket_lifecycle.md @@ -0,0 +1,55 @@ +--- +page_title: "fptcloud_object_storage_bucket_lifecycle Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves lifecycle configuration for a specific bucket in FPT Cloud Object Storage. +--- + +# fptcloud_object_storage_bucket_lifecycle (Data Source) + +Retrieves lifecycle configuration for a specific bucket in FPT Cloud Object Storage. + +## Example Usage + +```terraform +data "fptcloud_object_storage_bucket_lifecycle" "example" { + vpc_id = "vpc-12345" + bucket_name = "my-bucket" + region_name = "HCM-02" + page = 1 + page_size = 10 +} + +output "lifecycle_rules" { + value = data.fptcloud_object_storage_bucket_lifecycle.example.life_cycle_rules +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC +- `bucket_name` (String) Name of the bucket +- `region_name` (String) The region name for the S3 service (HCM-01, HCM-02, HN-01, HN-02) + +### Optional + +- `page` (Number) Page number for pagination (default: 1) +- `page_size` (Number) Number of items per page (default: 25) + +### Read-Only + +- `life_cycle_rules` (List) Lifecycle rules for the bucket with the following attributes: + - `id` (String) Unique identifier for the lifecycle rule + - `filter` (List) Optional filter for rule application + - `prefix` (String) Prefix to filter objects + - `status` (String) Status of the lifecycle rule + - `prefix` (String) Prefix for the rule + - `expiration` (List) Rules for object expiration + - `days` (Number) Number of days before object expiration + - `expired_object_delete_marker` (Boolean) Whether to remove delete markers + - `noncurrent_version_expiration` (List) Rules for non-current version expiration + - `noncurrent_days` (Number) Number of days before non-current version expires + - `abort_incomplete_multipart_upload` (List) Rules for aborting incomplete multipart uploads + - `days_after_initiation` (Number) Days after which to abort incomplete uploads \ No newline at end of file diff --git a/docs/data-sources/object_storage_bucket_list.md b/docs/data-sources/object_storage_bucket_list.md new file mode 100644 index 0000000..f4514f5 --- /dev/null +++ b/docs/data-sources/object_storage_bucket_list.md @@ -0,0 +1,47 @@ +--- +page_title: "fptcloud_object_storage_bucket Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves a list of buckets in FPT Cloud Object Storage. +--- + +# fptcloud_object_storage_bucket (Data Source) + +Retrieves a list of buckets in FPT Cloud Object Storage. + +## Example Usage + +```terraform +data "fptcloud_object_storage_bucket" "example" { + vpc_id = "vpc-12345" + region_name = "HCM-02" + page = 1 + page_size = 10 +} + +output "buckets" { + value = data.fptcloud_object_storage_bucket.example.list_bucket_result +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC +- `region_name` (String) The region name for the S3 service (HCM-01, HCM-02, HN-01, HN-02) + +### Optional + +- `page` (Number) Page number for pagination (default: 1) +- `page_size` (Number) Number of items per page (default: 25) + +### Read-Only + +- `list_bucket_result` (List) List of buckets with the following attributes: + - `endpoint` (String) The endpoint of the bucket + - `is_enabled_logging` (Boolean) Whether logging is enabled for the bucket + - `bucket_name` (String) The name of the bucket + - `creation_date` (String) The date when the bucket was created + - `s3_service_id` (String) The S3 service ID + - `is_empty` (Boolean) Whether the bucket is empty \ No newline at end of file diff --git a/docs/data-sources/object_storage_bucket_policy.md b/docs/data-sources/object_storage_bucket_policy.md new file mode 100644 index 0000000..2bff263 --- /dev/null +++ b/docs/data-sources/object_storage_bucket_policy.md @@ -0,0 +1,36 @@ +--- +page_title: "fptcloud_object_storage_bucket_policy Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves the policy configuration for a specific bucket in FPT Cloud Object Storage. +--- + +# fptcloud_object_storage_bucket_policy (Data Source) + +Retrieves the policy configuration for a specific bucket in FPT Cloud Object Storage. + +## Example Usage + +```terraform +data "fptcloud_object_storage_bucket_policy" "example" { + vpc_id = "vpc-12345" + bucket_name = "my-bucket" + region_name = "HCM-02" +} + +output "bucket_policy" { + value = data.fptcloud_object_storage_bucket_policy.example.policy +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC +- `bucket_name` (String) Name of the bucket to retrieve policy +- `region_name` (String) The region name for the S3 service (HCM-01, HCM-02, HN-01, HN-02) + +### Read-Only + +- `policy` (String) The bucket policy in JSON format \ No newline at end of file diff --git a/docs/data-sources/object_storage_bucket_static_website.md b/docs/data-sources/object_storage_bucket_static_website.md new file mode 100644 index 0000000..681c5fb --- /dev/null +++ b/docs/data-sources/object_storage_bucket_static_website.md @@ -0,0 +1,37 @@ +--- +page_title: "fptcloud_object_storage_bucket_static_website Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves static website configuration for a specific bucket in FPT Cloud Object Storage. +--- + +# fptcloud_object_storage_bucket_static_website (Data Source) + +Retrieves static website configuration for a specific bucket in FPT Cloud Object Storage. + +## Example Usage + +```terraform +data "fptcloud_object_storage_bucket_static_website" "example" { + vpc_id = "vpc-12345" + bucket_name = "my-website-bucket" + region_name = "HCM-02" +} + +output "index_document" { + value = data.fptcloud_object_storage_bucket_static_website.example.index_document_suffix +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC +- `bucket_name` (String) Name of the bucket with static website configuration +- `region_name` (String) The region name for the S3 service (HCM-01, HCM-02, HN-01, HN-02) + +### Optional/Computed + +- `index_document_suffix` (String) Suffix for index documents (e.g., "index.html") +- `error_document_key` (String) Key for error documents \ No newline at end of file diff --git a/docs/data-sources/object_storage_bucket_versioning.md b/docs/data-sources/object_storage_bucket_versioning.md new file mode 100644 index 0000000..3c59819 --- /dev/null +++ b/docs/data-sources/object_storage_bucket_versioning.md @@ -0,0 +1,42 @@ +--- +page_title: "fptcloud_object_storage_bucket_versioning Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves the versioning configuration for a specific bucket in FPT Cloud Object Storage. +--- + +# fptcloud_object_storage_bucket_versioning (Data Source) + +Retrieves the versioning configuration for a specific bucket in FPT Cloud Object Storage. + +## Example Usage + +```terraform +data "fptcloud_object_storage_bucket_versioning" "example" { + vpc_id = "vpc-12345" + region_name = "HCM-01" + bucket_name = "my-bucket" +} + +output "versioning_status" { + value = data.fptcloud_object_storage_bucket_versioning.example.versioning_status +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC +- `region_name` (String) The region name for the S3 service (e.g., HCM-01, HCM-02, HN-01, HN-02) +- `bucket_name` (String) Name of the bucket + +### Read-Only + +- `versioning_status` (String) Status of the versioning, either "Enabled" or "Suspended" + +## Attributes Reference + +The following attributes are exported: + +- `versioning_status`: The current versioning configuration of the bucket diff --git a/docs/data-sources/object_storage_service_enable .md b/docs/data-sources/object_storage_service_enable .md new file mode 100644 index 0000000..5651124 --- /dev/null +++ b/docs/data-sources/object_storage_service_enable .md @@ -0,0 +1,41 @@ +--- +page_title: "fptcloud_object_storage_service_enable Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves the enabled S3 services for a specific VPC in FPT Cloud Object Storage. +--- + +# fptcloud_object_storage_service_enable (Data Source) + +Retrieves the enabled S3 services for a specific VPC in FPT Cloud Object Storage. + +## Example Usage + +```terraform +data "fptcloud_object_storage_service_enable" "example" { + vpc_id = "vpc-12345" +} + +output "enabled_services" { + value = data.fptcloud_object_storage_service_enable.example.s3_enable_services +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC + +### Read-Only + +- `s3_enable_services` (List) List of enabled S3 services + - `s3_service_name` (String) The name of the S3 service (region name) + - `s3_service_id` (String) The unique identifier of the S3 service + - `s3_platform` (String) The platform of the S3 service + +## Attributes Reference + +The following attributes are exported: + +- `s3_enable_services`: A list of enabled S3 services with their details \ No newline at end of file diff --git a/docs/data-sources/object_storage_sub_user.md b/docs/data-sources/object_storage_sub_user.md new file mode 100644 index 0000000..689bbe3 --- /dev/null +++ b/docs/data-sources/object_storage_sub_user.md @@ -0,0 +1,51 @@ +--- +page_title: "fptcloud_object_storage_sub_user Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves a list of sub-users for a specific VPC and region in FPT Cloud Object Storage. +--- + +# fptcloud_object_storage_sub_user (Data Source) + +Retrieves a list of sub-users for a specific VPC and region in FPT Cloud Object Storage. + +## Example Usage + +```terraform +data "fptcloud_object_storage_sub_user" "example" { + vpc_id = "vpc-12345" + region_name = "HCM-01" + page = 1 + page_size = 50 +} + +output "sub_users" { + value = data.fptcloud_object_storage_sub_user.example.list_sub_user +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC +- `region_name` (String) The region name for the S3 service (e.g., HCM-01, HCM-02, HN-01, HN-02) + +### Optional + +- `page` (Number) Page number for pagination (default: 1) +- `page_size` (Number) Number of items per page (default: 100) + +### Read-Only + +- `list_sub_user` (List) List of sub-users + - `user_id` (String) The unique identifier of the sub-user + - `role` (String) The role of the sub-user + - `active` (Boolean) Whether the sub-user is active + - `arn` (String) The ARN (Amazon Resource Name) of the sub-user + +## Attributes Reference + +The following attributes are exported: + +- `list_sub_user`: A list of sub-users with their details \ No newline at end of file diff --git a/docs/data-sources/object_storage_sub_user_detail.md b/docs/data-sources/object_storage_sub_user_detail.md new file mode 100644 index 0000000..7e54d2e --- /dev/null +++ b/docs/data-sources/object_storage_sub_user_detail.md @@ -0,0 +1,51 @@ +--- +page_title: "fptcloud_object_storage_sub_user_detail Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves detailed information about a specific sub-user in FPT Cloud Object Storage. +--- + +# fptcloud_object_storage_sub_user_detail (Data Source) + +Retrieves detailed information about a specific sub-user in FPT Cloud Object Storage. + +## Example Usage + +```terraform +data "fptcloud_object_storage_sub_user_detail" "example" { + vpc_id = "vpc-12345" + region_name = "HCM-01" + user_id = "sub-user-123" +} + +output "sub_user_details" { + value = data.fptcloud_object_storage_sub_user_detail.example +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC +- `region_name` (String) The region name for the S3 service (e.g., HCM-01, HCM-02, HN-01, HN-02) + +### Read-Only + +- `user_id` (String) The sub-user ID +- `arn` (String) The sub-user ARN +- `active` (Boolean) Whether the sub-user is active +- `role` (String) The sub-user's role +- `created_at` (String) The sub-user's creation date +- `access_keys` (List of Strings) The sub-user's access keys + +## Attributes Reference + +The following attributes are exported: + +- `user_id`: Unique identifier of the sub-user +- `arn`: Amazon Resource Name of the sub-user +- `active`: Activation status of the sub-user +- `role`: Role assigned to the sub-user +- `created_at`: Timestamp of sub-user creation +- `access_keys`: List of access keys associated with the sub-user \ No newline at end of file diff --git a/docs/data-sources/object_storgae_access_key.md b/docs/data-sources/object_storgae_access_key.md new file mode 100644 index 0000000..527804f --- /dev/null +++ b/docs/data-sources/object_storgae_access_key.md @@ -0,0 +1,42 @@ +--- +page_title: "fptcloud_object_storage_access_key Data Source - terraform-provider-fptcloud" +subcategory: "Object Storage" +description: |- + Retrieves the Access Key credentials for a specific VPC and region in FPT Cloud Object Storage. +--- + +# fptcloud_object_storage_access_key (Data Source) + +Retrieves the Access Key credentials for a specific VPC and region in FPT Cloud Object Storage. + +## Example Usage + +```terraform +data "fptcloud_object_storage_access_key" "example" { + vpc_id = "vpc-12345" + region_name = "HCM-01" +} + +output "access_keys" { + value = data.fptcloud_object_storage_access_key.example.credentials +} +``` + +## Schema + +### Required + +- `vpc_id` (String) The ID of the VPC +- `region_name` (String) The region name for the S3 service (e.g., HCM-01, HCM-02, HN-01, HN-02) + +### Read-Only + +- `credentials` (List) List of access key credentials + - `access_key` (String) The access key string + - `active` (Boolean) Whether the access key is currently active + +## Attributes Reference + +The following attributes are exported: + +- `credentials`: A list of access key credentials with their current active status diff --git a/docs/resources/object_storage_access_key.md b/docs/resources/object_storage_access_key.md new file mode 100644 index 0000000..9bb1873 --- /dev/null +++ b/docs/resources/object_storage_access_key.md @@ -0,0 +1,34 @@ +# fptcloud_object_storage_access_key (Resource) + +Provides a FPT Cloud Object Storage access key resource for managing S3 access credentials. + +## Example Usage + + +resource "fptcloud_object_storage_access_key" "example" { + vpc_id = "your_vpc_id" + region_name = "HCM-01" +} + +## Schema + +### Required Arguments + +- `vpc_id` (String, Required) The VPC ID associated with the Object Storage service +- `region_name` (String, Required) The region name for the S3 service. Current supported regions: HCM-01, HCM-02, HN-01, HN-02 + +### Optional Arguments + +- `access_key_id` (String, Optional) The access key ID (can be omitted) +- `status` (Boolean, Optional) The status after creating the access key +- `message` (String, Optional) The message after creating the access key + +### Computed Attributes + +- `secret_access_key` (String, Computed) The secret access key generated for the access key + +## Notes + +- This resource creates an access key for Object Storage within a specific VPC and region +- The region must be enabled for the specified VPC +- Once created, the access key cannot be updated, only deleted and recreated \ No newline at end of file diff --git a/docs/resources/object_storage_bucket_acl.md b/docs/resources/object_storage_bucket_acl.md new file mode 100644 index 0000000..4e3f12b --- /dev/null +++ b/docs/resources/object_storage_bucket_acl.md @@ -0,0 +1,38 @@ +# fptcloud_object_storage_bucket_acl (Resource) + +Provides a FPT Cloud Object Storage bucket ACL resource for managing bucket access control lists. + +## Example Usage + +```terraform +resource "fptcloud_object_storage_bucket_acl" "example" { + vpc_id = "your_vpc_id" + bucket_name = "my-bucket-name" + region_name = "HCM-01" + canned_acl = "private" + apply_objects = false +} +``` + +## Schema + +### Required Arguments + +- `vpc_id` (String, Required) The VPC ID associated with the bucket +- `bucket_name` (String, Required) The name of the bucket to configure +- `region_name` (String, Required) The region name for the S3 service. Current supported regions: HCM-01, HCM-02, HN-01, HN-02 +- `canned_acl` (String, Required) The Access Control List status. Valid values: "private" or "public-read" + +### Optional Arguments + +- `apply_objects` (Boolean, Optional) Whether to apply the ACL to all objects in the bucket. Default is false. + +### Computed Attributes + +- `status` (Boolean, Computed) The status after configuring the bucket ACL + +## Notes + +- Only two ACL modes are supported: "private" and "public-read" +- The delete operation is a no-op and will remove the resource from state +- The region must be enabled for the specified VPC \ No newline at end of file diff --git a/docs/resources/object_storage_bucket_cors.md b/docs/resources/object_storage_bucket_cors.md new file mode 100644 index 0000000..de09cd5 --- /dev/null +++ b/docs/resources/object_storage_bucket_cors.md @@ -0,0 +1,55 @@ +# fptcloud_object_storage_bucket_cors (Resource) + +Provides a FPT Cloud Object Storage bucket Cross-Origin Resource Sharing (CORS) configuration resource. + +## Example Usage + +```terraform +resource "fptcloud_object_storage_bucket_cors" "example" { + bucket_name = "my-bucket-name" + vpc_id = "your_vpc_id" + region_name = "HCM-01" + cors_config = jsonencode({ + ID = "cors-rule-1" + AllowedOrigins = ["https://example.com"] + AllowedMethods = ["GET", "POST"] + AllowedHeaders = ["*"] + MaxAgeSeconds = 3000 + }) +} +``` + +## Schema + +### Required Arguments + +- `bucket_name` (String, Required) Name of the bucket to configure CORS +- `vpc_id` (String, Required) The VPC ID associated with the bucket +- `region_name` (String, Required) The region name for the S3 service. Current supported regions: HCM-01, HCM-02, HN-01, HN-02 + +### Optional Arguments + +- `cors_config` (String, Optional) The CORS configuration in JSON format +- `cors_config_file` (String, Optional) Path to a JSON file containing the CORS configuration + +### Computed Attributes + +- `status` (Boolean, Computed) Status after bucket CORS rule is created +- `bucket_cors_rules` (List, Computed) List of created CORS rules + +## CORS Configuration + +The CORS configuration supports the following fields: +- `ID`: Unique identifier for the CORS rule +- `AllowedOrigins`: List of allowed origins +- `AllowedMethods`: List of allowed HTTP methods +- `AllowedHeaders`: List of allowed headers (optional) +- `ExposeHeaders`: List of headers to expose (optional) +- `MaxAgeSeconds`: Maximum time browser can cache the response + +## Notes + +- Only one CORS rule can be configured at a time +- Either `cors_config` or `cors_config_file` must be specified +- The configuration must be valid JSON +- The region must be enabled for the specified VPC \ No newline at end of file diff --git a/docs/resources/object_storage_bucket_lifecycle.md b/docs/resources/object_storage_bucket_lifecycle.md new file mode 100644 index 0000000..75a15aa --- /dev/null +++ b/docs/resources/object_storage_bucket_lifecycle.md @@ -0,0 +1,62 @@ +# fptcloud_object_storage_bucket_lifecycle (Resource) + +Provides a FPT Cloud Object Storage bucket lifecycle management resource. + +## Example Usage + +```terraform +resource "fptcloud_object_storage_bucket_lifecycle" "example" { + vpc_id = "your_vpc_id" + bucket_name = "example-bucket" + region_name = "HCM-01" + life_cycle_rule = jsonencode({ + ID: "example-lifecycle-rule", + Filter: { + Prefix: "" + }, + Expiration: { + Days: 30 + }, + NoncurrentVersionExpiration: { + NoncurrentDays: 30 + }, + AbortIncompleteMultipartUpload: { + DaysAfterInitiation: 7 + } + }) +} +``` + +## Schema + +### Required Arguments + +- `vpc_id` (String, Required) The VPC ID +- `bucket_name` (String, Required) Name of the bucket +- `region_name` (String, Required) The region name for the S3 service. Supported regions: HCM-01, HCM-02, HN-01, HN-02 + +### Optional Arguments + +- `life_cycle_rule` (String, Optional) The bucket lifecycle rule in JSON format +- `life_cycle_rule_file` (String, Optional) Path to a JSON file containing the bucket lifecycle rule + - Cannot be used simultaneously with `life_cycle_rule` + +### Computed Attributes + +- `state` (Boolean) State after bucket lifecycle rule is created +- `rules` (List) List of lifecycle rule IDs + +## Lifecycle Rule Configuration + +The lifecycle rule must be a valid JSON object with the following structure: +- `ID`: Unique identifier for the rule +- `Filter`: Object with a `Prefix` key defining the rule's scope +- `Expiration`: Object with either `Days` or `ExpiredObjectDeleteMarker` +- `NoncurrentVersionExpiration`: Object with `NoncurrentDays` +- `AbortIncompleteMultipartUpload`: Object with `DaysAfterInitiation` + +## Notes + +- Only one lifecycle rule is supported per configuration +- Cannot set both `Expiration.Days` and `Expiration.ExpiredObjectDeleteMarker` simultaneously +- The region must be enabled for the specified VPC \ No newline at end of file diff --git a/docs/resources/object_storage_bucket_list.md b/docs/resources/object_storage_bucket_list.md new file mode 100644 index 0000000..ab6331b --- /dev/null +++ b/docs/resources/object_storage_bucket_list.md @@ -0,0 +1,38 @@ +# fptcloud_object_storage_bucket (Resource) + +Provides a FPT Cloud Object Storage bucket resource for managing S3 buckets. + +## Example Usage + +```terraform +resource "fptcloud_object_storage_bucket" "example" { + name = "my-bucket-name" + vpc_id = "your_vpc_id" + region_name = "HCM-01" + versioning = "Enabled" + acl = "private" +} +``` + +## Schema + +### Required Arguments + +- `name` (String, Required) The name of the bucket. Must be unique within an account. +- `vpc_id` (String, Required) The VPC ID associated with the bucket +- `region_name` (String, Required) The region name for the S3 service. Current supported regions: HCM-01, HCM-02, HN-01, HN-02 + +### Optional Arguments + +- `versioning` (String, Optional) The versioning state of the bucket. Accepted values are "Enabled" or "Suspended". Default is not set. +- `acl` (String, Optional) The Access Control List for the bucket. Default is "private". + +### Computed Attributes + +- `status` (Boolean, Computed) The status after creating or deleting the bucket + +## Notes + +- The bucket name must be unique across all buckets in the account +- The region must be enabled for the specified VPC +- Once created, certain attributes like name and region cannot be changed \ No newline at end of file diff --git a/docs/resources/object_storage_bucket_static_website.md b/docs/resources/object_storage_bucket_static_website.md new file mode 100644 index 0000000..fa0b200 --- /dev/null +++ b/docs/resources/object_storage_bucket_static_website.md @@ -0,0 +1,39 @@ +# fptcloud_object_storage_static_website (Resource) + +Provides a FPT Cloud Object Storage static website configuration resource. + +## Example Usage + +```terraform +resource "fptcloud_object_storage_static_website" "example" { + vpc_id = "your_vpc_id" + bucket_name = "example-bucket" + region_name = "HCM-01" + index_document_suffix = "index.html" + error_document_key = "error.html" +} +``` + +## Schema + +### Required Arguments + +- `vpc_id` (String, Required) The VPC ID +- `bucket_name` (String, Required) Name of the bucket +- `region_name` (String, Required) The region name for the S3 service. Supported regions: HCM-01, HCM-02, HN-01, HN-02 + +### Optional Arguments + +- `index_document_suffix` (String, Optional, Default: "index.html") + - Suffix appended to directory request +- `error_document_key` (String, Optional, Default: "error.html") + - Object key name used when a 4XX class error occurs + +### Computed Attributes + +- `status` (Boolean) Status after configuring the bucket website + +## Notes + +- The region must be enabled for the specified VPC +- Default index and error documents can be customized \ No newline at end of file diff --git a/docs/resources/object_storage_bucket_versioning.md b/docs/resources/object_storage_bucket_versioning.md new file mode 100644 index 0000000..0333fb4 --- /dev/null +++ b/docs/resources/object_storage_bucket_versioning.md @@ -0,0 +1,36 @@ +# fptcloud_object_storage_bucket_versioning (Resource) + +Provides a FPT Cloud Object Storage bucket versioning configuration resource. + +## Example Usage + +```hcl +resource "fptcloud_object_storage_bucket_versioning" "example" { + bucket_name = "your-bucket-name" + versioning_status = "Enabled" + vpc_id = "your_vpc_id" + region_name = "HCM-01" +} +``` + +## Schema + +### Required Arguments + +* `bucket_name` (String, Required) Name of the S3 bucket +* `versioning_status` (String, Required) Versioning status for the bucket. Must be either "Enabled" or "Suspended" +* `vpc_id` (String, Required) The VPC ID associated with the Object Storage service +* `region_name` (String, Required) The region name for the S3 service. Currently supported regions: HCM-01, HCM-02, HN-01, HN-02 + +## Behavior Notes + +* Configures versioning for an existing S3 bucket +* Versioning status can only be "Enabled" or "Suspended" +* Changes to versioning status will recreate the resource +* Deletion of the resource is not supported (resource ID is simply cleared) + +## Notes + +* Cannot delete bucket versioning configuration +* Region must be enabled for the specified VPC +* Versioning status is immutable after creation \ No newline at end of file diff --git a/docs/resources/object_storage_sub_user.md b/docs/resources/object_storage_sub_user.md new file mode 100644 index 0000000..831e029 --- /dev/null +++ b/docs/resources/object_storage_sub_user.md @@ -0,0 +1,36 @@ +# fptcloud_object_storage_sub_user (Resource) + +Provides a FPT Cloud Object Storage sub-user resource for managing S3 sub-user access. + +## Example Usage + +```hcl +resource "fptcloud_object_storage_sub_user" "example" { + vpc_id = "your_vpc_id" + region_name = "HCM-01" + user_id = "unique_sub_user_id" + role = "your_role" +} +``` + +## Schema + +### Required Arguments + +- `vpc_id` (String, Required) The VPC ID associated with the Object Storage service +- `region_name` (String, Required) The region name for the S3 service. Currently supported regions: HCM-01, HCM-02, HN-01, HN-02 +- `user_id` (String, Required) A unique identifier for the sub-user +- `role` (String, Required) The role assigned to the sub-user + +## Behavior Notes + +- Creates a sub-user within a specific VPC and region +- The specified region must be enabled for the VPC +- Sub-user is created with the specified role +- Once created, the sub-user can only be deleted, not updated +- Deletion removes the sub-user from the Object Storage service + +## Notes + +- Requires a valid VPC and enabled region +- Sub-user ID must be unique diff --git a/docs/resources/object_storage_sub_user_key.md b/docs/resources/object_storage_sub_user_key.md new file mode 100644 index 0000000..475d32b --- /dev/null +++ b/docs/resources/object_storage_sub_user_key.md @@ -0,0 +1,39 @@ +# fptcloud_object_storage_sub_user_keys (Resource) + +Provides a FPT Cloud Object Storage sub-user access key resource for managing S3 sub-user credentials. + +## Example Usage + +```hcl +resource "fptcloud_object_storage_sub_user_keys" "example" { + vpc_id = "your_vpc_id" + region_name = "HCM-01" + user_id = "sub_user_id" +} +``` + +## Schema + +### Required Arguments + +* `vpc_id` (String, Required) The VPC ID that the S3 service belongs to +* `region_name` (String, Required) The region name for the S3 service. Currently supported regions: HCM-01, HCM-02, HN-01, HN-02 +* `user_id` (String, Required) The sub-user ID, can be retrieved from data source `fptcloud_object_storage_sub_user` + +### Computed Attributes + +* `access_key` (String, Computed) The access key of the sub-user +* `secret_key` (String, Computed) The secret key of the sub-user + +## Behavior Notes + +* Creates access keys for a specific sub-user within a VPC and region +* The specified region must be enabled for the VPC +* Access keys are generated upon resource creation +* Once created, the access key can only be deleted and recreated, not updated +* Deletion of the resource removes the access key for the sub-user + +## Notes + +* Only one set of access keys can be active for a sub-user at a time +* Requires a valid sub-user to be created beforehand \ No newline at end of file