Skip to content

Commit

Permalink
Improve code organization and error handling
Browse files Browse the repository at this point in the history
- Add proper error types and handling with severity levels
- Improve SSL/TLS configuration and security
- Add helper functions for safer field access
- Enhance documentation and code organization
- Add proper constants and remove magic values
- Improve type definitions and validation
  • Loading branch information
felladrin committed Dec 22, 2024
1 parent d846e5a commit 9a7706d
Show file tree
Hide file tree
Showing 5 changed files with 252 additions and 229 deletions.
30 changes: 15 additions & 15 deletions docs/resources/s3_bucket_replication.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
page_title: "minio_s3_bucket_replication Resource - terraform-provider-minio"
subcategory: ""
description: |-
---

# minio_s3_bucket_replication (Resource)



## Example Usage

```terraform
Expand Down Expand Up @@ -100,7 +97,7 @@ resource "minio_iam_user" "replication_in_b" {
provider = minio.deployment_b
name = "my-user"
force_destroy = true
}
}
resource "minio_iam_user_policy_attachment" "replication_in_b" {
provider = minio.deployment_b
Expand Down Expand Up @@ -130,7 +127,7 @@ resource "minio_s3_bucket_replication" "replication_in_b" {
bucket = minio_s3_bucket.my_bucket_in_b.bucket
secure = false
host = var.minio_server_b
bandwidth_limt = "100M"
bandwidth_limit = "100M"
access_key = minio_iam_service_account.replication_in_b.access_key
secret_key = minio_iam_service_account.replication_in_b.secret_key
}
Expand All @@ -151,7 +148,7 @@ resource "minio_iam_policy" "replication_in_a" {
resource "minio_iam_user" "replication_in_a" {
name = "my-user"
force_destroy = true
}
}
resource "minio_iam_user_policy_attachment" "replication_in_a" {
user_name = minio_iam_user.replication_in_a.name
Expand Down Expand Up @@ -180,7 +177,7 @@ resource "minio_s3_bucket_replication" "replication_in_a" {
bucket = minio_s3_bucket.my_bucket_in_a.bucket
host = var.minio_server_a
secure = false
bandwidth_limt = "100M"
bandwidth_limit = "100M"
access_key = minio_iam_service_account.replication_in_a.access_key
secret_key = minio_iam_service_account.replication_in_a.secret_key
}
Expand All @@ -194,6 +191,7 @@ resource "minio_s3_bucket_replication" "replication_in_a" {
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required
Expand All @@ -209,6 +207,7 @@ resource "minio_s3_bucket_replication" "replication_in_a" {
- `id` (String) The ID of this resource.

<a id="nestedblock--rule"></a>

### Nested Schema for `rule`

Required:
Expand All @@ -221,17 +220,18 @@ Optional:
- `delete_replication` (Boolean) Whether or not to propagate deletion
- `enabled` (Boolean) Whether or not this rule is enabled
- `existing_object_replication` (Boolean) Whether or not to synchronise object created prior the replication configuration
- `metadata_sync` (Boolean) Whether or not to synchonise buckets and objects metadata (such as locks). This must be enabled to achieve a two-way replication
- `prefix` (String) Bucket prefix object must be in to be syncronised
- `metadata_sync` (Boolean) Whether or not to synchronise buckets and objects metadata (such as locks). This must be enabled to achieve a two-way replication
- `prefix` (String) Bucket prefix object must be in to be synchronised
- `priority` (Number) Rule priority. If omitted, the inverted index will be used as priority. This means that the first rule definition will have the higher priority
- `tags` (Map of String) Tags which objects must have to be syncronised
- `tags` (Map of String) Tags which objects must have to be synchronised

Read-Only:

- `arn` (String) Rule ARN genrated by MinIO
- `arn` (String) Rule ARN generated by MinIO
- `id` (String) Rule ID generated by MinIO

<a id="nestedblock--rule--target"></a>

### Nested Schema for `rule.target`

Required:
Expand All @@ -242,13 +242,13 @@ Required:

Optional:

- `bandwidth_limt` (String) Maximum bandwidth in byte per second that MinIO can used when syncronysing this target. Minimum is 100MB
- `bandwidth_limit` (String) Maximum bandwidth in byte per second that MinIO can used when synchronising this target. Minimum is 100MB
- `disable_proxy` (Boolean) Disable proxy for this target
- `health_check_period` (String) Period where the health of this target will be checked. This must be a valid duration, such as `5s` or `2m`
- `path` (String) Path of the Minio endpoint. This is usefull if MinIO API isn't served on at the root, e.g for `example.com/minio/`, the path would be `/minio/`
- `path_style` (String) Whether to use path-style or virtual-hosted-syle request to this target (https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#path-style-access). `auto` allows MinIO to chose automatically the appropriate option (Recommened)`
- `path` (String) Path of the Minio endpoint. This is useful if MinIO API isn't served on at the root, e.g for `example.com/minio/`, the path would be `/minio/`
- `path_style` (String) Whether to use path-style or virtual-hosted-style request to this target (https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#path-style-access). `auto` allows MinIO to chose automatically the appropriate option (Recommend)`
- `region` (String) Region of the target MinIO. This will be used to generate the target ARN
- `secret_key` (String, Sensitive) Secret key for the replication service account in the target MinIO. This is optional so it can be imported but prevent secret update
- `secure` (Boolean) Whether to use HTTPS with this target (Recommended). Note that disabling HTTPS will yield Terraform warning for security reason`
- `storage_class` (String) The storage class to use for the object on this target
- `syncronous` (Boolean) Use synchronous replication.
- `synchronous` (Boolean) Use synchronous replication.
4 changes: 2 additions & 2 deletions examples/resources/minio_s3_bucket_replication/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ resource "minio_s3_bucket_replication" "replication_in_b" {
bucket = minio_s3_bucket.my_bucket_in_b.bucket
secure = false
host = var.minio_server_b
bandwidth_limt = "100M"
bandwidth_limit = "100M"
access_key = minio_iam_service_account.replication_in_b.access_key
secret_key = minio_iam_service_account.replication_in_b.secret_key
}
Expand Down Expand Up @@ -165,7 +165,7 @@ resource "minio_s3_bucket_replication" "replication_in_a" {
bucket = minio_s3_bucket.my_bucket_in_a.bucket
host = var.minio_server_a
secure = false
bandwidth_limt = "100M"
bandwidth_limit = "100M"
access_key = minio_iam_service_account.replication_in_a.access_key
secret_key = minio_iam_service_account.replication_in_a.secret_key
}
Expand Down
Loading

0 comments on commit 9a7706d

Please sign in to comment.