I am clearly not understanding how dynamic parameters can be used when deploying a template in CodePipeline. Here is the basic scenario:
CodeBuild BUILD Action - Here I have retrieved, for instance, a value for COMMIT_NUMBER. This can be set as an environment variable, or saved to a file... whatever needs to be done. In a post_build step I package up the template using "sam package ...."
CloudFormation DEPLOY stage - Here I use
new codepipeline_actions.CloudFormationCreateUpdateStackAction({
actionName: `The_Deploy`,
templatePath: buildOutput.atPath(TEMPLATE_FILE_NAME),
parameterOverrides, --These are known when I synth the pipeline
stackName: envStackName,
cfnCapabilities: [CfnCapabilities.AUTO_EXPAND, CfnCapabilities.ANONYMOUS_IAM],
adminPermissions: true,
role: buildRole,
runOrder: runOrder || 1
});
to deploy the template that was packaged up. In the props for this method, there is a parameterOverrides property, but anything in there would have to be known at build time.
My question is HOW do i set dynamic parameter values that are known in the build step, to the parameters consumed by the deploy step.
Thanks for any clarification!
Thank you @Ronan Cunningham, for the link : here. The KEY point that clarified how to do this was this sentence below, that I have not found explained well otherwise:
To bring it all together here are the key pieces that allowed me to set an environment variable in the codebuild action and pass it to a cloudformation parameter IN CDK:
1.) add env variable and export variable in the build project
2.) Add namespace to the build action:
3.) In the deployment stage, I can now set the ParameterOverride by setting the parameter name to the environment variable that was exported in the build step:
Hallelujah!
And, thanks again to Ronan for the informative link!