Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sinbai committed Mar 12, 2024
1 parent 2d1c77d commit 20e4b0d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,14 @@ func resourceDataProtectionBackupPolicyPostgreSQL() *pluginsdk.Resource {
ValidateFunc: validate.ISO8601Duration,
},

"target_copy_setting": {
"target_copy": {
Type: pluginsdk.TypeList,
Optional: true,
ForceNew: true,
MaxItems: 1,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"copy_option": {
"option_json": {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
Expand Down Expand Up @@ -303,14 +303,14 @@ func resourceDataProtectionBackupPolicyPostgreSQL() *pluginsdk.Resource {
ValidateFunc: validate.ISO8601Duration,
},

"target_copy_setting": {
"target_copy": {
Type: pluginsdk.TypeList,
Optional: true,
ForceNew: true,
MaxItems: 1,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"copy_option": {
"option_json": {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
Expand Down Expand Up @@ -361,14 +361,14 @@ func resourceDataProtectionBackupPolicyPostgreSQL() *pluginsdk.Resource {
ValidateFunc: validate.ISO8601Duration,
},

"target_copy_setting": {
"target_copy": {
Type: pluginsdk.TypeList,
Optional: true,
ForceNew: true,
MaxItems: 1,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"copy_option": {
"option_json": {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
Expand Down Expand Up @@ -423,14 +423,14 @@ func resourceDataProtectionBackupPolicyPostgreSQL() *pluginsdk.Resource {
ValidateFunc: validate.ISO8601Duration,
},

"target_copy_setting": {
"target_copy": {
Type: pluginsdk.TypeList,
Optional: true,
ForceNew: true,
MaxItems: 1,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"copy_option": {
"option_json": {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
Expand Down Expand Up @@ -686,9 +686,9 @@ func expandBackupPolicyPostgreSQLLifeCycle(input []interface{}) []backuppolicies
for _, item := range input {
v := item.(map[string]interface{})
targetCopySettingList := make([]backuppolicies.TargetCopySetting, 0)
if tcs := v["target_copy_setting"].([]interface{}); len(tcs) > 0 {
if tcs := v["target_copy"].([]interface{}); len(tcs) > 0 {
tcsv := tcs[0].(map[string]interface{})
copyAfter, err := expandTargetCopySettingFromJSON(tcsv["copy_option"].(string))
copyAfter, err := expandTargetCopySettingFromJSON(tcsv["option_json"].(string))
if err != nil {
return results
}
Expand Down Expand Up @@ -1059,9 +1059,9 @@ func flattenBackupPolicyPostgreSQLBackupLifeCycleArray(input []backuppolicies.So
dataStoreType = string(item.SourceDataStore.DataStoreType)

results = append(results, map[string]interface{}{
"duration": duration,
"target_copy_setting": targetDataStoreCopySetting,
"data_store_type": dataStoreType,
"duration": duration,
"target_copy": targetDataStoreCopySetting,
"data_store_type": dataStoreType,
})
}
return results
Expand All @@ -1081,7 +1081,7 @@ func flattenBackupPolicyPostgreSQLBackupTargetDataStoreCopySettingArray(input *[
dataStoreType := string(item.DataStore.DataStoreType)

results = append(results, map[string]interface{}{
"copy_option": copyAfter,
"option_json": copyAfter,
"data_store_type": dataStoreType,
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ resource "azurerm_data_protection_backup_policy_postgresql" "test" {
life_cycle {
duration = "P12W"
data_store_type = "VaultStore"
target_copy_setting {
copy_option = jsonencode({
target_copy {
option_json = jsonencode({
objectType = "CopyOnExpiryOption"
})
data_store_type = "ArchiveStore"
Expand All @@ -342,8 +342,8 @@ resource "azurerm_data_protection_backup_policy_postgresql" "test" {
life_cycle {
duration = "P12M"
data_store_type = "VaultStore"
target_copy_setting {
copy_option = jsonencode({
target_copy {
option_json = jsonencode({
objectType = "CopyOnExpiryOption"
})
data_store_type = "ArchiveStore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,13 @@ A `life_cycle` block supports the following:

* `duration` - (Required) Duration after which the backup is deleted. It should follow `ISO 8601` duration format. Changing this forces a new Backup Policy PostgreSQL to be created.

* `target_copy_setting` - (Optional) A `target_copy_setting` block as defined below. Changing this forces a new Backup Policy PostgreSQL to be created.
* `target_copy` - (Optional) A `target_copy` block as defined below. Changing this forces a new Backup Policy PostgreSQL to be created.

---

A `target_copy_setting` block supports the following:
A `target_copy` block supports the following:

* `copy_option` - (Required) Specifies when the backups are tiered across two or more selected data stores as a json encoded string. Changing this forces a new Backup Policy PostgreSQL to be created.
* `option_json` - (Required) Specifies when the backups are tiered across two or more selected data stores as a json encoded string. Changing this forces a new Backup Policy PostgreSQL to be created.

* `data_store_type` - (Required) The type of data store. The only possible value is `ArchiveStore`. Changing this forces a new Backup Policy PostgreSQL to be created.

Expand Down

0 comments on commit 20e4b0d

Please sign in to comment.