diff --git a/.changelog/44483.txt b/.changelog/44483.txt new file mode 100644 index 000000000000..1f26307228c4 --- /dev/null +++ b/.changelog/44483.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_backup_plan: Allow advanced_backup_setting blocks to accept the S3 resource type +``` diff --git a/internal/service/backup/plan.go b/internal/service/backup/plan.go index 35b48bb97ae9..8a93d8784a13 100644 --- a/internal/service/backup/plan.go +++ b/internal/service/backup/plan.go @@ -69,6 +69,7 @@ func resourcePlan() *schema.Resource { Required: true, ValidateFunc: validation.StringInSlice([]string{ "EC2", + "S3", }, false), }, }, diff --git a/internal/service/backup/plan_test.go b/internal/service/backup/plan_test.go index 122ed8ddf3b1..11304e296318 100644 --- a/internal/service/backup/plan_test.go +++ b/internal/service/backup/plan_test.go @@ -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", + }), ), }, { @@ -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", + }), ), }, }, @@ -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) } @@ -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) } diff --git a/website/docs/r/backup_plan.html.markdown b/website/docs/r/backup_plan.html.markdown index 30b3ac33ce77..0d04e60f3d0c 100644 --- a/website/docs/r/backup_plan.html.markdown +++ b/website/docs/r/backup_plan.html.markdown @@ -32,6 +32,14 @@ resource "aws_backup_plan" "example" { } resource_type = "EC2" } + + advanced_backup_setting { + backup_options = { + BackupACLs = "enabled" + BackupObjectTags = "enabled" + } + resource_type = "S3" + } } ``` @@ -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