fix(cloudformation): forward Lambda environment variables during stack provisioning (#510)

This commit is contained in:
Christine Nguyen authored and GitHub committed 2026-04-17 20:29:00 -05:00
1 parent 114fade129
commit 8ac4cdcd94
2 files changed
+65

No files matched your search

@@ -244,6 +244,61 @@ class CloudFormationIntegrationTest {
.body("Configuration.FunctionName", equalTo("cfn-nocode-func"));
}
@Test
void createStack_lambdaWithEnvironmentVariables() {
String template = """
{
"Resources": {
"MyFunction": {
"Type": "AWS::Lambda::Function",
"Properties": {
"FunctionName": "cfn-env-func",
"Runtime": "nodejs20.x",
"Handler": "index.handler",
"Role": "arn:aws:iam::000000000000:role/cfn-test-lambda-role",
"Environment": {
"Variables": {
"MY_VAR": "hello",
"STAGE": "local"
}
}
}
}
}
}
""";
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "CreateStack")
.formParam("StackName", "cfn-env-stack")
.formParam("TemplateBody", template)
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<StackId>"));
given()
.contentType("application/x-www-form-urlencoded")
.formParam("Action", "DescribeStacks")
.formParam("StackName", "cfn-env-stack")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString("<StackStatus>CREATE_COMPLETE</StackStatus>"));
given()
.when()
.get("/2015-03-31/functions/cfn-env-func")
.then()
.statusCode(200)
.body("Configuration.FunctionName", equalTo("cfn-env-func"))
.body("Configuration.Environment.Variables.MY_VAR", equalTo("hello"))
.body("Configuration.Environment.Variables.STAGE", equalTo("local"));
}
@Test
void createStack_lambdaWithImageUri() {
String template = """