Skip to content

Commit 7ee42d4

Browse files
committed
add
1 parent de2c3e8 commit 7ee42d4

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

tencentcloud/services/cdb/extension_mysql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const (
66

77
var MYSQL_ALLOW_BACKUP_TIME = []string{"02:00-06:00", "06:00-10:00", "10:00-14:00", "14:00-18:00", "18:00-22:00", "22:00-02:00"}
88

9-
var MYSQL_ALLOW_BACKUP_MODEL = []string{"logical", "physical"}
9+
var MYSQL_ALLOW_BACKUP_MODEL = []string{"physical", "snapshot"}
1010

1111
// mysql Status https://cloud.tencent.com/document/api/236/15872
1212
const (

tencentcloud/services/cdb/resource_tc_mysql_backup_policy.go

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ func ResourceTencentCloudMysqlBackupPolicy() *schema.Resource {
3535
"backup_model": {
3636
Type: schema.TypeString,
3737
Optional: true,
38-
Default: MYSQL_ALLOW_BACKUP_MODEL[1],
38+
Default: MYSQL_ALLOW_BACKUP_MODEL[0],
3939
ValidateFunc: tccommon.ValidateAllowedStringValue(MYSQL_ALLOW_BACKUP_MODEL),
40-
Description: "Backup method. Supported values include: `physical` - physical backup.",
40+
Description: "Backup method. Supported values include: `physical` - physical backup; `snapshot` - snapshot backup. Multi node only support `physical`, Single node only support `snapshot`.",
4141
},
4242
"backup_time": {
4343
Type: schema.TypeString,
@@ -137,13 +137,10 @@ func resourceTencentCloudMysqlBackupPolicyUpdate(d *schema.ResourceData, meta in
137137
mysqlService := MysqlService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()}
138138

139139
var (
140-
isUpdate = false
141-
142-
mysqlId = d.Get("mysql_id").(string)
143-
retentionPeriod = int64(d.Get("retention_period").(int))
144-
backupModel = d.Get("backup_model").(string)
145-
backupTime = d.Get("backup_time").(string)
146-
140+
mysqlId = d.Get("mysql_id").(string)
141+
retentionPeriod = int64(d.Get("retention_period").(int))
142+
backupModel = d.Get("backup_model").(string)
143+
backupTime = d.Get("backup_time").(string)
147144
binlogExpireDays int64
148145
enableBinlogStandby string
149146
binlogStandbyDays int64
@@ -163,18 +160,12 @@ func resourceTencentCloudMysqlBackupPolicyUpdate(d *schema.ResourceData, meta in
163160

164161
if d.HasChange("retention_period") || d.HasChange("backup_model") || d.HasChange("backup_time") ||
165162
d.HasChange("binlog_period") || d.HasChange("enable_binlog_standby") || d.HasChange("binlog_standby_days") {
166-
if backupModel != "physical" {
167-
return fmt.Errorf("`backup_model` only support 'physical'")
168-
}
169-
isUpdate = true
170-
}
171-
172-
if isUpdate {
173163
err := mysqlService.ModifyBackupConfigByMysqlId(ctx, mysqlId, retentionPeriod, backupModel, backupTime, binlogExpireDays, enableBinlogStandby, binlogStandbyDays)
174164
if err != nil {
175165
return err
176166
}
177167
}
168+
178169
return resourceTencentCloudMysqlBackupPolicyRead(d, meta)
179170
}
180171

website/docs/r/mysql_backup_policy.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ resource "tencentcloud_mysql_backup_policy" "example" {
8080
The following arguments are supported:
8181

8282
* `mysql_id` - (Required, String, ForceNew) Instance ID to which policies will be applied.
83-
* `backup_model` - (Optional, String) Backup method. Supported values include: `physical` - physical backup.
83+
* `backup_model` - (Optional, String) Backup method. Supported values include: `physical` - physical backup; `snapshot` - snapshot backup. Multi node only support `physical`, Single node only support `snapshot`.
8484
* `backup_time` - (Optional, String) Instance backup time, in the format of 'HH:mm-HH:mm'. Time setting interval is four hours. Default to `02:00-06:00`. The following value can be supported: `02:00-06:00`, `06:00-10:00`, `10:00-14:00`, `14:00-18:00`, `18:00-22:00`, and `22:00-02:00`.
8585
* `binlog_period` - (Optional, Int) Binlog retention time, in days. The minimum value is 7 days and the maximum value is 1830 days. This value cannot be set greater than the backup file retention time.
8686
* `binlog_standby_days` - (Optional, Int) The standard starting number of days for log backup storage. The log backup will be converted when it reaches the standard starting number of days for storage. The minimum is 30 days and must not be greater than the number of days for log backup retention.

0 commit comments

Comments
 (0)