Skip to content

Instantly share code, notes, and snippets.

View sergiojoker11's full-sized avatar

SeRGiOJoKeR11 sergiojoker11

View GitHub Profile
@sergiojoker11
sergiojoker11 / stripe-schemas.ts
Created June 18, 2025 17:46
Stripe Schemas. Event and EventType
/* eslint-disable camelcase */
import type Stripe from 'stripe';
import { z } from 'zod';
type ValidateEventTypes<T extends ReadonlyArray<string>> = Stripe.Event['type'] extends T[number]
? T
: T & {
ERROR: `Missing Stripe event types`;
MISSING: Exclude<Stripe.Event['type'], T[number]>;
HINT: 'Add the missing types to the array above';
@sergiojoker11
sergiojoker11 / usage-stripe-webhook.tf
Last active June 5, 2025 11:54
Example of usage: Stripe Event Bridge Webhook using customm Event bus + fanout to SQS using EventBridge rules
locals {
streams_to_return = ["all-events"]
}
module "stripe_webhook" {
source = "./modules/stripe-event-bridge-webhook"
environment = var.environment
aws_region = var.aws_region
api_version = var.stripe_api_version
stripe_admin_api_key = var.stripe_admin_api_key
stripe_webhook_events = [
@sergiojoker11
sergiojoker11 / 00-stripe-webhook.tf
Last active June 5, 2025 12:08
Module: Stripe Event Bridge Webhook using custom Event bus
data "aws_caller_identity" "current" {}
locals {
aws_account_id = data.aws_caller_identity.current.account_id
update_request_payload = {
name = "event-bridge-bus-${var.environment}"
description = "Event Bridge bus ${var.environment}"
include = []
enabled_events = var.stripe_webhook_events
metadata = {