Skip to content

feat(oms): add oms migration task and migration task group fields #7107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions docs/resources/oms_migration_task.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,68 @@ The following arguments are supported:
* `smn_config` - (Optional, List, ForceNew) Specifies the SMN message sending configuration.
The [object](#smn_config_object) structure is documented below. Changing this creates a new resource.

* `object_overwrite_mode` - (Optional, String, ForceNew) Specifies whether to skip a source object or allow the source
object to overwrite its paired destination object. Value options are as follows:

+ **NO_OVERWRITE**: indicates the system never allows override. The system always skips source objects and keeps
their paired destination objects.

+ **SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE**: indicates the system allows override based on the results of size or
modification time checks. If a source object is not as large as or was last modified more recently than its paired
destination object, the source object will overwrite the destination object. Otherwise, the source object will be
skipped.

+ **CRC64_COMPARISON_OVERWRITE**: indicates the system allows override if the source and destination objects have
different CRC64 checksums. This option is only available for migration on Huawei Cloud or from Alibaba Cloud or
Tencent Cloud. If a source object has a CRC64 checksum different from the paired destination object, the source
object will overwrite the destination object. Otherwise, the source object will be skipped.
If any of them doesn't have a CRC64 checksum, their sizes and last modification times are checked.

+ **FULL_OVERWRITE**: indicates the system always allows override. The system always allows source objects to
overwrite their paired destination objects.

The default value is **SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE**. Changing this creates a new resource.

* `consistency_check` - (Optional, String, ForceNew) Specifies the consistency check method, which is used to check
whether objects are consistent before and after migration. All check methods take effect for only objects that are
in the same encryption status in the source and destination buckets. The check method and results will be recorded
in the object list. Value options are as follows:

+ **size_last_modified**: the system checks object consistency with object size and last modification time.
If a source object is as large as but was last modified earlier than its paired destination object, the system
considers the source object does not need to be migrated or has been already migrated successfully.

+ **crc64**: this option is only available for migration on Huawei Cloud or from Alibaba Cloud or Tencent Cloud. If
a source object and its paired destination object have CRC64 checksums, the checksums are checked. Otherwise, their
sizes and last modification times are checked.

+ **no_check**: this option is only available for migration of HTTP/HTTPS data. This option takes effect for source
objects whose sizes cannot be obtained using the content-length field in the standard HTTP protocol. These source
objects will overwrite their paired destination objects directly.
If the size of a source object can be obtained, its size and last modification time will be checked.

The default value is **size_last_modified**. Changing this creates a new resource.

* `enable_requester_pays` - (Optional, Bool, ForceNew) Specifies whether to let the requester make payment.
After enabled, the requester pays the request and data transmission fees.
Default value: **false**. Changing this creates a new resource.

* `enable_metadata_migration` - (Optional, Bool, ForceNew) Specifies whether metadata migration is enabled. Even if this
function is disabled, the ContentType metadata will still be migrated to ensure a successful migration.
Default value: **false**. Changing this creates a new resource.

* `task_priority` - (Optional, String, ForceNew) Specifies the task priority.
The value can be **HIGH**, **MEDIUM**, or **LOW**. Changing this creates a new resource.

* `dst_storage_policy` - (Optional, String, ForceNew) Specifies the destination storage class.
This parameter is required only when the destination is Huawei Cloud OBS. The default value is STANDARD.
+ **STANDARD**: OBS Standard storage.
+ **IA**: OBS Infrequent Access storage.
+ **ARCHIVE**: OBS Archive storage
+ **DEEP_ARCHIVE**: OBS Deep Archive storage
+ **SRC_STORAGE_MAPPING**: converts the source storage class into an OBS storage class based on the predefined rules.
Changing this creates a new resource.

<a name="source_object_object"></a>
The `source_object` block supports:

Expand Down Expand Up @@ -150,6 +212,12 @@ The `source_object` block supports:
* `list_file_key` - (Optional, String, ForceNew) Specifies the object name of the list file or URL list file.
`list_file_key` is mandatory when `type` is set to **list** or **url_list**. Changing this creates a new resource.

* `list_file_num` - (Optional, String, ForceNew) Specifies the number of stored object list files.
Changing this creates a new resource.

* `json_auth_file` - (Optional, String, ForceNew) Specifies the file used for Google Cloud Storage authentication.
Changing this creates a new resource.

<a name="destination_object_object"></a>
The `destination_object` block supports:

Expand Down Expand Up @@ -216,6 +284,10 @@ The `smn_config` block supports:
* `language` - (Optional, String, ForceNew) Specifies the SMN message language. The value can be **zh-cn** or
**en-us**. Default value: **en-us**. Changing this creates a new resource.

* `message_template_name` - (Optional, String, ForceNew) Specifies the message template name.
If this parameter is specified, SMN messages are sent using the specified template.
Changing this creates a new resource.

## Attribute Reference

In addition to all arguments above, the following attributes are exported:
Expand Down
13 changes: 13 additions & 0 deletions docs/resources/oms_migration_task_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,19 @@ The following arguments are supported:
name during migration. The [object](#source_cdn_object) structure is documented below.
Changing this creates a new resource.

* `enable_metadata_migration` - (Optional, Bool, ForceNew) Specifies whether metadata migration is enabled. Even if this
function is disabled, the ContentType metadata will still be migrated to ensure a successful migration.
Default value: **false**. Changing this creates a new resource.

* `dst_storage_policy` - (Optional, String, ForceNew) Specifies the destination storage class.
This parameter is required only when the destination is Huawei Cloud OBS. The default value is STANDARD.
+ **STANDARD**: OBS Standard storage.
+ **IA**: OBS Infrequent Access storage.
+ **ARCHIVE**: OBS Archive storage
+ **DEEP_ARCHIVE**: OBS Deep Archive storage
+ **SRC_STORAGE_MAPPING**: converts the source storage class into an OBS storage class based on the predefined rules.
Changing this creates a new resource.

<a name="source_object_object"></a>
The `source_object` block supports:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ resource "huaweicloud_oms_migration_task_group" "test" {
consistency_check = "crc64"
enable_requester_pays = true
enable_failed_object_recording = true
enable_metadata_migration = true

bandwidth_policy {
max_bandwidth = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ resource "huaweicloud_oms_migration_task" "test" {
type = "object"
description = "test task"

enable_metadata_migration = true

bandwidth_policy {
max_bandwidth = 1
start = "15:00"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ func ResourceMigrationTask() *schema.Resource {
"source_object.0.list_file_bucket",
},
},
"list_file_num": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"json_auth_file": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
},
},
},
Expand Down Expand Up @@ -290,9 +300,44 @@ func ResourceMigrationTask() *schema.Resource {
Optional: true,
ForceNew: true,
},
"message_template_name": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
},
},
},
"enable_metadata_migration": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
"dst_storage_policy": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"task_priority": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"consistency_check": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"enable_requester_pays": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
"object_overwrite_mode": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"name": {
Type: schema.TypeString,
Computed: true,
Expand All @@ -319,12 +364,14 @@ func buildSrcNodeOpts(rawSrcNode []interface{}) map[string]interface{} {
"security_token": utils.ValueIgnoreEmpty(srcNode["security_token"]),
"app_id": utils.ValueIgnoreEmpty(srcNode["app_id"]),
"bucket": utils.ValueIgnoreEmpty(srcNode["bucket"]),
"json_auth_file": utils.ValueIgnoreEmpty(srcNode["json_auth_file"]),
}

if srcNode["list_file_bucket"].(string) != "" {
srcNodeOpts["list_file"] = map[string]interface{}{
"obs_bucket": srcNode["list_file_bucket"],
"list_file_key": srcNode["list_file_key"],
"list_file_num": utils.ValueIgnoreEmpty(srcNode["list_file_num"]),
}
}

Expand Down Expand Up @@ -464,6 +511,12 @@ func buildcreateTaskBodyParams(d *schema.ResourceData, cfg *config.Config) (map[
"enable_restore": d.Get("enable_restore"),
"enable_failed_object_recording": d.Get("enable_failed_object_recording"),
"source_cdn": buildSourceCdnOpts(d.Get("source_cdn").([]interface{})),
"enable_metadata_migration": d.Get("enable_metadata_migration").(bool),
"enable_requester_pays": d.Get("enable_requester_pays").(bool),
"task_priority": utils.ValueIgnoreEmpty(d.Get("task_priority").(string)),
"consistency_check": utils.ValueIgnoreEmpty(d.Get("consistency_check").(string)),
"object_overwrite_mode": utils.ValueIgnoreEmpty(d.Get("object_overwrite_mode").(string)),
"dst_storage_policy": utils.ValueIgnoreEmpty(d.Get("dst_storage_policy").(string)),
}

dstNodeOpts, err := buildDstNodeOpts(cfg, d.Get("destination_object").([]interface{}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,16 @@ func ResourceMigrationTaskGroup() *schema.Resource {
},
},
},
"enable_metadata_migration": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
"dst_storage_policy": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
},
"status": {
Type: schema.TypeInt,
Computed: true,
Expand Down Expand Up @@ -412,6 +422,8 @@ func buildTaskGroupCreateOpts(conf *config.Config, d *schema.ResourceData) (map[
"enable_requester_pays": utils.ValueIgnoreEmpty(d.Get("enable_requester_pays")),
"object_overwrite_mode": utils.ValueIgnoreEmpty(d.Get("object_overwrite_mode")),
"consistency_check": utils.ValueIgnoreEmpty(d.Get("consistency_check")),
"enable_metadata_migration": d.Get("enable_metadata_migration").(bool),
"dst_storage_policy": utils.ValueIgnoreEmpty(d.Get("dst_storage_policy").(string)),
}

return createOpts, nil
Expand Down
Loading