Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_fsx_openzfs_file_system: Add skip_final_backup argument #35320

Merged
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/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
Loading