Skip to main content

AWS with Terraform

terraform/aws/delve-partner creates the partner side of a Delve integration in your AWS account. Nothing in it runs at Patternode, and no secret value is in it: values are put by a person (playbook, stage 5).

ResourceIs
aws_kms_keyEncrypts the secrets, the shard store and the queues
aws_secretsmanager_secret.live_key, .webhook_secretThe key vault. The webhook secret is JSON {"current", "previous"} for rotation
aws_s3_bucket.shardsThe shard store: private, versioned, encrypted, noncurrent versions expire
aws_lambda_function.receiver with a Function URLThe webhook receiver; concurrency capped at 5
aws_dynamodb_table.seenwebhook-ids seen, with a TTL
aws_sqs_queue.events, .dlqVerified events for your workers; failures land in the dead-letter queue
aws_iam_policy.ingestWhat your ingest workloads may do, attached to the roles you name

Parameters​

VariableDefaultEffect
namerequiredPrefix for every resource
ingest_role_arns[]Roles that get the ingest policy
shard_retention_days30Days noncurrent segment versions are kept
dedupe_ttl_hours48How long a webhook-id is remembered
tags{}Added to everything

Apply​

cd terraform/aws/delve-partner
cp examples.tfvars prod.tfvars # edit
terraform init
terraform plan -var-file=prod.tfvars
terraform apply -var-file=prod.tfvars
terraform output webhook_url

Verify​

CheckExpect
curl -X POST "$(terraform output -raw webhook_url)" -d '{}'400 invalid: an unsigned delivery is refused
A test job with your staging keyA message on the events queue, the webhook-id in the table
aws s3api get-public-access-block --bucket "$(terraform output -raw shard_bucket)"Every setting true

Failure modes​

SymptomCauseFix
Every delivery 400Secret not put, or put as a plain stringPut {"current": "whsec_..."}
Deliveries 400 after a rotationOnly the new secret storedStore the old one as previous
Messages on the dead-letter queueYour worker fails on themRead one, fix the worker, redrive