Skip to content

Commit 39c86b3

Browse files
committed
get agent token from param store
1 parent 3cff6ac commit 39c86b3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packer/windows/conf/bin/bk-install-elastic-stack.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ If ($Env:BUILDKITE_AGENT_ENABLE_GIT_MIRRORS_EXPERIMENT -eq "true") {
7777
$Env:BUILDKITE_AGENT_GIT_MIRRORS_PATH = "C:\buildkite-agent\git-mirrors"
7878
}
7979

80+
# Get token from ssm param (if we have a path) if it's not set explicitly
81+
If (($null -eq $Env:BUILDKITE_AGENT_TOKEN -or $Env:BUILDKITE_AGENT_TOKEN -eq "") -and
82+
($null -ne $Env:BUILDKITE_AGENT_TOKEN_PATH -and $Env:BUILDKITE_AGENT_TOKEN_PATH -ne "")) {
83+
$Env:BUILDKITE_AGENT_TOKEN = $(aws ssm get-parameter --name $Env:BUILDKITE_AGENT_TOKEN_PATH --with-decryption --output text --query Parameter.Value --region $Env:AWS_REGION)
84+
}
85+
8086
$OFS=","
8187
Set-Content -Path C:\buildkite-agent\buildkite-agent.cfg -Value @"
8288
name="${Env:BUILDKITE_STACK_NAME}-${Env:INSTANCE_ID}-%n"

0 commit comments

Comments
 (0)