guitarrapc / GraniResource

PowerShell Desired State Configuration Resources for real production workload.
https://www.powershellgallery.com/packages/GraniResource
MIT License
44 stars 8 forks source link

cS3Content should handle region override #77

Closed guitarrapc closed 6 years ago

guitarrapc commented 6 years ago

Description

EC2 Windows Server 2016 treat default region in cS3Content. This results Instance could not access to non us-west-2 s3bucket.

Expected behavior

cS3Content could handle bucket as expected, get, set, test.

Actual behavior

cS3Content throw an exception with non-accessible s3bucket.

The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.

Reproduce

configuration InstallHoge
{
    Import-DSCResource -ModuleName GraniResource;

    Node localhost
    {
        cS3Content "HogeConfig"
        {
            S3BucketName = "your-awesome-ap-northeast-1-bucket"
            Key = ".hogeconfig"
            DestinationPath = "c:\.hogeconfig"
        }

    }
}

InstallHoge
Start-DscConfiguration -Wait -Verbose -Path .\InstallHoge -Force

Log

VERBOSE: [EC2AMAZ-0LP0P16]: LCM:  [ Start  Resource ]  [[cS3Content]HogeConfig]
VERBOSE: [EC2AMAZ-0LP0P16]: LCM:  [ Start  Test     ]  [[cS3Content]HogeConfig]
VERBOSE: [EC2AMAZ-0LP0P16]:                            [[cS3Content]HogeConfig] Invoking Amazon S3 in region 'us-west-2'
VERBOSE: [EC2AMAZ-0LP0P16]:                            [[cS3Content]HogeConfig] Invoking Amazon S3 operation 'ListObjects' in region 'us-west-2'
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
    + CategoryInfo          : NotSpecified: (:) [], CimException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-TargetResource
    + PSComputerName        : localhost

VERBOSE: [EC2AMAZ-0LP0P16]: LCM:  [ End    Test     ]  [[cS3Content]HogeConfig]  in 6.5240 seconds.
The PowerShell DSC resource '[cS3Content]Git Config' with SourceInfo '::26::9::cS3Content' threw one or more non-terminating errors while running the Test-TargetResource 
functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : localhost
guitarrapc commented 6 years ago

Currently, no -Region parameter passing when invoking AWS Tools for PowerShell.