ps/Modules/Cole.PowerShell.Developer/Public/New-AWSCredentialsFile.ps1

40 lines
801 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function New-AWSCredentialsFile {
<#
.SYNOPSIS
Used to setup a new AWS Config File
#>
[CmdletBinding()]
[OutputType([void])]
param (
[Parameter(Mandatory = $true)]
$FilePath
)
$logLead = (Get-LogLeadName)
if (Test-Path $FilePath) {
throw "$logLead : Can not replace existing AWS Credentials file at [$FilePath]. Please remove the file and try again."
}
$fileContents = @"
[default]
aws_access_key_id =
aws_secret_access_key =
output=json
region=us-east-1
[temp-dev]
aws_access_key_id=
aws_secret_access_key=
aws_session_token=
[temp-prod]
aws_access_key_id=
aws_secret_access_key=
aws_session_token=
[temp-qa]
aws_access_key_id=
aws_secret_access_key=
aws_session_token=
"@
Set-Content -Path $FilePath -Value $fileContents -Force
}