Skip to content

Commit

Permalink
r/aws_datasync_location_fsx_ontap_file_system: SMB Password is not re…
Browse files Browse the repository at this point in the history
…turned from the API, so propagate from configuration.
  • Loading branch information
ewbankkit committed Sep 28, 2023
1 parent 6b5d69a commit 6a5fc45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions internal/service/datasync/location_fsx_ontap_file_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
},
})
Expand Down

0 comments on commit 6a5fc45

Please sign in to comment.