Skip to content
Open
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
3 changes: 3 additions & 0 deletions .changelog/44483.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_backup_plan: Allow advanced_backup_setting blocks to accept the S3 resource type
```
1 change: 1 addition & 0 deletions internal/service/backup/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func resourcePlan() *schema.Resource {
Required: true,
ValidateFunc: validation.StringInSlice([]string{
"EC2",
"S3",
}, false),
},
},
Expand Down
34 changes: 32 additions & 2 deletions internal/service/backup/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,18 @@ func TestAccBackupPlan_advancedBackupSetting(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckPlanExists(ctx, resourceName, &plan),
resource.TestCheckResourceAttr(resourceName, names.AttrName, rName),
resource.TestCheckResourceAttr(resourceName, "advanced_backup_setting.#", "1"),
resource.TestCheckResourceAttr(resourceName, "advanced_backup_setting.#", "2"),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "advanced_backup_setting.*", map[string]string{
"backup_options.%": "1",
"backup_options.WindowsVSS": names.AttrEnabled,
names.AttrResourceType: "EC2",
}),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "advanced_backup_setting.*", map[string]string{
"backup_options.%": "2",
"backup_options.BackupACLs": names.AttrEnabled,
"backup_options.BackupObjectTags": names.AttrEnabled,
names.AttrResourceType: "S3",
}),
),
},
{
Expand All @@ -570,12 +576,18 @@ func TestAccBackupPlan_advancedBackupSetting(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckPlanExists(ctx, resourceName, &plan),
resource.TestCheckResourceAttr(resourceName, names.AttrName, rName),
resource.TestCheckResourceAttr(resourceName, "advanced_backup_setting.#", "1"),
resource.TestCheckResourceAttr(resourceName, "advanced_backup_setting.#", "2"),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "advanced_backup_setting.*", map[string]string{
"backup_options.%": "1",
"backup_options.WindowsVSS": "disabled",
names.AttrResourceType: "EC2",
}),
resource.TestCheckTypeSetElemNestedAttrs(resourceName, "advanced_backup_setting.*", map[string]string{
"backup_options.%": "2",
"backup_options.BackupACLs": names.AttrEnabled,
"backup_options.BackupObjectTags": names.AttrEnabled,
names.AttrResourceType: "S3",
}),
),
},
},
Expand Down Expand Up @@ -1133,6 +1145,15 @@ resource "aws_backup_plan" "test" {

resource_type = "EC2"
}

advanced_backup_setting {
backup_options = {
BackupACLs = "enabled"
BackupObjectTags = "enabled"
}

resource_type = "S3"
}
}
`, rName)
}
Expand Down Expand Up @@ -1164,6 +1185,15 @@ resource "aws_backup_plan" "test" {

resource_type = "EC2"
}

advanced_backup_setting {
backup_options = {
BackupACLs = "enabled"
BackupObjectTags = "enabled"
}

resource_type = "S3"
}
}
`, rName)
}
Expand Down
12 changes: 10 additions & 2 deletions website/docs/r/backup_plan.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ resource "aws_backup_plan" "example" {
}
resource_type = "EC2"
}

advanced_backup_setting {
backup_options = {
BackupACLs = "enabled"
BackupObjectTags = "enabled"
}
resource_type = "S3"
}
}
```

Expand Down Expand Up @@ -79,8 +87,8 @@ This resource supports the following arguments:

`advanced_backup_setting` supports the following arguments:

* `backup_options` - (Required) Specifies the backup option for a selected resource. This option is only available for Windows VSS backup jobs. Set to `{ WindowsVSS = "enabled" }` to enable Windows VSS backup option and create a VSS Windows backup.
* `resource_type` - (Required) The type of AWS resource to be backed up. For VSS Windows backups, the only supported resource type is Amazon EC2. Valid values: `EC2`.
* `backup_options` - (Required) Specifies service-specific backup options for the selected resource. For Windows VSS backups, set to `{ WindowsVSS = "enabled" }` (or `"disabled"`). For Amazon S3 backups, configure `{ BackupACLs = "enabled"|"disabled", BackupObjectTags = "enabled"|"disabled" }` to control inclusion of ACLs and object tags.
* `resource_type` - (Required) The type of AWS resource to be backed up. Valid values: `EC2`, `S3`.

## Attribute Reference

Expand Down
Loading