Skip to content

Commit

Permalink
Merge pull request #23 from hashicorp/main
Browse files Browse the repository at this point in the history
Fork Sync: Update from parent repository
  • Loading branch information
mbialon authored Sep 26, 2023
2 parents 767293a + 06b125c commit 65fbff8
Show file tree
Hide file tree
Showing 22 changed files with 1,886 additions and 848 deletions.
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
```
3 changes: 3 additions & 0 deletions .changelog/32990.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_opensearch_outbound_connection: Add `connection_properties`, `connection_mode` and `accept_connection` arguments
```
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

0 comments on commit 65fbff8

Please sign in to comment.