Hi, I would like to leverage deployment variables in my pipeline. The deployment variables would set things like --template-file=templates/deploytemplate.yml --stack-name stack_version_XYZ and --parameter-overrides Environment=production. This would let me reuse this block of code several times by only changing the deployment variable.
What I have tried is setting a deployment variable AWS_DEPLOY_OPTIONS to
["--template-file","templates/deploytemplate.yml","--stack-name","stack_version_XYZ"]
And used it here
- step: &deploy-cloudformation
name: Deploy to Cloudformation
oidc: true
script:
- pipe: atlassian/aws-sam-deploy:2.4.1
variables:
AWS_DEFAULT_REGION: $AWS_REGION
AWS_OIDC_ROLE_ARN: $AWS_OIDC_ROLE_ARN
EXTRA_OPTIONS_DEPLOY: $AWS_DEPLOY_OPTIONS
This does not work, I can see that none of the extra options get passed in, confirmed by this line in the output:
<span><span>INFO: ['sam', 'deploy', '--no-confirm-changeset', '--no-fail-on-empty-changeset']</span></span>
I expect the reason this is not working is because the deployment variable is stored as a string, not the list of strings that aws-sam-deploy expects
From https://bitbucket.org/atlassian/aws-sam-deploy/src/master/
Options you can provide for sam deploy command in format ['--option1=value1', '--option2', 'value2'].
Is there string/variable manipulation I can do in the pipeline to get this to work?
Something like
DEPLOY = ['${AWS_DEPLOY_OPTIONS}']or
DEPLOY = ['--template-file',$TEMPLATE_LOCATION,...etc ]
I would like to use the pipeline because it handles the OIDC for me, I tried essentially writing what aws-sam-deploy does for myself, but I had issues getting the authentication to work with OIDC