Closed dlee-cpu closed 3 years ago
It does not seem like it is possible to configure the environment variable using Canary CloudFormation resource. When creating a Canary the synthetics service creates a lambda function on your behalf, the lambda resource itself is not created via CloudFormation, so if the Canary resource does not expose these properties on its API there is no (easy) way to change them using the resource.
thanks for the reply. I should have opened this as a feature request to the cloudformation canary resource rather than the cdk.
It's now possible ( https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-runconfig.html#cfn-synthetics-canary-runconfig-environmentvariables )
thanks for keeping me in the loop and constantly improving the developer experience.
adding an env var looks like this:
const cfnCanary = canary.node.defaultChild as synthetics.CfnCanary
cfnCanary.addPropertyOverride('RunConfig.EnvironmentVariables', {
API_URL: "someurl"
})
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Support setting environment variables during canary creation
Use Case
Since the canary is wrapped by a lambda, we should be able to create env variables that are available during the lambda execution so we can pass additional runtime information during test runs.
Proposed Solution
Other
This is a :rocket: Feature Request