From 6a5fc45252c7cf5843ed07f1e4cab4279d764fd1 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 28 Sep 2023 14:02:13 -0400 Subject: [PATCH] r/aws_datasync_location_fsx_ontap_file_system: SMB Password is not returned from the API, so propagate from configuration. --- .../service/datasync/location_fsx_ontap_file_system.go | 6 ++++++ .../datasync/location_fsx_ontap_file_system_test.go | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/internal/service/datasync/location_fsx_ontap_file_system.go b/internal/service/datasync/location_fsx_ontap_file_system.go index 27ff9ff235f..20263884cf2 100644 --- a/internal/service/datasync/location_fsx_ontap_file_system.go +++ b/internal/service/datasync/location_fsx_ontap_file_system.go @@ -244,6 +244,12 @@ func resourceLocationFSxONTAPFileSystemRead(ctx context.Context, d *schema.Resou d.Set("arn", output.LocationArn) d.Set("creation_time", output.CreationTime.Format(time.RFC3339)) d.Set("fsx_filesystem_arn", output.FsxFilesystemArn) + // SMB Password is not returned from the API. + if output.Protocol != nil && output.Protocol.SMB != nil && aws.StringValue(output.Protocol.SMB.Password) == "" { + if smbPassword := d.Get("protocol.0.smb.0.password").(string); smbPassword != "" { + output.Protocol.SMB.Password = aws.String(smbPassword) + } + } if err := d.Set("protocol", flattenProtocol(output.Protocol)); err != nil { return sdkdiag.AppendErrorf(diags, "setting protocol: %s", err) } diff --git a/internal/service/datasync/location_fsx_ontap_file_system_test.go b/internal/service/datasync/location_fsx_ontap_file_system_test.go index 675441e510c..2fb8c704294 100644 --- a/internal/service/datasync/location_fsx_ontap_file_system_test.go +++ b/internal/service/datasync/location_fsx_ontap_file_system_test.go @@ -128,10 +128,11 @@ func TestAccDataSyncLocationFSxONTAPFileSystem_smb(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateIdFunc: testAccLocationFSxONTAPImportStateID(resourceName), + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"protocol.0.smb.0.password"}, // Not returned from API. + ImportStateIdFunc: testAccLocationFSxONTAPImportStateID(resourceName), }, }, })