Skip to content

Commit 005ebfa

Browse files
author
James Healy
authored
Merge pull request #762 from plentiau/windows-get-token-from-ssm
Retreive agent token from param store on windows agents
2 parents 857e3f7 + 82fda1e commit 005ebfa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ 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)
81+
If ($null -ne $Env:BUILDKITE_AGENT_TOKEN_PATH -and $Env:BUILDKITE_AGENT_TOKEN_PATH -ne "") {
82+
$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)
83+
}
84+
8085
$OFS=","
8186
Set-Content -Path C:\buildkite-agent\buildkite-agent.cfg -Value @"
8287
name="${Env:BUILDKITE_STACK_NAME}-${Env:INSTANCE_ID}-%n"

0 commit comments

Comments
 (0)