Skip to content

Commit c2f000b

Browse files
committed
deprecating delete_object_in_destination_bucket
1 parent bb3c082 commit c2f000b

File tree

7 files changed

+16
-35
lines changed

7 files changed

+16
-35
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
- Support for logging in API Gateway Service
1010
- Support for Service Connector Hub
1111

12+
### Deprecated
13+
- The `delete_object_in_destination_bucket` attribute in `oci_objectstorage_replication_policy` is now deprecated
14+
1215
## 3.91.0 (September 02, 2020)
1316

1417
### Added

examples/object_storage/bucket_with_replication/main.tf

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ output objects {
114114
}
115115

116116
resource "oci_objectstorage_replication_policy" "bucket_rp" {
117-
namespace = "${data.oci_objectstorage_namespace.ns.namespace}"
118-
bucket = "${oci_objectstorage_bucket.bucket1.name}"
119-
name = "rpOnBucket"
120-
destination_region_name = "${var.region}"
121-
delete_object_in_destination_bucket = "ACCEPT"
122-
destination_bucket_name = "${oci_objectstorage_bucket.bucket2.name}"
117+
namespace = "${data.oci_objectstorage_namespace.ns.namespace}"
118+
bucket = "${oci_objectstorage_bucket.bucket1.name}"
119+
name = "rpOnBucket"
120+
destination_region_name = "${var.region}"
121+
destination_bucket_name = "${oci_objectstorage_bucket.bucket2.name}"
123122
}

oci/crud_helpers.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ const (
4949
SUCCEEDED = "SUCCEEDED"
5050
)
5151

52-
type deleteObjectInDestinationBucketStateEnum string
53-
54-
// Set of constants representing the allowable values for ListCustomProtectionRulesLifecycleStateEnum
55-
const (
56-
deleteObjectInDestinationBucketStateEnumAccept deleteObjectInDestinationBucketStateEnum = "ACCEPT"
57-
deleteObjectInDestinationBucketStateEnumDecline deleteObjectInDestinationBucketStateEnum = "DECLINE"
58-
)
59-
6052
const (
6153
OpcNextPageHeader = "Opc-Next-Page"
6254
)

oci/export_resource_helpers.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,6 @@ func init() {
362362
exportObjectStorageNamespaceHints.processDiscoveredResourcesFn = processObjectStorageNamespace
363363
exportObjectStorageNamespaceHints.getHCLStringOverrideFn = getObjectStorageNamespaceHCLDatasource
364364
exportObjectStorageNamespaceHints.alwaysExportable = true
365-
exportObjectStorageReplicationPolicyHints.defaultValuesForMissingAttributes = map[string]interface{}{
366-
"delete_object_in_destination_bucket": deleteObjectInDestinationBucketStateEnumDecline,
367-
}
368365
exportOnsNotificationTopicHints.getIdFn = getOnsNotificationTopicId
369366

370367
exportObjectStorageBucketHints.getIdFn = getObjectStorageBucketId

oci/objectstorage_replication_policy_resource.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ func ObjectStorageReplicationPolicyResource() *schema.Resource {
5959
},
6060
"delete_object_in_destination_bucket": {
6161
Type: schema.TypeString,
62-
Required: true,
62+
Optional: true,
6363
ForceNew: true,
6464
ValidateFunc: validation.StringInSlice([]string{
6565
"ACCEPT",
66-
"DECLINE",
6766
}, true),
67+
Deprecated: FieldDeprecated("delete_object_in_destination_bucket"),
6868
},
6969

7070
// Optional
@@ -127,13 +127,6 @@ func (s *ObjectStorageReplicationPolicyResourceCrud) ID() string {
127127
}
128128

129129
func (s *ObjectStorageReplicationPolicyResourceCrud) Create() error {
130-
if state, ok := s.D.GetOkExists("delete_object_in_destination_bucket"); ok {
131-
if deleteObjectInDestinationBucketStateEnum(state.(string)) != deleteObjectInDestinationBucketStateEnumAccept {
132-
return fmt.Errorf(`If you have 'delete_object_in_destination_bucket' set to 'DECLINE',
133-
Objects in the destination bucket will not be deleted and therefore you can not create the replication policy. If you
134-
are sure to deleted all the objects in the destination buckets, change 'delete_object_in_destination_bucket' set to 'ACCEPT'`)
135-
}
136-
}
137130
request := oci_object_storage.CreateReplicationPolicyRequest{}
138131

139132
if bucket, ok := s.D.GetOkExists("bucket"); ok {

oci/objectstorage_replication_policy_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ var (
3636
}
3737

3838
replicationPolicyRepresentation = map[string]interface{}{
39-
"bucket": Representation{repType: Required, create: `${oci_objectstorage_bucket.test_bucket.name}`},
40-
"destination_bucket_name": Representation{repType: Required, create: `${oci_objectstorage_bucket.test_bucket_replication.name}`},
41-
"destination_region_name": Representation{repType: Required, create: `${var.region}`},
42-
"name": Representation{repType: Required, create: `mypolicy`},
43-
"delete_object_in_destination_bucket": Representation{repType: Required, create: `ACCEPT`},
44-
"namespace": Representation{repType: Required, create: `${oci_objectstorage_bucket.test_bucket.namespace}`},
39+
"bucket": Representation{repType: Required, create: `${oci_objectstorage_bucket.test_bucket.name}`},
40+
"destination_bucket_name": Representation{repType: Required, create: `${oci_objectstorage_bucket.test_bucket_replication.name}`},
41+
"destination_region_name": Representation{repType: Required, create: `${var.region}`},
42+
"name": Representation{repType: Required, create: `mypolicy`},
43+
"namespace": Representation{repType: Required, create: `${oci_objectstorage_bucket.test_bucket.namespace}`},
4544
}
4645

4746
ReplicationPolicyResourceDependencies = generateDataSourceFromRepresentationMap("oci_identity_regions", "test_regions", Required, Create, regionDataSourceRepresentation) +
@@ -143,7 +142,7 @@ func TestObjectStorageReplicationPolicyResource_basic(t *testing.T) {
143142
Config: config,
144143
ImportState: true,
145144
ImportStateVerify: true,
146-
ImportStateVerifyIgnore: []string{"delete_object_in_destination_bucket"},
145+
ImportStateVerifyIgnore: []string{},
147146
ResourceName: resourceName,
148147
},
149148
},

website/docs/r/objectstorage_replication_policy.html.markdown

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ resource "oci_objectstorage_replication_policy" "test_replication_policy" {
2222
destination_bucket_name = "${oci_objectstorage_bucket.test_bucket.name}"
2323
destination_region_name = "${oci_identity_region.test_region.name}"
2424
name = "${var.replication_policy_name}"
25-
delete_object_in_destination_bucket = "${delete_object_in_destination_bucket}"
2625
namespace = "${var.replication_policy_namespace}"
2726
}
2827
```
@@ -35,7 +34,6 @@ The following arguments are supported:
3534
* `destination_bucket_name` - (Required) The bucket to replicate to in the destination region. Replication policy creation does not automatically create a destination bucket. Create the destination bucket before creating the policy.
3635
* `destination_region_name` - (Required) The destination region to replicate to, for example "us-ashburn-1".
3736
* `name` - (Required) The name of the policy.
38-
* `delete_object_in_destination_bucket` - (Required) The flag that indicates user understand they will delete the objects in destination bucket, it will be "ACCEPT" or "DECLINE"
3937
* `namespace` - (Required) The Object Storage namespace used for the request.
4038

4139

0 commit comments

Comments
 (0)