Skip to content

Commit

Permalink
resolved the conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jul 19, 2022
1 parent d721621 commit 759fd7b
Show file tree
Hide file tree
Showing 14 changed files with 1,192 additions and 18 deletions.
32 changes: 16 additions & 16 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.sum|^.secrets.baseline$",
"lines": null
},
"generated_at": "2022-07-13T10:12:14Z",
"generated_at": "2022-07-19T10:25:33Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -307,16 +307,6 @@
"verified_result": null
}
],
"examples/ibm-cd-toolchain/main.tf": [
{
"hashed_secret": "638bac731294171648258260ff2af4a09bc02aa2",
"is_secret": false,
"is_verified": false,
"line_number": 12,
"type": "Secret Keyword",
"verified_result": null
}
],
"examples/ibm-cis/README.md": [
{
"hashed_secret": "1f1c2ad5fded044aae42281c1fd4253dd624bf65",
Expand Down Expand Up @@ -660,7 +650,7 @@
"hashed_secret": "813274ccae5b6b509379ab56982d862f7b5969b6",
"is_secret": false,
"is_verified": false,
"line_number": 744,
"line_number": 747,
"type": "Base64 High Entropy String",
"verified_result": null
}
Expand Down Expand Up @@ -720,7 +710,7 @@
"hashed_secret": "da8cae6284528565678de15e03d461e23fe22538",
"is_secret": false,
"is_verified": false,
"line_number": 1514,
"line_number": 1551,
"type": "Secret Keyword",
"verified_result": null
}
Expand All @@ -730,15 +720,15 @@
"hashed_secret": "c8b6f5ef11b9223ac35a5663975a466ebe7ebba9",
"is_secret": false,
"is_verified": false,
"line_number": 1384,
"line_number": 1399,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "8abf4899c01104241510ba87685ad4de76b0c437",
"is_secret": false,
"is_verified": false,
"line_number": 1390,
"line_number": 1405,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -1608,7 +1598,7 @@
"hashed_secret": "884a58e4c2c5d195d3876787bdc63af6c5af2924",
"is_secret": false,
"is_verified": false,
"line_number": 375,
"line_number": 413,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -1643,6 +1633,16 @@
"verified_result": null
}
],
"ibm/service/cos/resource_ibm_cos_replication_configuration.go": [
{
"hashed_secret": "b02fa7fd7ca08b5dc86c2548e40f8a21171ef977",
"is_secret": false,
"is_verified": false,
"line_number": 368,
"type": "Secret Keyword",
"verified_result": null
}
],
"ibm/service/database/data_source_ibm_database_connection.go": [
{
"hashed_secret": "3046d9f6cfaaeea6eed9bb7a4ab010fe49b0cfd4",
Expand Down
129 changes: 129 additions & 0 deletions examples/ibm-cos-bucket/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,127 @@ resource "ibm_cos_bucket" "cos_bucket" {
}
```

## COS REPLICATION

Replication allows users to define rules for automatic, asynchronous copying of objects from a source bucket to a destination bucket in the same or different location.

**Note:**

you must have `writer` or `manager` platform roles on source bucket and sufficient platform roles to create new [IAM policies](https://cloud.ibm.com/docs/account?topic=account-iamoverview#iamoverview) that allow the source bucket to write to the destination bucket.
Add depends_on on ibm_iam_authorization_policy.policy in template to make sure replication only enabled once iam authorization policy set.

## Example usage
The following example creates an instance of IBM Cloud Object Storage. Then, multiple buckets are created and configured replication policy.

```terraform
data "ibm_resource_group" "cos_group" {
name = "cos-resource-group"
}
resource "ibm_resource_instance" "cos_instance_source" {
name = "cos-instance-src"
resource_group_id = data.ibm_resource_group.cos_group.id
service = "cloud-object-storage"
plan = "standard"
location = "global"
}
resource "ibm_resource_instance" "cos_instance_destination" {
name = "cos-instance-dest"
resource_group_id = data.ibm_resource_group.cos_group.id
service = "cloud-object-storage"
plan = "standard"
location = "global"
}
resource "ibm_cos_bucket" "cos_bucket_source" {
bucket_name = "a-bucket-source"
resource_instance_id = ibm_resource_instance.cos_instance_source.id
region_location = "us-south"
storage_class = "standard"
object_versioning {
enable = true
}
}
resource "ibm_cos_bucket" "cos_bucket_destination" {
bucket_name = "a-bucket-destination"
resource_instance_id = ibm_resource_instance.cos_instance_destination.id
region_location = "us-south"
storage_class = "standard"
object_versioning {
enable = true
}
}
### Configure IAM authorization policy
resource "ibm_iam_authorization_policy" "policy" {
roles = [
"Writer",
]
subject_attributes {
name = "accountId"
value = "an-account-id"
}
subject_attributes {
name = "serviceName"
value = "cloud-object-storage"
}
subject_attributes {
name = "serviceInstance"
value = ibm_resource_instance.cos_instance_source.guid
}
subject_attributes {
name = "resource"
value = ibm_cos_bucket.cos_bucket_source.bucket_name
}
subject_attributes {
name = "resourceType"
value = "bucket"
}
resource_attributes {
name = "accountId"
value = "an-account-id"
}
resource_attributes {
name = "serviceName"
value = "cloud-object-storage"
}
resource_attributes {
name = "serviceInstance"
value = ibm_resource_instance.cos_instance_destination.guid
}
resource_attributes {
name = "resource"
value = ibm_cos_bucket.cos_bucket_destination.bucket_name
}
resource_attributes {
name = "resourceType"
value = "bucket"
}
}
### Configure replication policy
resource "ibm_cos_bucket_replication_rule" "cos_bucket_repl" {
depends_on = [
ibm_iam_authorization_policy.policy
]
bucket_crn = ibm_cos_bucket.cos_bucket_source.crn
bucket_location = ibm_cos_bucket.cos_bucket_source.region_location
replication_rule {
rule_id = "a-rule-id"
enable = "true"
prefix = "a-prefix"
priority = "a-priority-associated-with-the-rule"
deletemarker_replication_status = "Enabled/Suspened"
destination_bucket_crn = ibm_cos_bucket.cos_bucket_destination.crn
}
}
```

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

Expand Down Expand Up @@ -277,4 +398,12 @@ resource "ibm_cos_bucket" "cos_bucket" {
| permanent | Specifies a permanent retention status either enable or disable for a bucket. | `bool` | no
| enable | Specifies Versioning status either **enable or suspended** for an objects in the bucket. | `bool` | no
| hard_quota | sets a maximum amount of storage (in bytes) available for a bucket. | `int` | no
| bucket\_crn | The CRN of the source COS bucket. | `string` | yes |
| bucket\_location | The location of the source COS bucket. | `string` | yes |
| destination_bucket_crn | The CRN of your destination bucket that you want to replicate to. | `String` | yes
| deletemarker_replication_status | Specifies whether Object storage replicates delete markers. Valid values are Enabled or Disabled. | `String` | no
| status | Specifies whether the rule is enabled. Valid values are Enabled or Disabled. | `String` | yes
| rule_id | The rule id. | `String` | no
| priority | A priority is associated with each rule. The rule will be applied in a higher priority if there are multiple rules configured. The higher the number, the higher the priority | `String` | no
| prefix | An object key name prefix that identifies the subset of objects to which the rule applies. | `String` | no
{: caption="inputs"}
Loading

0 comments on commit 759fd7b

Please sign in to comment.