Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

fix(cloudformation): fail the stack when Lambda S3 code cannot be read (#2650)

David231c0972b0ec
diff --git a/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java b/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java
index b76f29c1fa..62a5f4b6b3 100644
--- a/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java
+++ b/src/main/java/io/github/hectorvent/floci/config/EmulatorConfig.java
@@ -1341,6 +1341,19 @@ public interface EmulatorConfig {
@WithDefault("30")
long deletedStackRetentionSeconds();
+
+ /**
+ * Whether an {@code AWS::Lambda::Function} whose template names code in S3 that cannot be
+ * read should fall back to the built-in stub handler instead of failing the resource.
+ *
+ * <p>Defaults to {@code false}, matching real CloudFormation, which fails the resource and
+ * rolls the stack back. Set to {@code true} to restore the older behaviour for a stack that
+ * deliberately leaves Lambda packages unbuilt — note that such a stack reports
+ * {@code CREATE_COMPLETE} while serving a placeholder that returns
+ * {@code {"statusCode":200}}, so it cannot be used to verify the real function.
+ */
+ @WithDefault("false")
+ boolean allowStubLambdaCode();
}
interface AcmServiceConfig {
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java b/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java
index 9228593017..d9be15757d 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationResourceProvisioner.java
@@ -100,6 +100,7 @@ import io.github.hectorvent.floci.services.apigatewayv2.model.*;
import io.github.hectorvent.floci.services.cognito.CognitoService;
import io.github.hectorvent.floci.services.cognito.model.UserPool;
import io.github.hectorvent.floci.services.cognito.model.UserPoolClient;
+import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.docker.ContainerReachableEndpoint;
import io.github.hectorvent.floci.services.lambda.model.InvocationType;
@@ -220,6 +221,7 @@ public class CloudFormationResourceProvisioner {
// below. As types migrate, their switch cases and provisionXxx methods are removed here; the
// now-dead service deps above are cleared in the final cleanup once the switch is empty.
private final CloudFormationResourceRegistry resourceRegistry;
+ private final EmulatorConfig config;
@Inject
public CloudFormationResourceProvisioner(S3Service s3Service, SqsService sqsService,
@@ -251,7 +253,9 @@ public class CloudFormationResourceProvisioner {
FirehoseService firehoseService,
DocDbService docDbService,
CloudFrontService cloudFrontService,
- CloudFormationResourceRegistry resourceRegistry) {
+ CloudFormationResourceRegistry resourceRegistry,
+ EmulatorConfig config) {
+ this.config = config;
this.s3Service = s3Service;
this.sqsService = sqsService;
this.snsService = snsService;
@@ -2412,6 +2416,15 @@ public class CloudFormationResourceProvisioner {
reservedConcurrentExecutions);
}
+ /**
+ * Whether an unreadable explicit {@code Code} reference may fall back to the stub handler.
+ * The provisioners hand-built in unit tests carry no config; absent configuration means the
+ * documented default, which is the strict behaviour.
+ */
+ private boolean stubLambdaCodeAllowed() {
+ return config != null && config.services().cloudformation().allowStubLambdaCode();
+ }
+
private LambdaCodeSpec resolveLambdaCode(JsonNode props, CloudFormationTemplateEngine engine,
String handler, String runtime) {
if (props != null && props.has("Code")) {
@@ -2420,13 +2433,30 @@ public class CloudFormationResourceProvisioner {
String s3Bucket = codeNode.path("S3Bucket").asText(null);
String s3Key = codeNode.path("S3Key").asText(null);
if (s3Bucket != null && s3Key != null) {
+ // A template that names its code explicitly must fail if that code cannot be
+ // read, the way real CloudFormation does. Substituting the stub handler here
+ // let a stack reach CREATE_COMPLETE running code the template never referenced
+ // — or, when the handler was not "index.handler", fail with a handler error
+ // that pointed away from the real problem (issue #2648). The stub below is for
+ // a template that supplies no Code at all, which is a different case.
+ //
+ // allow-stub-lambda-code opts back in to the old fallback, for a stack that
+ // deliberately leaves its Lambda packages unbuilt and only cares about the
+ // other resources. Off by default: silently serving a placeholder is the more
+ // dangerous of the two behaviours.
try {
s3Service.getObject(s3Bucket, s3Key);
return new LambdaCodeSpec(Map.of("S3Bucket", s3Bucket, "S3Key", s3Key),
"s3:" + s3Bucket + "\n" + s3Key);
} catch (Exception e) {
- LOG.warnv("S3 code not found for Lambda ({0}/{1}), using default handler: {2}",
- s3Bucket, s3Key, e.getMessage());
+ if (!stubLambdaCodeAllowed()) {
+ throw new AwsException("ValidationError",
+ "Error occurred while GetObject. S3 Error Message: " + e.getMessage()
+ + " (bucket: " + s3Bucket + ", key: " + s3Key + ")", 400);
+ }
+ LOG.warnv("S3 code not found for Lambda ({0}/{1}), using default handler because "
+ + "floci.services.cloudformation.allow-stub-lambda-code is enabled: {2}",
+ s3Bucket, s3Key, e.getMessage());
}
}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index e95e0b093d..7f050bcf27 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -371,6 +371,9 @@ floci:
timeout-sweep-interval-seconds: 1
cloudformation:
enabled: true
+ # Fail an AWS::Lambda::Function whose S3 code cannot be read, as real CloudFormation
+ # does. Set true to fall back to the built-in stub handler instead (issue #2648).
+ allow-stub-lambda-code: false
acm:
enabled: true
validation-wait-seconds: 0
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2CfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2CfnProvisionerTest.java
index 745ea4eac9..15c3ef4867 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2CfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/ApiGatewayV2CfnProvisionerTest.java
@@ -43,7 +43,7 @@ class ApiGatewayV2CfnProvisionerTest {
null, apiGatewayV2Service, null, null, null, null, mapper,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null,
- new CloudFormationResourceRegistry(java.util.List.of()));
+ new CloudFormationResourceRegistry(java.util.List.of()), null);
Api api = new Api();
api.setApiId(API_ID);
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteIdempotencyTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteIdempotencyTest.java
index ad7498c819..9019ce5078 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteIdempotencyTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationDeleteIdempotencyTest.java
@@ -37,7 +37,7 @@ class CloudFormationDeleteIdempotencyTest {
null, null, null, null, null, null, null,
null, null, null, null, null, null, null,
null, null,
- new CloudFormationResourceRegistry(List.of()));
+ new CloudFormationResourceRegistry(List.of()), null);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEc2ProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEc2ProvisionerTest.java
index 81f8c90ee4..4ada05d9f2 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEc2ProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationEc2ProvisionerTest.java
@@ -42,7 +42,7 @@ class CloudFormationEc2ProvisionerTest {
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, mapper, null, null, null, null, null, null,
ec2Service, null, null, null, null, null, null, null,
- null, null, new CloudFormationResourceRegistry(List.of()));
+ null, null, new CloudFormationResourceRegistry(List.of()), null);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamAttachmentProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamAttachmentProvisionerTest.java
index 67e61b4f06..71caafd696 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamAttachmentProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationIamAttachmentProvisionerTest.java
@@ -54,7 +54,7 @@ class CloudFormationIamAttachmentProvisionerTest {
null, null, null, null, null, null, null,
null, null, null, null, null, null, null,
null, null,
- new CloudFormationResourceRegistry(List.of(new IamRoleCfnProvisioner(iamService))));
+ new CloudFormationResourceRegistry(List.of(new IamRoleCfnProvisioner(iamService))), null);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLegacyNameModeTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLegacyNameModeTest.java
index 07ab8ba5d4..7885418ae5 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLegacyNameModeTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaLegacyNameModeTest.java
@@ -55,7 +55,7 @@ class CloudFormationLambdaLegacyNameModeTest {
null, null, null, null, null, null, null,
null, null, null, null, null, null, null,
null, null,
- new CloudFormationResourceRegistry(List.of()));
+ new CloudFormationResourceRegistry(List.of()), null);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaMissingS3CodeIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaMissingS3CodeIntegrationTest.java
new file mode 100644
index 0000000000..c68b464c51
--- /dev/null
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaMissingS3CodeIntegrationTest.java
@@ -0,0 +1,110 @@
+package io.github.hectorvent.floci.services.cloudformation;
+
+import io.quarkus.test.junit.QuarkusTest;
+import org.junit.jupiter.api.Test;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.not;
+
+/**
+ * A stack whose Lambda names code in S3 that cannot be read must fail, the way real
+ * CloudFormation does (issue #2648). Floci used to substitute a built-in stub handler, so the
+ * stack reached CREATE_COMPLETE running code the template never referenced — and when the
+ * handler was not "index.handler" it failed with a handler error that pointed away from the
+ * real problem. Control plane only, so the test is Docker-free.
+ */
+@QuarkusTest
+class CloudFormationLambdaMissingS3CodeIntegrationTest {
+
+ static final String CFN_AUTH =
+ "AWS4-HMAC-SHA256 Credential=test/20260205/us-east-1/cloudformation/aws4_request";
+
+ static String template(String fnName, String handler) {
+ return """
+ {
+ "Resources": {
+ "Fn": {
+ "Type": "AWS::Lambda::Function",
+ "Properties": {
+ "FunctionName": "%s",
+ "Runtime": "nodejs20.x",
+ "Handler": "%s",
+ "Role": "arn:aws:iam::000000000000:role/r",
+ "Code": {"S3Bucket": "cfn-missing-code-bucket", "S3Key": "does-not-exist.zip"}
+ }
+ }
+ }
+ }
+ """.formatted(fnName, handler);
+ }
+
+ static void createStack(String stackName, String template) {
+ given()
+ .contentType("application/x-www-form-urlencoded")
+ .header("Authorization", CFN_AUTH)
+ .formParam("Action", "CreateStack")
+ .formParam("StackName", stackName)
+ .formParam("TemplateBody", template)
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200);
+ }
+
+ private static void assertStackFailed(String stackName) {
+ given()
+ .contentType("application/x-www-form-urlencoded")
+ .header("Authorization", CFN_AUTH)
+ .formParam("Action", "DescribeStacks")
+ .formParam("StackName", stackName)
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200)
+ .body(not(containsString("<StackStatus>CREATE_COMPLETE</StackStatus>")));
+ }
+
+ @Test
+ void unreadableS3CodeFailsTheStackInsteadOfDeployingAStub() {
+ String suffix = Long.toString(System.nanoTime(), 36);
+ String stackName = "cfn-missing-code-" + suffix;
+ String fnName = "missing-code-fn-" + suffix;
+
+ // "index.handler" is the stub's own handler, so before the fix this combination was the
+ // silent one: the stack completed and the function served the stub's canned response.
+ createStack(stackName, template(fnName, "index.handler"));
+
+ assertStackFailed(stackName);
+
+ // The function must not exist at all — a stub must never stand in for the real package.
+ given()
+ .when().get("/2015-03-31/functions/" + fnName)
+ .then()
+ .statusCode(404);
+ }
+
+ @Test
+ void theFailureNamesTheUnreadableCodeNotTheHandler() {
+ String suffix = Long.toString(System.nanoTime(), 36);
+ String stackName = "cfn-missing-code-msg-" + suffix;
+ String fnName = "missing-code-msg-fn-" + suffix;
+
+ // With a non-default handler the old behaviour failed with
+ // "Handler file 'src/api' not found in deployment package", which is misleading: the
+ // handler is correct and present in the real package that was never fetched.
+ createStack(stackName, template(fnName, "src/api.handler"));
+
+ given()
+ .contentType("application/x-www-form-urlencoded")
+ .header("Authorization", CFN_AUTH)
+ .formParam("Action", "DescribeStackEvents")
+ .formParam("StackName", stackName)
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200)
+ .body(containsString("does-not-exist.zip"))
+ .body(not(containsString("not found in deployment package")));
+ }
+}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaStubCodeAllowedIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaStubCodeAllowedIntegrationTest.java
new file mode 100644
index 0000000000..107f823673
--- /dev/null
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLambdaStubCodeAllowedIntegrationTest.java
@@ -0,0 +1,62 @@
+package io.github.hectorvent.floci.services.cloudformation;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.TestProfile;
+import org.junit.jupiter.api.Test;
+
+import java.util.Map;
+
+import static io.github.hectorvent.floci.services.cloudformation.CloudFormationLambdaMissingS3CodeIntegrationTest.CFN_AUTH;
+import static io.github.hectorvent.floci.services.cloudformation.CloudFormationLambdaMissingS3CodeIntegrationTest.createStack;
+import static io.github.hectorvent.floci.services.cloudformation.CloudFormationLambdaMissingS3CodeIntegrationTest.template;
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.Matchers.containsString;
+
+/**
+ * The opt-in escape hatch for issue #2648: a stack that deliberately leaves its Lambda packages
+ * unbuilt can set one property and keep the old stub-handler behaviour instead of breaking on
+ * upgrade. Off by default, because a stack that reports CREATE_COMPLETE while serving a placeholder
+ * is the more dangerous of the two behaviours.
+ *
+ * <p>A separate top-level class rather than a nested one, because {@code @TestProfile} applies per
+ * test class and Surefire discovers test classes by file name: a nested class carrying the profile
+ * compiles and passes when targeted directly, but is silently skipped in a full {@code mvn test}.
+ */
+@QuarkusTest
+@TestProfile(CloudFormationLambdaStubCodeAllowedIntegrationTest.AllowStubProfile.class)
+class CloudFormationLambdaStubCodeAllowedIntegrationTest {
+
+ public static final class AllowStubProfile implements QuarkusTestProfile {
+ @Override
+ public Map<String, String> getConfigOverrides() {
+ return Map.of("floci.services.cloudformation.allow-stub-lambda-code", "true");
+ }
+ }
+
+ @Test
+ void unreadableS3CodeFallsBackToTheStubHandler() {
+ String suffix = Long.toString(System.nanoTime(), 36);
+ String stackName = "cfn-stub-allowed-" + suffix;
+ String fnName = "stub-allowed-fn-" + suffix;
+
+ createStack(stackName, template(fnName, "index.handler"));
+
+ given()
+ .contentType("application/x-www-form-urlencoded")
+ .header("Authorization", CFN_AUTH)
+ .formParam("Action", "DescribeStacks")
+ .formParam("StackName", stackName)
+ .when()
+ .post("/")
+ .then()
+ .statusCode(200)
+ .body(containsString("<StackStatus>CREATE_COMPLETE</StackStatus>"));
+
+ // The stub stands in for the package that could not be read.
+ given()
+ .when().get("/2015-03-31/functions/" + fnName)
+ .then()
+ .statusCode(200);
+ }
+}
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLogGroupProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLogGroupProvisionerTest.java
index 57537f85b9..effd03a743 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLogGroupProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CloudFormationLogGroupProvisionerTest.java
@@ -48,7 +48,7 @@ class CloudFormationLogGroupProvisionerTest {
null, null, null, null, null, null, null,
null, null, logsService, null, null, null, null,
null, null,
- new CloudFormationResourceRegistry(List.of()));
+ new CloudFormationResourceRegistry(List.of()), null);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CustomResourceProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CustomResourceProvisionerTest.java
index fe864501f4..c75a0d9a53 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/CustomResourceProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/CustomResourceProvisionerTest.java
@@ -50,7 +50,7 @@ class CustomResourceProvisionerTest {
null, null, null, null, lambdaService, null, null, null, null, null,
null, null, null, null, null, null, mapper, store, endpoint, null, null, null, null, null, null, null, null, null, null, null, null,
null, null,
- new io.github.hectorvent.floci.services.cloudformation.provisioners.CloudFormationResourceRegistry(java.util.List.of()));
+ new io.github.hectorvent.floci.services.cloudformation.provisioners.CloudFormationResourceRegistry(java.util.List.of()), null);
}
private CloudFormationTemplateEngine engine() {
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/DynamoDbReplicaCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/DynamoDbReplicaCfnProvisionerTest.java
index 4f72b51cb6..1aab4c9d8f 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/DynamoDbReplicaCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/DynamoDbReplicaCfnProvisionerTest.java
@@ -35,7 +35,7 @@ class DynamoDbReplicaCfnProvisionerTest {
null, null, null, dynamoDbService, null, null, null, null, null, null,
null, null, null, null, null, null, mapper, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null,
- new CloudFormationResourceRegistry(List.of()));
+ new CloudFormationResourceRegistry(List.of()), null);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/DynamoDbStreamSpecificationCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/DynamoDbStreamSpecificationCfnProvisionerTest.java
index 9db11d2ed1..407e227742 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/DynamoDbStreamSpecificationCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/DynamoDbStreamSpecificationCfnProvisionerTest.java
@@ -53,7 +53,7 @@ class DynamoDbStreamSpecificationCfnProvisionerTest {
null, null, null, dynamoDbService, null, null, null, null, null, null,
null, null, null, null, null, null, mapper, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null,
- new CloudFormationResourceRegistry(List.of()));
+ new CloudFormationResourceRegistry(List.of()), null);
TableDefinition created = new TableDefinition();
created.setTableName(TABLE);
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/EventBusDeleteOwnershipTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/EventBusDeleteOwnershipTest.java
index 8aa37b1520..bdf0b8997c 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/EventBusDeleteOwnershipTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/EventBusDeleteOwnershipTest.java
@@ -46,7 +46,7 @@ class EventBusDeleteOwnershipTest {
null, null, null, null, null, null, null,
null, null, null, null, null, null, null,
null, null,
- new CloudFormationResourceRegistry(List.of()));
+ new CloudFormationResourceRegistry(List.of()), null);
}
@Test
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/EventBusProvisionOwnershipTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/EventBusProvisionOwnershipTest.java
index 150a106007..8ae60484d4 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/EventBusProvisionOwnershipTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/EventBusProvisionOwnershipTest.java
@@ -59,7 +59,7 @@ class EventBusProvisionOwnershipTest {
null, null, null, null, null, null, null,
null, null, null, null, null, null, null,
null, null,
- new CloudFormationResourceRegistry(List.of()));
+ new CloudFormationResourceRegistry(List.of()), null);
}
/**
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/RdsCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/RdsCfnProvisionerTest.java
index 5eb06aadb1..33c929b286 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/RdsCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/RdsCfnProvisionerTest.java
@@ -71,7 +71,7 @@ class RdsCfnProvisionerTest {
null, null, null, null, null, null, null,
rdsService, null, null, null, null, null, null,
null, null,
- new io.github.hectorvent.floci.services.cloudformation.provisioners.CloudFormationResourceRegistry(java.util.List.of()));
+ new io.github.hectorvent.floci.services.cloudformation.provisioners.CloudFormationResourceRegistry(java.util.List.of()), null);
}
private CloudFormationTemplateEngine engine() {
diff --git a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SecretTargetAttachmentCfnProvisionerTest.java b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SecretTargetAttachmentCfnProvisionerTest.java
index eae3de0d02..5622981cde 100644
--- a/src/test/java/io/github/hectorvent/floci/services/cloudformation/SecretTargetAttachmentCfnProvisionerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/cloudformation/SecretTargetAttachmentCfnProvisionerTest.java
@@ -71,7 +71,7 @@ class SecretTargetAttachmentCfnProvisionerTest {
null, null, null, null, null, null, null,
rdsService, null, null, null, null, null, null,
docDbService, null,
- new CloudFormationResourceRegistry(List.of()));
+ new CloudFormationResourceRegistry(List.of()), null);
}
@Test
diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml
index b4f851d89d..18d0082723 100644
--- a/src/test/resources/application.yml
+++ b/src/test/resources/application.yml
@@ -213,6 +213,9 @@ floci:
timeout-sweep-interval-seconds: 1
cloudformation:
enabled: true
+ # Fail an AWS::Lambda::Function whose S3 code cannot be read, as real CloudFormation
+ # does. Set true to fall back to the built-in stub handler instead (issue #2648).
+ allow-stub-lambda-code: false
acm:
enabled: true
validation-wait-seconds: 0