aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.62k stars 3.91k forks source link

[synthetics] Support setting environment variables during canary creation #10515

Closed dlee-cpu closed 3 years ago

dlee-cpu commented 4 years ago

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

NetaNir commented 4 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.

dlee-cpu commented 4 years ago

thanks for the reply. I should have opened this as a feature request to the cloudformation canary resource rather than the cdk.

flochaz commented 3 years ago

It's now possible ( https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-synthetics-canary-runconfig.html#cfn-synthetics-canary-runconfig-environmentvariables )

dlee-cpu commented 3 years ago

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.

jonny-rimek commented 3 years ago

adding an env var looks like this:

        const cfnCanary = canary.node.defaultChild as synthetics.CfnCanary
        cfnCanary.addPropertyOverride('RunConfig.EnvironmentVariables', {
            API_URL: "someurl"
        })
github-actions[bot] commented 3 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

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.