From 536ad724c418e06321f415717197a3e9e67bb616 Mon Sep 17 00:00:00 2001
From: wangzepeng666 <852420284@qq.com>
Date: Wed, 27 Sep 2023 09:55:16 +0800
Subject: [PATCH] docs(obs): fix docs issues
---
docs/data-sources/s3_bucket_object.md | 42 +++--
docs/resources/obs_bucket.md | 155 +++++++++-------
docs/resources/obs_bucket_acl.md | 15 +-
docs/resources/obs_bucket_notifications.md | 6 +-
docs/resources/obs_bucket_object.md | 29 +--
docs/resources/obs_bucket_replication.md | 37 ++--
docs/resources/s3_bucket.md | 170 +++++++++++-------
docs/resources/s3_bucket_object.md | 46 ++---
docs/resources/s3_bucket_policy.md | 9 +-
.../resource_flexibleengine_s3_bucket.go | 62 +++----
10 files changed, 334 insertions(+), 237 deletions(-)
diff --git a/docs/data-sources/s3_bucket_object.md b/docs/data-sources/s3_bucket_object.md
index 978761125..a34c8f564 100644
--- a/docs/data-sources/s3_bucket_object.md
+++ b/docs/data-sources/s3_bucket_object.md
@@ -25,34 +25,50 @@ data "flexibleengine_s3_bucket_object" "b" {
The following arguments are supported:
-* `bucket` - (Required) The name of the bucket to read the object from
-* `key` - (Required) The full path to the object inside the bucket
-* `range` - (Optional) Obtains the specified range bytes of an object. The value is a range starting from 0 to
+* `bucket` - (Required, String) The name of the bucket to read the object from.
+
+* `key` - (Required, String) The full path to the object inside the bucket.
+
+* `range` - (Optional, String) Obtains the specified range bytes of an object. The value is a range starting from 0 to
maximum object length minus one. If the range is invalid, all object data is returned.
-* `version_id` - (Optional) Specific version ID of the object returned (defaults to latest version)
-## Attributes Reference
+* `version_id` - (Optional, String) Specific version ID of the object returned (defaults to latest version).
+
+## Attribute Reference
The following attributes are exported:
-* `body` - Object data (see **limitations above** to understand cases in which this field is actually available)
+* `body` - Object data (see **limitations above** to understand cases in which this field is actually available).
+
* `cache_control` - Specifies caching behavior along the request/reply chain.
+
* `content_disposition` - Specifies presentational information for the object.
-* `content_encoding` - Specifies what content encodings have been applied to the object and thus what decoding mechanisms
- must be applied to obtain the media-type referenced by the Content-Type header field.
+
+* `content_encoding` - Specifies what content encodings have been applied to the object and thus what decoding
+ mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.
+
* `content_language` - The language the content is in.
+
* `content_length` - Size of the body in bytes.
+
* `content_type` - A standard MIME type describing the format of the object data.
+
* `etag` - [ETag](https://en.wikipedia.org/wiki/HTTP_ETag) generated for the object
- (an MD5 sum of the object content in case it's not encrypted)
+ (an MD5 sum of the object content in case it's not encrypted).
+
* `expiration` - If the object expiration is configured, the field includes this header. It includes the expiry-date and
rule-id key value pairs providing object expiration information. The value of the rule-id is URL encoded.
+
* `expires` - The date and time at which the object is no longer cacheable.
-* `last_modified` - Last modified date of the object in RFC1123 format (e.g. `Mon, 02 Jan 2006 15:04:05 MST`)
-* `metadata` - A map of metadata stored with the object in S3
-* `server_side_encryption` - If the object is stored using server-side encryption (KMS or Amazon S3-managed encryption key),
- this field includes the chosen encryption and algorithm used.
+
+* `last_modified` - Last modified date of the object in RFC1123 format (e.g. `Mon, 02 Jan 2006 15:04:05 MST`).
+* `metadata` - A map of metadata stored with the object in S3.
+
+* `server_side_encryption` - If the object is stored using server-side encryption (KMS or Amazon S3-managed encryption
+ key), this field includes the chosen encryption and algorithm used.
+
* `sse_kms_key_id` - If present, specifies the ID of the Key Management Service (KMS) master encryption key that
was used for the object.
+
* `website_redirect_location` - If the bucket is configured as a website, redirects requests for this object to
another object in the same bucket or to an external URL. S3 stores the value of this header in the object metadata.
diff --git a/docs/resources/obs_bucket.md b/docs/resources/obs_bucket.md
index e57e5aec3..705bc84e3 100644
--- a/docs/resources/obs_bucket.md
+++ b/docs/resources/obs_bucket.md
@@ -141,8 +141,11 @@ resource "flexibleengine_obs_bucket" "bucket" {
The following arguments are supported:
-* `bucket` - (Required) Specifies the name of the bucket. Changing this parameter will create a new resource.
- A bucket must be named according to the globally applied DNS naming regulations as follows:
+* `region` - (Optional, String, ForceNew) Specifies the region in which to create the bucket resource.
+ If omitted, the provider-level region will be used. Changing this will create a new bucket resource.
+
+* `bucket` - (Required, String, ForceNew) Specifies the name of the bucket. Changing this parameter will create a new
+ resource. A bucket must be named according to the globally applied DNS naming regulations as follows:
+ The name must be globally unique in OBS.
+ The name must contain 3 to 63 characters. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed.
+ The name cannot start or end with a period (.) or hyphen (-), and cannot contain two consecutive periods (.) or
@@ -151,58 +154,62 @@ The following arguments are supported:
+ If the name contains any periods (.), a security certificate verification message may appear when you access
the bucket or its objects by entering a domain name.
-* `storage_class` - (Optional) Specifies the storage class of the bucket. OBS provides three storage classes:
- "STANDARD", "STANDARD_IA" (Infrequent Access) and "GLACIER" (Archive). Defaults to `STANDARD`.
+* `storage_class` - (Optional, String) Specifies the storage class of the bucket. OBS provides three storage classes:
+ "STANDARD", "STANDARD_IA" (Infrequent Access) and "GLACIER" (Archive). Defaults to `STANDARD`.
-* `acl` - (Optional) Specifies the ACL policy for a bucket. The predefined common policies are as follows:
- "private", "public-read", "public-read-write" and "log-delivery-write". Defaults to `private`.
+* `acl` - (Optional, String) Specifies the ACL policy for a bucket. The predefined common policies are as follows:
+ "private", "public-read", "public-read-write" and "log-delivery-write". Defaults to `private`.
-* `versioning` - (Optional) Whether enable versioning. Once you version-enable a bucket,
+* `versioning` - (Optional, Bool) Whether enable versioning. Once you version-enable a bucket,
it can never return to an unversioned state. You can, however, suspend versioning on that bucket.
-* `encryption` - (Optional) Whether enable default server-side encryption of the bucket in SSE-KMS mode.
+* `encryption` - (Optional, Bool) Whether enable default server-side encryption of the bucket in SSE-KMS mode.
+
+* `kms_key_id` - (Optional, String) Specifies the ID of a kms key. If omitted, the default master key will be used.
+
+* `logging` - (Optional, List) A settings of bucket logging. The [logging](#obs_logging) object structure is documented
+ below.
-* `kms_key_id` - (Optional) Specifies the ID of a kms key. If omitted, the default master key will be used.
+* `website` - (Optional, List) A website object. The [website](#obs_website) object structure is documented below.
-* `logging` - (Optional) A settings of bucket logging (documented below).
-* `website` - (Optional) A website object (documented below).
-* `cors_rule` - (Optional) A rule of Cross-Origin Resource Sharing (documented below).
-* `lifecycle_rule` - (Optional) A configuration of object lifecycle management (documented below).
+* `cors_rule` - (Optional, List) A rule of Cross-Origin Resource Sharing. The [cors_rule](#obs_cors_rule) object
+ structure is documented below.
-* `force_destroy` - (Optional) A boolean that indicates all objects should be deleted from the bucket so that
- the bucket can be destroyed without error. Default to `false`.
+* `lifecycle_rule` - (Optional, List) A configuration of object lifecycle management. The [lifecycle_rule](#obs_lifecycle_rule)
+ object structure is documented below.
-* `multi_az` - (Optional) Whether enable the multi-AZ mode for the bucket. When the multi-AZ mode is enabled,
- data in the bucket is duplicated and stored in multiple AZs.
- Changing this creates a new bucket.
+* `force_destroy` - (Optional, Bool) A boolean that indicates all objects should be deleted from the bucket so that
+ the bucket can be destroyed without error. Default to `false`.
+
+* `multi_az` - (Optional, Bool, ForceNew) Whether enable the multi-AZ mode for the bucket. When the multi-AZ mode is
+ enabled, data in the bucket is duplicated and stored in multiple AZs. Changing this creates a new bucket.
* `parallel_fs` - (Optional, Bool, ForceNew) Whether enable a bucket as a parallel file system. Changing this will
create a new bucket.
-* `region` - (Optional) If specified, the region this bucket should reside in. Otherwise, the region used by the provider.
- Changing this creates a new bucket.
-
-The `logging` object supports the following:
+
+The `logging` object supports:
-* `target_bucket` - (Required) The name of the bucket that will receive the log objects.
+* `target_bucket` - (Required, String) The name of the bucket that will receive the log objects.
The acl policy of the target bucket should be `log-delivery-write`.
-* `target_prefix` - (Optional) To specify a key prefix for log objects.
+* `target_prefix` - (Optional, String) To specify a key prefix for log objects.
-The `website` object supports the following:
+
+The `website` object supports:
-* `index_document` - (Required, unless using `redirect_all_requests_to`) Specifies the default homepage of
- the static website, only HTML web pages are supported.
+* `index_document` - (Required, String) Specifies the default homepage of the static website, only HTML web pages are
+ supported. It is **Optional** if using `redirect_all_requests_to`.
OBS only allows files such as `index.html` in the root directory of a bucket to function as the default homepage.
That is to say, do not set the default homepage with a multi-level directory structure (for example, /page/index.html).
-* `error_document` - (Optional) Specifies the error page returned when an error occurs during static website access.
- Only HTML, JPG, PNG, BMP, and WEBP files under the root directory are supported.
+* `error_document` - (Optional, String) Specifies the error page returned when an error occurs during static website
+ access. Only HTML, JPG, PNG, BMP, and WEBP files under the root directory are supported.
-* `redirect_all_requests_to` - (Optional) A hostname to redirect all website requests for this bucket to.
+* `redirect_all_requests_to` - (Optional, String) A hostname to redirect all website requests for this bucket to.
Hostname can optionally be prefixed with a protocol (`http://` or `https://`) to use when redirecting requests.
The default is the protocol that is used in the original request.
-* `routing_rules` - (Optional) A JSON or XML format containing routing rules describing redirect behavior and
+* `routing_rules` - (Optional, String) A JSON or XML format containing routing rules describing redirect behavior and
when redirects are applied.
Each rule contains a `Condition` and a `Redirect` as shown in the following table:
@@ -211,69 +218,81 @@ The `website` object supports the following:
Condition | KeyPrefixEquals, HttpErrorCodeReturnedEquals
Redirect | Protocol, HostName, ReplaceKeyPrefixWith, ReplaceKeyWith, HttpRedirectCode
-The `cors_rule` object supports the following:
+
+The `cors_rule` object supports:
-* `allowed_origins` (Required) Requests from this origin can access the bucket. Multiple matching rules are allowed.
- One rule occupies one line, and allows one wildcard character (*) at most.
+* `allowed_origins` (Required, List) Requests from this origin can access the bucket. Multiple matching rules are
+ allowed. One rule occupies one line, and allows one wildcard character (*) at most.
-* `allowed_methods` (Required) Specifies the acceptable operation type of buckets and objects.
+* `allowed_methods` (Required, List) Specifies the acceptable operation type of buckets and objects.
The methods include `GET`, `PUT`, `POST`, `DELETE` or `HEAD`.
-* `allowed_headers` (Optional) Specifies the allowed header of cross-origin requests.
+* `allowed_headers` (Optional, List) Specifies the allowed header of cross-origin requests.
Only CORS requests matching the allowed header are valid.
-* `expose_headers` (Optional) Specifies the exposed header in CORS responses, providing additional information for clients.
+* `expose_headers` (Optional, List) Specifies the exposed header in CORS responses, providing additional information
+ for clients.
-* `max_age_seconds` (Optional) Specifies the duration that your browser can cache CORS responses, expressed in seconds.
- The default value is 100.
+* `max_age_seconds` (Optional, Int) Specifies the duration that your browser can cache CORS responses, expressed in
+ seconds. The default value is 100.
-The `lifecycle_rule` object supports the following:
+
+The `lifecycle_rule` object supports:
-* `name` - (Required) Unique identifier for lifecycle rules. The Rule Name contains a maximum of 255 characters.
+* `name` - (Required, String) Unique identifier for lifecycle rules. The Rule Name contains a maximum of 255 characters.
-* `enabled` - (Required) Specifies lifecycle rule status.
+* `enabled` - (Required, Bool) Specifies lifecycle rule status.
-* `prefix` - (Optional) Object key prefix identifying one or more objects to which the rule applies.
+* `prefix` - (Optional, String) Object key prefix identifying one or more objects to which the rule applies.
If omitted, all objects in the bucket will be managed by the lifecycle rule.
The prefix cannot start or end with a slash (/), cannot have consecutive slashes (/),
and cannot contain the following special characters: \:*?"<>|.
-* `expiration` - (Optional) Specifies a period when objects that have been last updated are automatically deleted.
- The object structure is documented below.
+* `expiration` - (Optional, List) Specifies a period when objects that have been last updated are automatically deleted.
+ The [expiration](#obs_expiration) object structure is documented below.
-* `transition` - (Optional) Specifies a period when objects that have been last updated are automatically transitioned
- to `STANDARD_IA` or `GLACIER` storage class. The object structure is documented below.
+* `transition` - (Optional, List) Specifies a period when objects that have been last updated are automatically
+ transitioned to `STANDARD_IA` or `GLACIER` storage class.
+ The [transition](#obs_transition) object structure is documented below.
-* `noncurrent_version_expiration` - (Optional) Specifies a period when noncurrent object versions are automatically deleted.
- The object structure is documented below.
+* `noncurrent_version_expiration` - (Optional, List) Specifies a period when noncurrent object versions are automatically
+ deleted. The [noncurrent_version_expiration](#obs_noncurrent_version_expiration) object structure is documented below.
-* `noncurrent_version_transition` - (Optional) Specifies a period when noncurrent object versions are automatically
- transitioned to `STANDARD_IA` or `GLACIER` storage class. The object structure is documented below.
+* `noncurrent_version_transition` - (Optional, List) Specifies a period when noncurrent object versions are automatically
+ transitioned to `STANDARD_IA` or `GLACIER` storage class.
+ The [noncurrent_version_transition](#obs_noncurrent_version_transition) object structure is documented below.
-At least one of `expiration`, `transition`, `noncurrent_version_expiration`, `noncurrent_version_transition` must be specified.
+At least one of `expiration`, `transition`, `noncurrent_version_expiration`, `noncurrent_version_transition` must
+be specified.
-The `expiration` object supports the following
+
+The `expiration` object supports:
-* `days` (Required) Specifies the number of days when objects that have been last updated are automatically deleted.
+* `days` (Required, Int) Specifies the number of days when objects that have been last updated are automatically deleted.
The expiration time must be greater than the transition times.
-The `transition` object supports the following
+
+The `transition` object supports:
-* `days` (Required) Specifies the number of days when objects that have been last updated are automatically
- transitioned to the specified storage class.
-* `storage_class` - (Required) The class of storage used to store the object. Only "STANDARD_IA" and "GLACIER" are supported.
+* `days` (Required, Int) Specifies the number of days when objects that have been last updated are automatically
+ transitioned to the specified storage class.
+* `storage_class` - (Required, String) The class of storage used to store the object. Only "STANDARD_IA" and "GLACIER"
+ are supported.
-The `noncurrent_version_expiration` object supports the following
+
+The `noncurrent_version_expiration` object supports:
-* `days` (Required) Specifies the number of days when noncurrent object versions are automatically deleted.
+* `days` (Required, Int) Specifies the number of days when noncurrent object versions are automatically deleted.
-The `noncurrent_version_transition` object supports the following
+
+The `noncurrent_version_transition` object supports:
-* `days` (Required) Specifies the number of days when noncurrent object versions are automatically
- transitioned to the specified storage class.
-* `storage_class` - (Required) The class of storage used to store the object. Only "STANDARD_IA" and "GLACIER" are supported.
+* `days` (Required, Int) Specifies the number of days when noncurrent object versions are automatically
+ transitioned to the specified storage class.
+* `storage_class` - (Required, String) The class of storage used to store the object. Only "STANDARD_IA" and "GLACIER"
+ are supported.
-## Attributes Reference
+## Attribute Reference
The following attributes are exported:
@@ -281,8 +300,6 @@ The following attributes are exported:
* `bucket_domain_name` - The bucket domain name. Will be of format `bucketname.oss.region.prod-cloud-ocb.orange-business.com`.
-* `region` - The region this bucket resides in.
-
## Import
OBS bucket can be imported using the `bucket`, e.g.
@@ -291,10 +308,10 @@ OBS bucket can be imported using the `bucket`, e.g.
terraform import flexibleengine_obs_bucket.bucket bucket-name
```
-Note that the imported state may not be identical to your resource definition, due to some attrubutes
+Note that the imported state may not be identical to your resource definition, due to some attributes
missing from the API response. The missing attributes include `acl` and `force_destroy`.
It is generally recommended running `terraform plan` after importing an OBS bucket.
-Also you can ignore changes as below.
+Also, you can ignore changes as below.
```hcl
resource "flexibleengine_obs_bucket" "bucket" {
diff --git a/docs/resources/obs_bucket_acl.md b/docs/resources/obs_bucket_acl.md
index 5100c755d..5cc27f188 100644
--- a/docs/resources/obs_bucket_acl.md
+++ b/docs/resources/obs_bucket_acl.md
@@ -48,13 +48,10 @@ resource "flexibleengine_obs_bucket_acl" "test" {
The following arguments are supported:
-* `region` - (Optional, String, ForceNew) Specifies the region in which to create the resource.
- If omitted, the provider-level region will be used.
-
- Changing this parameter will create a new resource.
+* `region` - (Optional, String, ForceNew) Specifies the region in which to create the bucket acl resource.
+ If omitted, the provider-level region will be used. Changing this parameter will create a new resource.
* `bucket` - (Required, String, ForceNew) Specifies the name of the bucket to which to set the acl.
-
Changing this parameter will create a new resource.
* `owner_permission` - (Optional, List) Specifies the bucket owner permission. If omitted, the current obs bucket acl
@@ -80,14 +77,14 @@ The `permission_struct` block supports:
The `account_permission_struct` block supports:
+* `account_id` - (Required, String) Specifies the account id to authorize. The account id cannot be the bucket owner,
+ and must be unique.
+
* `access_to_bucket` - (Optional, List) Specifies the access to bucket. Valid values are **READ** and **WRITE**.
* `access_to_acl` - (Optional, List) Specifies the access to acl. Valid values are **READ_ACP** and **WRITE_ACP**.
-* `account_id` - (Required, String) Specifies the account id to authorize. The account id cannot be the bucket owner,
- and must be unique.
-
-## Attributes Reference
+## Attribute Reference
In addition to all arguments above, the following attributes are exported:
diff --git a/docs/resources/obs_bucket_notifications.md b/docs/resources/obs_bucket_notifications.md
index 62ff87783..f1bc0472d 100644
--- a/docs/resources/obs_bucket_notifications.md
+++ b/docs/resources/obs_bucket_notifications.md
@@ -45,8 +45,10 @@ The following arguments are supported:
* `bucket` - (Required, String, ForceNew) Specifies the name of the source bucket.
Changing this parameter will create a new resource.
-* `notifications` - (Optional, List) Specifies the list of OBS bucket Notification Configurations.
+* `notifications` - (Optional, List) Specifies the list of OBS bucket Notification Configurations. The
+ [notifications](#obs_notifications) object structure is documented below.
+
The `notifications` block supports:
* `topic_urn` (Required, String) Specifies the SMN topic that authorizes OBS to publish messages.
@@ -62,7 +64,7 @@ The `notifications` block supports:
* `suffix` (Optional, String) Specifies the suffix filtering rule. The value contains a maximum of 1024 characters.
-## Attributes Reference
+## Attribute Reference
The following attributes are exported:
diff --git a/docs/resources/obs_bucket_object.md b/docs/resources/obs_bucket_object.md
index 5a8b6403e..3f9a15510 100644
--- a/docs/resources/obs_bucket_object.md
+++ b/docs/resources/obs_bucket_object.md
@@ -51,38 +51,43 @@ resource "flexibleengine_obs_bucket_object" "examplebucket_object" {
The following arguments are supported:
-* `bucket` - (Required) The name of the bucket to put the file in.
+* `bucket` - (Required, String, ForceNew) The name of the bucket to put the file in. Changing this will create a
+ new resource.
-* `key` - (Required) The name of the object once it is in the bucket.
+* `key` - (Required, String, ForceNew) The name of the object once it is in the bucket. Changing this will create a
+ new resource.
-* `source` - (Optional) The path to the source file being uploaded to the bucket.
+* `source` - (Optional, String) The path to the source file being uploaded to the bucket.
-* `content` - (Optional) The literal content being uploaded to the bucket.
+* `content` - (Optional, String) The literal content being uploaded to the bucket.
-* `acl` - (Optional) The ACL policy to apply. Defaults to `private`.
+* `acl` - (Optional, String) The ACL policy to apply. Defaults to `private`.
-* `storage_class` - (Optioanl) Specifies the storage class of the object. Defaults to `STANDARD`.
+* `storage_class` - (Optional, String) Specifies the storage class of the object. Defaults to `STANDARD`.
-* `content_type` - (Optional) A standard MIME type describing the format of the object data, e.g. application/octet-stream.
- All Valid MIME Types are valid for this input.
+* `content_type` - (Optional, String) A standard MIME type describing the format of the object data,
+ e.g. application/octet-stream. All Valid MIME Types are valid for this input.
-* `encryption` - (Optional) Whether enable server-side encryption of the object in SSE-KMS mode.
+* `encryption` - (Optional, Bool) Whether enable server-side encryption of the object in SSE-KMS mode.
-* `sse_kms_key_id` - (Optional) The ID of the kms key. If omitted, the default master key will be used.
+* `kms_key_id` - (Optional, String) The ID of the kms key. If omitted, the default master key will be used.
-* `etag` - (Optional) Specifies the unique identifier of the object content. It can be used to trigger updates.
+* `etag` - (Optional, String) Specifies the unique identifier of the object content. It can be used to trigger updates.
The only meaningful value is `md5(file("path_to_file"))`.
Either `source` or `content` must be provided to specify the bucket content.
These two arguments are mutually-exclusive.
-## Attributes Reference
+## Attribute Reference
The following attributes are exported
* `id` - the `key` of the resource supplied above.
+
* `etag` - the ETag generated for the object (an MD5 sum of the object content).
When the object is encrypted on the server side, the ETag value is not the MD5 value of the object,
but the unique identifier calculated through the server-side encryption.
+
* `size` - the size of the object in bytes.
+
* `version_id` - A unique version ID value for the object, if bucket versioning is enabled.
diff --git a/docs/resources/obs_bucket_replication.md b/docs/resources/obs_bucket_replication.md
index 0f7437455..5ee0e0dd0 100644
--- a/docs/resources/obs_bucket_replication.md
+++ b/docs/resources/obs_bucket_replication.md
@@ -47,34 +47,45 @@ resource "flexibleengine_obs_bucket_replication" "replica" {
The following arguments are supported:
-* `bucket` - (Required) Specifies the name of the source bucket. Changing this parameter will create a new resource.
+* `bucket` - (Required, String, ForceNew) Specifies the name of the source bucket. Changing this parameter will create
+ a new resource.
-* `destination_bucket` - (Required) Specifies the name of the destination bucket.
+* `destination_bucket` - (Required, String) Specifies the name of the destination bucket.
-> The destination bucket cannot be in the region where the source bucket resides.
-* `agency` - (Required) Specifies the IAM agency applied to the cross-region replication function.
+* `agency` - (Required, String) Specifies the IAM agency applied to the cross-region replication function.
-> The IAM agency is a cloud service agency of OBS. The OBS project must have the **OBS FullAccess** permissions.
-* `rule` - (Optional) A configuration of object cross-region replication management. The object supports the following:
+* `rule` - (Optional, List) A configuration of object cross-region replication management.
+ The [rule](#obs_arg_rule) object structure is documented below.
- + `enabled` - (Optional) Specifies cross-region replication rule status. Defaults to `true`.
+
+The `rule` block supports:
- + `prefix` - (Optional) Specifies the object key prefix identifying one or more objects to which the rule applies and
- duplicated prefixes are not supported. If omitted, all objects in the bucket will be managed by the lifecycle rule.
- To copy a folder, end the prefix with a slash (/), for example, imgs/.
+* `enabled` - (Optional, Bool) Specifies cross-region replication rule status. Defaults to `true`.
- + `storage_class` - (Optional) Specifies the storage class for replicated objects. Valid values are "STANDARD",
- "WARM" (Infrequent Access) and "COLD" (Archive).
- If omitted, the storage class of object copies is the same as that of objects in the source bucket.
+* `prefix` - (Optional, String) Specifies the object key prefix identifying one or more objects to which the rule
+ applies and duplicated prefixes are not supported. If omitted, all objects in the bucket will be managed by the
+ lifecycle rule. To copy a folder, end the prefix with a slash (/), for example, imgs/.
-## Attributes Reference
+* `storage_class` - (Optional, String) Specifies the storage class for replicated objects. Valid values are "STANDARD",
+ "WARM" (Infrequent Access) and "COLD" (Archive).
+ If omitted, the storage class of object copies is the same as that of objects in the source bucket.
+
+## Attribute Reference
The following attributes are exported:
* `id` - The name of the bucket.
-* `rule/id` - The ID of a rule in UUID format.
+
+* `rule` - See Argument Reference above. The [rule](#obs_attr_rule) object structure is documented below.
+
+
+The `rule` block supports:
+
+* `id` - The ID of a rule in UUID format.
## Import
diff --git a/docs/resources/s3_bucket.md b/docs/resources/s3_bucket.md
index 027919725..df53fb15b 100644
--- a/docs/resources/s3_bucket.md
+++ b/docs/resources/s3_bucket.md
@@ -142,93 +142,139 @@ resource "flexibleengine_s3_bucket" "versioning_bucket" {
The following arguments are supported:
-* `bucket` - (Optional, Forces new resource) The name of the bucket. If omitted, Terraform will assign a random, unique name.
-* `bucket_prefix` - (Optional, Forces new resource) Creates a unique bucket name beginning with the specified prefix.
- Conflicts with `bucket`.
-* `acl` - (Optional) The [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) to apply.
- Defaults to "private".
-* `policy` - (Optional) A valid [bucket policy](https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html)
- JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the policy
- as constantly changing in a `terraform plan`. In this case, please make sure you use the verbose/specific version of
- the policy.
-* `force_destroy` - (Optional, Default:false ) A boolean that indicates all objects should be deleted from the bucket
- so that the bucket can be destroyed without error. These objects are *not* recoverable.
-* `website` - (Optional) A website object (documented below).
-* `cors_rule` - (Optional) A rule of [Cross-Origin Resource Sharing](https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html)
- (documented below).
-* `versioning` - (Optional) A state of [versioning](https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html)
- (documented below)
-* `logging` - (Optional) A settings of [bucket logging](https://docs.aws.amazon.com/AmazonS3/latest/UG/ManagingBucketLogging.html)
- (documented below).
-* `lifecycle_rule` - (Optional) A configuration of [object lifecycle management](http://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html)
- (documented below).
-* `region` - (Optional) If specified, the region this bucket should reside in. Otherwise, the region used by the callee.
-
-The `website` object supports the following:
-
-* `index_document` - (Required, unless using `redirect_all_requests_to`) Amazon S3 returns this index document when
- requests are made to the root domain or any of the subfolders.
-* `error_document` - (Optional) An absolute path to the document to return in case of a 4XX error.
-* `redirect_all_requests_to` - (Optional) A hostname to redirect all website requests for this bucket to.
+* `region` - (Optional, String, ForceNew) Specifies the region in which to create the s3 bucket resource.
+ If omitted, the provider-level region will be used. Changing this will create a new s3 bucket resource.
+
+* `bucket` - (Optional, String, ForceNew) The name of the bucket. If omitted, Terraform will assign a random,
+ unique name. Changing this will create a new resource.
+
+* `bucket_prefix` - (Optional, String, ForceNew) Creates a unique bucket name beginning with the specified prefix.
+ Conflicts with `bucket`. Changing this will create a new resource.
+
+* `acl` - (Optional, String) The [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl)
+ to apply. Defaults to **private**.
+
+* `policy` - (Optional, String) A valid [bucket policy](https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html)
+ JSON document. Note that if the policy document is not specific enough (but still valid), Terraform may view the
+ policy as constantly changing in a `terraform plan`. In this case, please make sure you use the verbose/specific
+ version of the policy.
+
+* `force_destroy` - (Optional, Bool) A boolean that indicates all objects should be deleted from the bucket
+ so that the bucket can be destroyed without error. These objects are *not* recoverable. Default to **false**.
+
+* `website` - (Optional, List) A website object.
+ The [website](#obs_website) object structure is documented below.
+
+* `cors_rule` - (Optional, List) A rule of [Cross-Origin Resource Sharing](https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html).
+ The [cors_rule](#obs_cors_rule) object structure is documented below.
+
+* `versioning` - (Optional, List) A state of [versioning](https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html).
+ The [versioning](#obs_versioning) object structure is documented below.
+
+* `logging` - (Optional, List) A settings of [bucket logging](https://docs.aws.amazon.com/AmazonS3/latest/UG/ManagingBucketLogging.html).
+ The [logging](#obs_logging) object structure is documented below.
+
+* `lifecycle_rule` - (Optional, List) A configuration of [object lifecycle management](http://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html)
+ The [lifecycle_rule](#obs_lifecycle_rule) object structure is documented below.
+
+
+The `website` object supports:
+
+* `index_document` - (Required, String) Amazon S3 returns this index document when requests are made to the root domain
+ or any of the subfolders. It is **Optional** if using `redirect_all_requests_to`.
+
+* `error_document` - (Optional, String) An absolute path to the document to return in case of a 4XX error.
+
+* `redirect_all_requests_to` - (Optional, String) A hostname to redirect all website requests for this bucket to.
Hostname can optionally be prefixed with a protocol (`http://` or `https://`) to use when redirecting requests.
The default is the protocol that is used in the original request.
-* `routing_rules` - (Optional) A json array containing [routing rules](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules.html)
-describing redirect behavior and when redirects are applied.
-The `cors_rule` object supports the following:
+* `routing_rules` - (Optional, String) A json array containing [routing rules](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-websiteconfiguration-routingrules.html)
+ describing redirect behavior and when redirects are applied.
+
+
+The `cors_rule` object supports:
+
+* `allowed_headers` (Optional, List) Specifies which headers are allowed.
+
+* `allowed_methods` (Required, List) Specifies which methods are allowed. Can be `GET`, `PUT`, `POST`, `DELETE`
+ or `HEAD`.
-* `allowed_headers` (Optional) Specifies which headers are allowed.
-* `allowed_methods` (Required) Specifies which methods are allowed. Can be `GET`, `PUT`, `POST`, `DELETE` or `HEAD`.
-* `allowed_origins` (Required) Specifies which origins are allowed.
-* `expose_headers` (Optional) Specifies expose header in the response.
-* `max_age_seconds` (Optional) Specifies time in seconds that browser can cache the response for a preflight request.
+* `allowed_origins` (Required, List) Specifies which origins are allowed.
-The `versioning` object supports the following:
+* `expose_headers` (Optional, List) Specifies expose header in the response.
-* `enabled` - (Optional) Enable versioning. Once you version-enable a bucket, it can never return to an unversioned state.
- You can, however, suspend versioning on that bucket.
-* `mfa_delete` - (Optional) Enable MFA delete for either change the versioning state of your bucket or permanently delete
- an object version. Default is `false`.
+* `max_age_seconds` (Optional, Int) Specifies time in seconds that browser can cache the response for a preflight
+ request.
-The `logging` object supports the following:
+
+The `versioning` object supports:
-* `target_bucket` - (Required) The name of the bucket that will receive the log objects.
-* `target_prefix` - (Optional) To specify a key prefix for log objects.
+* `enabled` - (Optional, Bool) Enable versioning. Once you version-enable a bucket, it can never return to an
+ unversioned state. You can, however, suspend versioning on that bucket.
-The `lifecycle_rule` object supports the following:
+* `mfa_delete` - (Optional, Bool) Enable MFA delete for either change the versioning state of your bucket or
+ permanently delete an object version. Default is `false`.
-* `id` - (Optional) Unique identifier for the rule.
-* `prefix` - (Optional) Object key prefix identifying one or more objects to which the rule applies.
-* `enabled` - (Required) Specifies lifecycle rule status.
-* `abort_incomplete_multipart_upload_days` (Optional) Specifies the number of days after initiating a multipart upload
- when the multipart upload must be completed.
-* `expiration` - (Optional) Specifies a period in the object's expire (documented below).
-* `noncurrent_version_expiration` - (Optional) Specifies when noncurrent object versions expire (documented below).
+
+The `logging` object supports:
+
+* `target_bucket` - (Required, String) The name of the bucket that will receive the log objects.
+
+* `target_prefix` - (Optional, String) To specify a key prefix for log objects.
+
+
+The `lifecycle_rule` object supports:
+
+* `id` - (Optional, String) Unique identifier for the rule.
+
+* `prefix` - (Optional, String) Object key prefix identifying one or more objects to which the rule applies.
+
+* `enabled` - (Required, Bool) Specifies lifecycle rule status.
+
+* `abort_incomplete_multipart_upload_days` (Optional, Int) Specifies the number of days after initiating a multipart
+ upload when the multipart upload must be completed.
+
+* `expiration` - (Optional, List) Specifies a period in the object's expire.
+ The [expiration](#obs_expiration) object structure is documented below.
+
+* `noncurrent_version_expiration` - (Optional, List) Specifies when noncurrent object versions expire.
+ The [noncurrent_version_expiration](#obs_noncurrent_version_expiration) object structure is documented below.
At least one of `expiration`, `noncurrent_version_expiration` must be specified.
-The `expiration` object supports the following
+
+The `expiration` object supports:
+
+* `date` (Optional, String) Specifies the date after which you want the corresponding action to take effect.
-* `date` (Optional) Specifies the date after which you want the corresponding action to take effect.
-* `days` (Optional) Specifies the number of days after object creation when the specific rule action takes effect.
-* `expired_object_delete_marker` (Optional) On a versioned bucket (versioning-enabled or versioning-suspended bucket),
- you can add this element in the lifecycle configuration to direct Amazon S3 to delete expired object delete markers.
+* `days` (Optional, Int) Specifies the number of days after object creation when the specific rule action takes effect.
-The `noncurrent_version_expiration` object supports the following
+* `expired_object_delete_marker` (Optional, Bool) On a versioned bucket (versioning-enabled or versioning-suspended
+ bucket), you can add this element in the lifecycle configuration to direct Amazon S3 to delete expired object delete
+ markers.
-* `days` (Required) Specifies the number of days an object is noncurrent object versions expire.
+
+The `noncurrent_version_expiration` object supports:
-## Attributes Reference
+* `days` (Required, Int) Specifies the number of days an object is noncurrent object versions expire.
+
+## Attribute Reference
The following attributes are exported:
* `id` - The name of the bucket.
+
* `arn` - The ARN of the bucket. Will be of format `arn:aws:s3:::bucketname`.
+
* `bucket_domain_name` - The bucket domain name. Will be of format `bucketname.s3.amazonaws.com`.
+
* `hosted_zone_id` - The [Route 53 Hosted Zone ID](https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_website_region_endpoints)
for this bucket's region.
-* `region` - The region this bucket resides in.
-* `website_endpoint` - The website endpoint, if the bucket is configured with a website. If not, this will be an empty string.
+
+* `website_endpoint` - The website endpoint, if the bucket is configured with a website. If not, this will be an
+ empty string.
+
* `website_domain` - The domain of the website endpoint, if the bucket is configured with a website.
If not, this will be an empty string. This is used to create Route 53 alias records.
diff --git a/docs/resources/s3_bucket_object.md b/docs/resources/s3_bucket_object.md
index ab5722452..00a6eacd6 100644
--- a/docs/resources/s3_bucket_object.md
+++ b/docs/resources/s3_bucket_object.md
@@ -55,45 +55,51 @@ resource "flexibleengine_s3_bucket_object" "examplebucket_object" {
The following arguments are supported:
-* `bucket` - (Required) The name of the bucket to put the file in.
-* `key` - (Required) The name of the object once it is in the bucket.
-* `source` - (Required) The path to the source file being uploaded to the bucket.
-* `content` - (Required unless `source` given) The literal content being uploaded to the bucket.
+* `bucket` - (Required, String, ForceNew) The name of the bucket to put the file in. Changing this will create a
+ new resource.
-* `acl` - (Optional) The [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) to apply.
+* `key` - (Required, String, ForceNew) The name of the object once it is in the bucket. Changing this will create a
+ new resource.
+
+* `source` - (Required, String) The path to the source file being uploaded to the bucket.
+
+* `content` - (Required, String) The literal content being uploaded to the bucket. It is **Optional** if `source` given.
+
+* `acl` - (Optional, String) The
+ [canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl) to apply.
Defaults to "private".
-* `cache_control` - (Optional) Specifies caching behavior along the request/reply chain Read [w3c cache_control](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9)
- for further details.
+* `cache_control` - (Optional, String) Specifies caching behavior along the request/reply chain Read
+ [w3c cache_control](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9) for further details.
-* `content_disposition` - (Optional) Specifies presentational information for the object. Read [wc3 content_disposition](http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1)
- for further information.
+* `content_disposition` - (Optional, String) Specifies presentational information for the object. Read
+ [wc3 content_disposition](http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1) for further information.
-* `content_encoding` - (Optional) Specifies what content encodings have been applied to the object and thus what decoding
- mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.
+* `content_encoding` - (Optional, String) Specifies what content encodings have been applied to the object and thus
+ what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.
Read [w3c content encoding](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11) for further information.
-* `content_language` - (Optional) The language the content is in e.g. en-US or en-GB.
+* `content_language` - (Optional, String) The language the content is in e.g. en-US or en-GB.
-* `content_type` - (Optional) A standard MIME type describing the format of the object data, e.g. application/octet-stream.
- All Valid MIME Types are valid for this input.
+* `content_type` - (Optional, String) A standard MIME type describing the format of the object data,
+ e.g. application/octet-stream. All Valid MIME Types are valid for this input.
-* `website_redirect` - (Optional) Specifies a target URL for [website redirect](http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html).
+* `website_redirect` - (Optional, String) Specifies a target URL for [website redirect](http://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html).
-* `etag` - (Optional) Used to trigger updates. The only meaningful value is `${md5(file("path/to/file"))}`.
+* `etag` - (Optional, String) Used to trigger updates. The only meaningful value is `${md5(file("path/to/file"))}`.
This attribute is not compatible with `kms_key_id`.
-* `server_side_encryption` - (Optional) Specifies server-side encryption of the object in S3.
+* `server_side_encryption` - (Optional, String) Specifies server-side encryption of the object in S3.
Valid values are "`AES256`" and "`aws:kms`".
Either `source` or `content` must be provided to specify the bucket content.
These two arguments are mutually-exclusive.
-## Attributes Reference
+## Attribute Reference
The following attributes are exported
-* `id` - the `key` of the resource supplied above
-* `etag` - the ETag generated for the object (an MD5 sum of the object content).
+* `id` - the `key` of the resource supplied above.
+
* `version_id` - A unique version ID value for the object, if bucket versioning
is enabled.
diff --git a/docs/resources/s3_bucket_policy.md b/docs/resources/s3_bucket_policy.md
index c2f96e5e4..127f038d1 100644
--- a/docs/resources/s3_bucket_policy.md
+++ b/docs/resources/s3_bucket_policy.md
@@ -44,5 +44,10 @@ POLICY
The following arguments are supported:
-* `bucket` - (Required) The name of the bucket to which to apply the policy.
-* `policy` - (Required) The text of the policy.
+* `bucket` - (Required, String, ForceNew) The name of the bucket to which to apply the policy.
+
+* `policy` - (Required, String) The text of the policy.
+
+## Attribute Reference
+
+All the arguments above can also be exported attributes.
diff --git a/flexibleengine/resource_flexibleengine_s3_bucket.go b/flexibleengine/resource_flexibleengine_s3_bucket.go
index 925a3ffb4..bb85441c4 100644
--- a/flexibleengine/resource_flexibleengine_s3_bucket.go
+++ b/flexibleengine/resource_flexibleengine_s3_bucket.go
@@ -29,6 +29,12 @@ func resourceS3Bucket() *schema.Resource {
},
Schema: map[string]*schema.Schema{
+ "region": {
+ Type: schema.TypeString,
+ Optional: true,
+ ForceNew: true,
+ Computed: true,
+ },
"bucket": {
Type: schema.TypeString,
Optional: true,
@@ -41,18 +47,6 @@ func resourceS3Bucket() *schema.Resource {
Optional: true,
ForceNew: true,
},
-
- "bucket_domain_name": {
- Type: schema.TypeString,
- Computed: true,
- },
-
- "arn": {
- Type: schema.TypeString,
- Optional: true,
- Computed: true,
- },
-
"acl": {
Type: schema.TypeString,
Default: "private",
@@ -137,29 +131,6 @@ func resourceS3Bucket() *schema.Resource {
},
},
},
-
- "hosted_zone_id": {
- Type: schema.TypeString,
- Optional: true,
- Computed: true,
- },
-
- "region": {
- Type: schema.TypeString,
- Optional: true,
- Computed: true,
- },
- "website_endpoint": {
- Type: schema.TypeString,
- Optional: true,
- Computed: true,
- },
- "website_domain": {
- Type: schema.TypeString,
- Optional: true,
- Computed: true,
- },
-
"versioning": {
Type: schema.TypeList,
Optional: true,
@@ -274,6 +245,27 @@ func resourceS3Bucket() *schema.Resource {
Optional: true,
Default: false,
},
+
+ "bucket_domain_name": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "arn": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "hosted_zone_id": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "website_endpoint": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "website_domain": {
+ Type: schema.TypeString,
+ Computed: true,
+ },
},
}
}