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_ontap_volume support snapshot_policy argument #32530

Merged
merged 30 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1d239d5
add snapshot_policy to aws_fsx_ontap_volume
coreylane-orion Jul 15, 2023
6496e6d
Merge branch 'hashicorp:main' into f-aws_fsx_ontap_volume-add-snapsho…
coreylane Jul 15, 2023
1b31de8
update snapshot test and attribute
coreylane-orion Jul 17, 2023
d5fa3fd
fsx documentation
coreylane-orion Jul 17, 2023
448f72b
adds pr 32530 to changelog
coreylane-orion Jul 17, 2023
91f885c
adds TestAccFSxOntapVolume_snapshotPolicy
coreylane-orion Jul 17, 2023
3e3b420
alpha testAccONTAPVolumeConfig_size
coreylane-orion Jul 17, 2023
65e95f3
Merge branch 'main' into HEAD
ewbankkit Sep 22, 2023
06ee53d
fsx: Move functions around.
ewbankkit Sep 22, 2023
0930fbe
r/aws_fsx_ontap_volume: Tidy up resource Read.
ewbankkit Sep 22, 2023
ca74a29
r/aws_fsx_ontap_volume: Tidy up resource Update and Delete.
ewbankkit Sep 22, 2023
95ad7a7
fsx: 'AdministrativeAction' -> 'FileSystemAdministrativeAction'.
ewbankkit Sep 22, 2023
140d06f
fsx: Add 'waitVolumeAdministrativeActionCompleted' and friends.
ewbankkit Sep 22, 2023
767ba0c
r/aws_fsx_ontap_volume: Correct function names.
ewbankkit Sep 22, 2023
cb8c708
r/aws_fsx_ontap_volume: Add 'copy_tags_to_backups' argument.
ewbankkit Sep 22, 2023
fd8075f
r/aws_fsx_ontap_volume: Make 'snapshot_policy' Computed, preventing e…
ewbankkit Sep 23, 2023
b93f168
Acceptance test output:
ewbankkit Sep 23, 2023
57d5892
r/aws_fsx_openzfs_volume: Correct function names.
ewbankkit Sep 23, 2023
de65886
Add 'TestAccFSxOpenZFSVolume_disappears'.
ewbankkit Sep 23, 2023
4bec1b6
fsx: Consolidate OpenZFS flatteners and expanders.
ewbankkit Sep 23, 2023
a923621
Acceptance test output:
ewbankkit Sep 23, 2023
f8a0aa5
r/aws_fsx_ontap_volume: Add 'snaplock_configuration' argument.
ewbankkit Sep 24, 2023
d1d34a1
fsx: Cosmetics.
ewbankkit Sep 24, 2023
a4b8d57
Add 'TestAccFSxONTAPVolume_snaplock'.
ewbankkit Sep 24, 2023
6dbbc63
fsx: Fix sweeper compilation errors.
ewbankkit Sep 24, 2023
3c3cb18
r/aws_fsx_ontap_volume: 'snaplock_configuration.autocommit_period' an…
ewbankkit Sep 25, 2023
4f687c3
Fix markdown-lint 'MD009/no-trailing-spaces Trailing spaces [Expected…
ewbankkit Sep 25, 2023
efbdb7a
r/aws_fsx_openzfs_volume: Add 'delete_volume_options' argument.
ewbankkit Sep 25, 2023
ad58585
Acceptance test output:
ewbankkit Sep 25, 2023
0ed7cef
r/aws_fsx_ontap_volume: Add 'bypass_snaplock_enterprise_retention' ar…
ewbankkit Sep 25, 2023
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
11 changes: 11 additions & 0 deletions .changelog/32530.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
```release-note:enhancement
resource/aws_fsx_ontap_volume: Add `copy_tags_to_backups` and `snapshot_policy` arguments
```

```release-note:enhancement
resource/aws_fsx_ontap_volume: Add `bypass_snaplock_enterprise_retention` argument and `snaplock_configuration` configuration block to support [SnapLock](https://docs.aws.amazon.com/fsx/latest/ONTAPGuide/snaplock.html)
```

```release-note:enhancement
resource/aws_fsx_openzfs_volume: Add `delete_volume_options` argument
```
32 changes: 16 additions & 16 deletions internal/service/fsx/lustre_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ func resourceLustreFileSystemUpdate(ctx context.Context, d *schema.ResourceData,
return sdkdiag.AppendErrorf(diags, "waiting for FSx for Lustre File System (%s) update: %s", d.Id(), err)
}

if _, err := waitAdministrativeActionCompleted(ctx, conn, d.Id(), fsx.AdministrativeActionTypeFileSystemUpdate, d.Timeout(schema.TimeoutUpdate)); err != nil {
if _, err := waitFileSystemAdministrativeActionCompleted(ctx, conn, d.Id(), fsx.AdministrativeActionTypeFileSystemUpdate, d.Timeout(schema.TimeoutUpdate)); err != nil {
return sdkdiag.AppendErrorf(diags, "waiting for FSx for Lustre File System (%s) administrative action (%s) complete: %s", d.Id(), fsx.AdministrativeActionTypeFileSystemUpdate, err)
}
}
Expand Down Expand Up @@ -658,14 +658,6 @@ func logStateFunc(v interface{}) string {
return value
}

func findFileSystemByID(ctx context.Context, conn *fsx.FSx, id string) (*fsx.FileSystem, error) {
input := &fsx.DescribeFileSystemsInput{
FileSystemIds: aws.StringSlice([]string{id}),
}

return findFileSystem(ctx, conn, input, tfslices.PredicateTrue[*fsx.FileSystem]())
}

func FindLustreFileSystemByID(ctx context.Context, conn *fsx.FSx, id string) (*fsx.FileSystem, error) {
output, err := findFileSystemByIDAndType(ctx, conn, id, fsx.FileSystemTypeLustre)

Expand All @@ -680,6 +672,14 @@ func FindLustreFileSystemByID(ctx context.Context, conn *fsx.FSx, id string) (*f
return output, nil
}

func findFileSystemByID(ctx context.Context, conn *fsx.FSx, id string) (*fsx.FileSystem, error) {
input := &fsx.DescribeFileSystemsInput{
FileSystemIds: aws.StringSlice([]string{id}),
}

return findFileSystem(ctx, conn, input, tfslices.PredicateTrue[*fsx.FileSystem]())
}

func findFileSystemByIDAndType(ctx context.Context, conn *fsx.FSx, fsID, fsType string) (*fsx.FileSystem, error) {
input := &fsx.DescribeFileSystemsInput{
FileSystemIds: aws.StringSlice([]string{fsID}),
Expand Down Expand Up @@ -761,7 +761,7 @@ func waitFileSystemCreated(ctx context.Context, conn *fsx.FSx, id string, timeou

if output, ok := outputRaw.(*fsx.FileSystem); ok {
if status, details := aws.StringValue(output.Lifecycle), output.FailureDetails; status == fsx.FileSystemLifecycleFailed && details != nil {
tfresource.SetLastError(err, errors.New(aws.StringValue(output.FailureDetails.Message)))
tfresource.SetLastError(err, errors.New(aws.StringValue(details.Message)))
}

return output, err
Expand Down Expand Up @@ -823,7 +823,7 @@ func waitFileSystemDeleted(ctx context.Context, conn *fsx.FSx, id string, timeou

if output, ok := outputRaw.(*fsx.FileSystem); ok {
if status, details := aws.StringValue(output.Lifecycle), output.FailureDetails; status == fsx.FileSystemLifecycleFailed && details != nil {
tfresource.SetLastError(err, errors.New(aws.StringValue(output.FailureDetails.Message)))
tfresource.SetLastError(err, errors.New(aws.StringValue(details.Message)))
}

return output, err
Expand All @@ -832,7 +832,7 @@ func waitFileSystemDeleted(ctx context.Context, conn *fsx.FSx, id string, timeou
return nil, err
}

func findAdministrativeAction(ctx context.Context, conn *fsx.FSx, fsID, actionType string) (*fsx.AdministrativeAction, error) {
func findFileSystemAdministrativeAction(ctx context.Context, conn *fsx.FSx, fsID, actionType string) (*fsx.AdministrativeAction, error) {
output, err := findFileSystemByID(ctx, conn, fsID)

if err != nil {
Expand All @@ -853,9 +853,9 @@ func findAdministrativeAction(ctx context.Context, conn *fsx.FSx, fsID, actionTy
return &fsx.AdministrativeAction{Status: aws.String(fsx.StatusCompleted)}, nil
}

func statusAdministrativeAction(ctx context.Context, conn *fsx.FSx, fsID, actionType string) retry.StateRefreshFunc {
func statusFileSystemAdministrativeAction(ctx context.Context, conn *fsx.FSx, fsID, actionType string) retry.StateRefreshFunc {
return func() (interface{}, string, error) {
output, err := findAdministrativeAction(ctx, conn, fsID, actionType)
output, err := findFileSystemAdministrativeAction(ctx, conn, fsID, actionType)

if tfresource.NotFound(err) {
return nil, "", nil
Expand All @@ -869,11 +869,11 @@ func statusAdministrativeAction(ctx context.Context, conn *fsx.FSx, fsID, action
}
}

func waitAdministrativeActionCompleted(ctx context.Context, conn *fsx.FSx, fsID, actionType string, timeout time.Duration) (*fsx.AdministrativeAction, error) { //nolint:unparam
func waitFileSystemAdministrativeActionCompleted(ctx context.Context, conn *fsx.FSx, fsID, actionType string, timeout time.Duration) (*fsx.AdministrativeAction, error) { //nolint:unparam
stateConf := &retry.StateChangeConf{
Pending: []string{fsx.StatusInProgress, fsx.StatusPending},
Target: []string{fsx.StatusCompleted, fsx.StatusUpdatedOptimizing},
Refresh: statusAdministrativeAction(ctx, conn, fsID, actionType),
Refresh: statusFileSystemAdministrativeAction(ctx, conn, fsID, actionType),
Timeout: timeout,
Delay: 30 * time.Second,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/service/fsx/ontap_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func resourceONTAPFileSystemUpdate(ctx context.Context, d *schema.ResourceData,
return sdkdiag.AppendErrorf(diags, "waiting for FSx for NetApp ONTAP File System (%s) update: %s", d.Id(), err)
}

if _, err := waitAdministrativeActionCompleted(ctx, conn, d.Id(), fsx.AdministrativeActionTypeFileSystemUpdate, d.Timeout(schema.TimeoutUpdate)); err != nil {
if _, err := waitFileSystemAdministrativeActionCompleted(ctx, conn, d.Id(), fsx.AdministrativeActionTypeFileSystemUpdate, d.Timeout(schema.TimeoutUpdate)); err != nil {
return sdkdiag.AppendErrorf(diags, "waiting for FSx for NetApp ONTAP File System (%s) administrative action (%s) complete: %s", d.Id(), fsx.AdministrativeActionTypeFileSystemUpdate, err)
}
}
Expand Down
Loading
Loading