Skip to content

Commit

Permalink
Merge pull request #35320 from brinnjoyce/f-aws_fsx_openzfs_file_syst…
Browse files Browse the repository at this point in the history
…em-skip_final_backup

r/aws_fsx_openzfs_file_system: Add `skip_final_backup` argument
  • Loading branch information
ewbankkit committed Jan 24, 2024
2 parents f01b760 + 4d1b797 commit 4a403d9
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 58 deletions.
3 changes: 3 additions & 0 deletions .changelog/35320.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_fsx_openzfs_file_system: Add `skip_final_backup` argument
```
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ resource "aws_fsx_openzfs_file_system" "test" {
subnet_ids = aws_subnet.test[*].id
deployment_type = "SINGLE_AZ_1"
throughput_capacity = 64
skip_final_backup = true
tags = {
Name = %[1]q
Expand Down
2 changes: 1 addition & 1 deletion internal/service/fsx/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ resource "aws_fsx_openzfs_file_system" "test" {
subnet_ids = [aws_subnet.test1.id]
deployment_type = "SINGLE_AZ_1"
throughput_capacity = 64
skip_final_backup = true
tags = {
Name = %[1]q
Expand Down
14 changes: 13 additions & 1 deletion internal/service/fsx/openzfs_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ func ResourceOpenZFSFileSystem() *schema.Resource {
DeleteWithoutTimeout: resourceOpenZFSFileSystemDelete,

Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
StateContext: func(ctx context.Context, d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
d.Set("skip_final_backup", false)

return []*schema.ResourceData{d}, nil
},
},

Timeouts: &schema.ResourceTimeout{
Expand Down Expand Up @@ -250,6 +254,11 @@ func ResourceOpenZFSFileSystem() *schema.Resource {
MaxItems: 50,
Elem: &schema.Schema{Type: schema.TypeString},
},
"skip_final_backup": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"storage_capacity": {
Type: schema.TypeInt,
Optional: true,
Expand Down Expand Up @@ -621,6 +630,9 @@ func resourceOpenZFSFileSystemDelete(ctx context.Context, d *schema.ResourceData
log.Printf("[DEBUG] Deleting FSx for OpenZFS File System: %s", d.Id())
_, err := conn.DeleteFileSystemWithContext(ctx, &fsx.DeleteFileSystemInput{
FileSystemId: aws.String(d.Id()),
OpenZFSConfiguration: &fsx.DeleteFileSystemOpenZFSConfiguration{
SkipFinalBackup: aws.Bool(d.Get("skip_final_backup").(bool)),
},
})

if tfawserr.ErrCodeEquals(err, fsx.ErrCodeFileSystemNotFound) {
Expand Down
Loading

0 comments on commit 4a403d9

Please sign in to comment.