aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
238 stars 79 forks source link

Copy-S3Object changing variables outside its module scope #35

Closed Matrikss closed 5 years ago

Matrikss commented 5 years ago

Consider the following code:

$Version = 'myversion' 
Write-Output "VERSION: $Version" 
$s3Object = Copy-S3Object -BucketName $S3AWSBucketName -Key $S3AWSDirectory/$S3FileName -LocalFolder $env:temp -AccessKey $S3AWSAccessKeyId -SecretKey $S3AWSSecretAccessKey -Force
Write-Output "VERSION: $Version"

Expected Behavior VERSION: myversion VERSION: myversion

Current Behavior VERSION: myversion VERSION:

Steps to Reproduce (for bugs) Put the code above on a .ps1 file and execute in a new Powershell console. The first execution will give the above behavior, the subsequent ones don't suffer from it. The command needs to execute correctly, doesn't show the above behavior in case of failure.

Context This broke our Infrastructure as Code framework and caused a very strange debug session to identify the cause.

Your Environment

matteo-prosperi commented 5 years ago

Hello, thanks a reporting this! This is an unwanted side effect of a ScriptsToProcess we added in 3.3.563.0. We are planning to release a fix for this issue today.

matteo-prosperi commented 5 years ago

The issue is resolved in the new version 3.3.563.1. Thank you for reporting it.