Build my AWS stacks from CloudFormation templates. Some stacks produce outputs for example security keys and/or endpoints. For example, my analytics stack creates a user for analytics API server and makes a couple of AWS keys: CubeJsUserAccessKey and CubeJsUserSecretAccessKey.
Outputs:
Endpoint:
Description: Endpoint
Value: !Join ['', ['https://', !Ref DNSRecord]]
CubeJsUserAccessKey:
Description: "CubeJS user stagin access key id"
Value: !Ref CubeJsUserAccessKey
Export:
Name:
Fn::Sub: "${AWS::StackName}-cubejs-access-id"
CubeJsUserSecretAccessKey:
Description: "CubeJS user access key id"
Value: !GetAtt
- CubeJsUserAccessKey
- CubeJsSecretAccessKey
This works great. Now, I am using GitHub Actions. I would like to be able to reference those things in my pipelines like secrets.
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: analytics-staging
IMAGE_TAG: latest
NODE_ENV: staging
AWS_ACCESS_KEY_ID: ${{ stack-name.outputs.CubeJsUserAccessKey }}
AWS_SECRET_ACCESS_KEY: ${{ stack-name.outputs.CubeJsSecretAccessKey }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
I understand that this can be done with steps.{step-id}. However, I don't want to have to switch to terraform or delete-stack and create-stack, when there is a perfectly working stack that needs only a task definition update.
Say that the stack already exists. I only build and tag the container from the pipeline. To build the container, I need the output values. Can I easily retrieve AWS stack outputs using some plugin or something?