Skip to content

Commit 2e21333

Browse files
authored
fix(mongodb): [128905336] tencentcloud_mongodb_instance_backup_rule add new params (#3627)
* add * add
1 parent dc45601 commit 2e21333

File tree

4 files changed

+108
-2
lines changed

4 files changed

+108
-2
lines changed

.changelog/3627.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_mongodb_instance_backup_rule: add new params
3+
```

tencentcloud/services/mongodb/resource_tc_mongodb_instance_backup_rule.go

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func ResourceTencentCloudMongodbInstanceBackupRule() *schema.Resource {
2626
Required: true,
2727
ForceNew: true,
2828
Type: schema.TypeString,
29-
Description: "Instance id.",
29+
Description: "Instance ID.",
3030
},
3131

3232
"backup_method": {
@@ -44,12 +44,66 @@ func ResourceTencentCloudMongodbInstanceBackupRule() *schema.Resource {
4444
Description: "Set the start time for automatic backup. The value range is: [0,23]. For example, setting this parameter to 2 means that backup starts at 02:00.",
4545
},
4646

47+
"backup_frequency": {
48+
Type: schema.TypeInt,
49+
Optional: true,
50+
Description: "Automatic backup frequency, for internal display, default value is 24h.",
51+
},
52+
53+
"notify": {
54+
Type: schema.TypeBool,
55+
Optional: true,
56+
Description: "Set whether to send failure alerts when automatic backup errors occur.\n- true: Send.\n- false: Do not send.",
57+
},
58+
4759
"backup_retention_period": {
4860
Optional: true,
4961
Computed: true,
5062
Type: schema.TypeInt,
5163
Description: "Specify the number of days to save backup data. The default is 7 days, and the support settings are 7, 30, 90, 180, 365.",
5264
},
65+
66+
"active_weekdays": {
67+
Type: schema.TypeString,
68+
Optional: true,
69+
Description: "Which days of the week to backup, 0-6, comma separated. Only effective for advanced backup.",
70+
},
71+
72+
"long_term_unit": {
73+
Type: schema.TypeString,
74+
Optional: true,
75+
Description: "Long-term retention cycle, weekly, monthly, empty means not enabled.",
76+
},
77+
78+
"long_term_active_days": {
79+
Type: schema.TypeString,
80+
Optional: true,
81+
Description: "Which days to retain long-term, week 0-6, month 1-31, comma separated.",
82+
},
83+
84+
"long_term_expired_days": {
85+
Type: schema.TypeInt,
86+
Optional: true,
87+
Description: "How many days to retain long-term backups.",
88+
},
89+
90+
"oplog_expired_days": {
91+
Type: schema.TypeInt,
92+
Optional: true,
93+
Description: "How many days to retain incremental backups.",
94+
},
95+
96+
"backup_version": {
97+
Type: schema.TypeInt,
98+
Optional: true,
99+
Description: "Backup version. Old version backup is 0, advanced backup is 1. Set this value to 1 when enabling advanced backup.",
100+
},
101+
102+
"alarm_water_level": {
103+
Type: schema.TypeInt,
104+
Optional: true,
105+
Description: "Alert threshold. Range: 50-300.",
106+
},
53107
},
54108
}
55109
}
@@ -139,10 +193,46 @@ func resourceTencentCloudMongodbInstanceBackupRuleUpdate(d *schema.ResourceData,
139193
request.BackupTime = helper.IntUint64(v.(int))
140194
}
141195

196+
if v, ok := d.GetOkExists("backup_frequency"); ok {
197+
request.BackupFrequency = helper.IntUint64(v.(int))
198+
}
199+
200+
if v, ok := d.GetOkExists("notify"); ok {
201+
request.Notify = helper.Bool(v.(bool))
202+
}
203+
142204
if v, ok := d.GetOkExists("backup_retention_period"); ok {
143205
request.BackupRetentionPeriod = helper.IntUint64(v.(int))
144206
}
145207

208+
if v, ok := d.GetOk("active_weekdays"); ok {
209+
request.ActiveWeekdays = helper.String(v.(string))
210+
}
211+
212+
if v, ok := d.GetOk("long_term_unit"); ok {
213+
request.LongTermUnit = helper.String(v.(string))
214+
}
215+
216+
if v, ok := d.GetOk("long_term_active_days"); ok {
217+
request.LongTermActiveDays = helper.String(v.(string))
218+
}
219+
220+
if v, ok := d.GetOkExists("long_term_expired_days"); ok {
221+
request.LongTermExpiredDays = helper.IntInt64(v.(int))
222+
}
223+
224+
if v, ok := d.GetOkExists("oplog_expired_days"); ok {
225+
request.OplogExpiredDays = helper.IntInt64(v.(int))
226+
}
227+
228+
if v, ok := d.GetOkExists("backup_version"); ok {
229+
request.BackupVersion = helper.IntInt64(v.(int))
230+
}
231+
232+
if v, ok := d.GetOkExists("alarm_water_level"); ok {
233+
request.AlarmWaterLevel = helper.IntInt64(v.(int))
234+
}
235+
146236
request.InstanceId = &instanceId
147237
err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError {
148238
result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseMongodbClient().SetBackupRules(request)

tencentcloud/services/mongodb/resource_tc_mongodb_instance_backup_rule.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ resource "tencentcloud_mongodb_instance_backup_rule" "example" {
88
backup_method = 0
99
backup_time = 10
1010
backup_retention_period = 7
11+
backup_version = 1
1112
}
1213
```
1314

website/docs/r/mongodb_instance_backup_rule.html.markdown

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ resource "tencentcloud_mongodb_instance_backup_rule" "example" {
1919
backup_method = 0
2020
backup_time = 10
2121
backup_retention_period = 7
22+
backup_version = 1
2223
}
2324
```
2425

@@ -31,8 +32,19 @@ The following arguments are supported:
3132
- 1: Physical backup;
3233
- 3: Snapshot backup (supported only in cloud disk version).
3334
* `backup_time` - (Required, Int) Set the start time for automatic backup. The value range is: [0,23]. For example, setting this parameter to 2 means that backup starts at 02:00.
34-
* `instance_id` - (Required, String, ForceNew) Instance id.
35+
* `instance_id` - (Required, String, ForceNew) Instance ID.
36+
* `active_weekdays` - (Optional, String) Which days of the week to backup, 0-6, comma separated. Only effective for advanced backup.
37+
* `alarm_water_level` - (Optional, Int) Alert threshold. Range: 50-300.
38+
* `backup_frequency` - (Optional, Int) Automatic backup frequency, for internal display, default value is 24h.
3539
* `backup_retention_period` - (Optional, Int) Specify the number of days to save backup data. The default is 7 days, and the support settings are 7, 30, 90, 180, 365.
40+
* `backup_version` - (Optional, Int) Backup version. Old version backup is 0, advanced backup is 1. Set this value to 1 when enabling advanced backup.
41+
* `long_term_active_days` - (Optional, String) Which days to retain long-term, week 0-6, month 1-31, comma separated.
42+
* `long_term_expired_days` - (Optional, Int) How many days to retain long-term backups.
43+
* `long_term_unit` - (Optional, String) Long-term retention cycle, weekly, monthly, empty means not enabled.
44+
* `notify` - (Optional, Bool) Set whether to send failure alerts when automatic backup errors occur.
45+
- true: Send.
46+
- false: Do not send.
47+
* `oplog_expired_days` - (Optional, Int) How many days to retain incremental backups.
3648

3749
## Attributes Reference
3850

0 commit comments

Comments
 (0)