feat(cloudformation): provision Kinesis Firehose delivery streams (#1399)

Inject FirehoseService and add provision + delete handling for AWS::KinesisFirehose::DeliveryStream. Maps DeliveryStreamName and the S3/ExtendedS3 destination configuration (BucketARN, Prefix, BufferingHints) plus Tags. Ref returns the delivery stream name; Fn::GetAtt Arn returns the stream ARN.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-06-16 23:37:35 -05:00
1 parent ca5fb043a7
commit 17d5bb84fa
4 files changed
+144 -3

No files matched your search

@@ -0,0 +1,91 @@
package io.github.hectorvent.floci.services.cloudformation;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.config.EncoderConfig;
import io.restassured.http.ContentType;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.containsString;
/**
* End-to-end check that CloudFormation provisions an AWS::KinesisFirehose::DeliveryStream for real
* (into FirehoseService) rather than stubbing it. Delivery streams are metadata (no container), so
* the test is Docker-free.
*/
@QuarkusTest
class CloudFormationFirehoseIntegrationTest {
private static final String CFN_AUTH =
"AWS4-HMAC-SHA256 Credential=test/20260205/us-east-1/cloudformation/aws4_request";
private static final String FIREHOSE_AUTH =
"AWS4-HMAC-SHA256 Credential=test/20260205/us-east-1/firehose/aws4_request";
@Test
void createStackProvisionsDeliveryStreamVisibleToFirehose() {
String suffix = Long.toString(System.nanoTime(), 36);
String streamName = "cfn-firehose-" + suffix;
String stackName = "cfn-firehose-stack-" + suffix;
String template = """
{
"Resources": {
"Stream": {
"Type": "AWS::KinesisFirehose::DeliveryStream",
"Properties": {
"DeliveryStreamName": "%s",
"DeliveryStreamType": "DirectPut",
"S3DestinationConfiguration": {
"BucketARN": "arn:aws:s3:::my-firehose-bucket",
"RoleARN": "arn:aws:iam::000000000000:role/firehose-role",
"Prefix": "logs/"
}
}
}
},
"Outputs": {
"StreamArn": {"Value": {"Fn::GetAtt": ["Stream", "Arn"]}}
}
}
""".formatted(streamName);
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);
// Stack completes and Fn::GetAtt(Stream, Arn) resolves to the real delivery stream ARN.
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>"))
.body(containsString(":deliverystream/" + streamName));
// The delivery stream really exists in Firehose.
given()
.config(RestAssured.config().encoderConfig(EncoderConfig.encoderConfig()
.encodeContentTypeAs("application/x-amz-json-1.1", ContentType.TEXT)))
.header("Authorization", FIREHOSE_AUTH)
.header("X-Amz-Target", "Firehose_20150804.DescribeDeliveryStream")
.contentType("application/x-amz-json-1.1")
.body("{\"DeliveryStreamName\":\"" + streamName + "\"}")
.when()
.post("/")
.then()
.statusCode(200)
.body(containsString(streamName));
}
}
@@ -48,7 +48,7 @@ class CustomResourceProvisionerTest {
provisioner = new CloudFormationResourceProvisioner(
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, null, null, null, mapper, store, endpoint, null, null, null, null, null, null, null, null, null, null, null, null);
}
private CloudFormationTemplateEngine engine() {
@@ -44,7 +44,7 @@ class RdsCfnProvisionerTest {
null, null, null, null, null, null,
mapper,
null, null, null, null, null, null, null,
rdsService, null, null, null, null, null);
rdsService, null, null, null, null, null, null);
}
private CloudFormationTemplateEngine engine() {