このGistの内容は随時更新します。
- 2021/6/29 時点 : Windows 11 Pro 21H2 (Build 22000.51)
- Insider preview から更新
| terraform { | |
| required_version = "~> 1.2.0" | |
| required_providers { | |
| aws = { | |
| source = "hashicorp/aws" | |
| version = "~> 4.15.1" | |
| } | |
| } | |
| } |
| # CloudShell の $Profile に仕込む想定 | |
| if ($env:AWS_EXECUTION_ENV -eq 'CloudShell') { | |
| $moduleBase = (Get-Module AWSPowerShell.NetCore -ListAvailable).ModuleBase | |
| if ($null -ne $moduleBase) { | |
| $modulePath = Split-Path -Parent $moduleBase | |
| if (Test-Path $modulePath) { sudo rm -rf $modulePath } | |
| } | |
| } |
| function Get-StringHash { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter(ValueFromPipeline=$true)] | |
| [string]$InputValue, | |
| [ValidateSet('MD5', 'SHA1', 'SHA256', 'SHA384', 'SHA512')] | |
| [string]$Algorithm = 'SHA256', | |
| [switch]$ToUpperCase | |
| ) | |
| begin { |
| FROM python:3.10.0-alpine | |
| RUN pip3 install awscli --upgrade --no-cache-dir | |
| ENTRYPOINT [ "/usr/local/bin/aws" ] |
| function Install-LatestWinGet ([switch]$SkipInstallVCLibs) { | |
| # Install prerequisites | |
| if (-not $SkipInstallVCLibs) { | |
| $vcLibsUrl = 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx' | |
| Write-Host -ForegroundColor Green "Download $vcLibsUrl" | |
| Add-AppxPackage -Path $vcLibsUrl | |
| } | |
| # Find the latest assets url | |
| $latest = Invoke-RestMethod -Uri 'https://api.github.com/repos/microsoft/winget-cli/releases/latest' |
| data "aws_caller_identity" "current" {} | |
| // System name settings | |
| variable "sysname" { | |
| type = string | |
| default = "mysgw" | |
| } | |
| variable "envname" { | |
| type = string | |
| default = "dev" |
| # | |
| # CloudFormation Rain Docker image | |
| # | |
| # How to build: | |
| # docker build -t aws-cfn-rain . | |
| # How to use (e.g. docker run from PowerShell host): | |
| # docker run --rm -it -v "$HOME/.aws/:/root/.aws" -v "$($pwd.Path):/aws" -e AWS_PROFILE aws-cfn-rain --version | |
| # docker run --rm -it -v "$HOME/.aws/:/root/.aws" -v "$($pwd.Path):/aws" -e AWS_PROFILE aws-cfn-rain deploy ./sample.yaml | |
| # | |
| FROM amazon/aws-cli:latest |
| function Set-AWSCredentialWithRegion { | |
| [CmdletBinding()] | |
| param ( | |
| [string]$ProfileName | |
| ) | |
| # Invoke Set-AWSCredential first | |
| Write-Verbose "Invoke Set-AWSCredential -ProfileName $ProfileName " | |
| Set-AWSCredential -ProfileName $ProfileName -Scope Global | |
| if (-not $StoredAWSCredentials) { |