Repository navigation
feat(infra): the deployed public-contract store, and the prod deploy role's grant (#1245) - #1246
Merged
Merged
Conversation
…role's grant (#1245) er-prod-api-contract: versioned, SSE-S3 (the public contract is public data, so no KMS grants), public access blocked, TLS-only, and release objects undeletable by bucket policy. er-ci-deploy-prod gets Get/Put on deployed/ and releases/ only, with ListBucket scoped to them so a missing baseline is a 404 the gate can call first publication. Part of #658, landed ahead of the deploy step that uses it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
athvin
marked this pull request as ready for review
November 26, 2026 00:48
Contributor
terraform plan
prod — 7 to add, 0 to changemodule.ses.data.aws_region.current: Reading...
data.aws_iam_policy_document.efs_csi_trust: Reading...
module.ses.data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.efs_csi_trust: Read complete after 0s [id=819195744]
module.eks.data.aws_iam_policy_document.cluster_trust: Reading...
data.aws_iam_policy_document.pod_trust: Reading...
module.eks.data.aws_iam_policy_document.cluster_trust: Read complete after 0s [id=1029077455]
data.aws_iam_policy_document.pod_trust: Read complete after 0s [id=819195744]
module.eks.data.aws_iam_policy_document.node_trust: Reading...
module.network.data.aws_availability_zones.available: Reading...
data.aws_rds_engine_version.aurora_pg: Reading...
data.aws_caller_identity.current: Reading...
module.network.data.aws_region.current: Reading...
module.eks.data.aws_iam_policy_document.node_trust: Read complete after 0s [id=2851119427]
data.aws_iam_openid_connect_provider.github: Reading...
data.aws_iam_policy_document.eso_trust: Reading...
module.network.data.aws_region.current: Read complete after 0s [id=us-east-2]
data.aws_iam_policy_document.eso_trust: Read complete after 0s [id=819195744]
data.aws_iam_policy_document.fluent_bit: Reading...
data.aws_iam_policy_document.fluent_bit: Read complete after 0s [id=2978074842]
module.lake.data.aws_iam_policy_document.lake_tls_only: Reading...
module.lake.data.aws_iam_policy_document.lake_tls_only: Read complete after 0s [id=81696635]
data.aws_iam_policy_document.openobserve: Reading...
data.aws_iam_policy_document.openobserve: Read complete after 0s [id=2652188337]
data.aws_caller_identity.current: Read complete after 0s [id=797781631727]
data.aws_iam_policy_document.otel_collector: Reading...
data.aws_iam_policy_document.otel_collector: Read complete after 0s [id=1193716550]
data.aws_iam_policy_document.lake_access: Reading...
data.aws_iam_policy_document.lake_access: Read complete after 0s [id=1033619361]
module.ses.data.aws_iam_policy_document.send: Reading...
module.ses.data.aws_iam_policy_document.send: Read complete after 0s [id=3767633194]
data.aws_iam_policy_document.eso: Reading...
data.aws_iam_policy_document.eso: Read complete after 0s [id=2178872705]
data.aws_rds_engine_version.aurora_pg: Read complete after 1s [id=17.9]
module.network.data.aws_availability_zones.available: Read complete after 1s [id=us-east-2]
data.aws_iam_policy_document.ci_deploy_prod: Reading...
data.aws_iam_policy_document.ci_deploy_prod: Read complete after 0s [id=2891227359]
data.aws_iam_openid_connect_provider.github: Read complete after 1s [id=arn:aws:iam::797781631727:oidc-provider/token.actions.githubusercontent.com]
data.aws_iam_policy_document.ci_deploy_prod_trust: Reading...
data.aws_iam_policy_document.ci_deploy_prod_trust: Read complete after 0s [id=4060172364]
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+ create
<= read (data resources)
Terraform will perform the following actions:
# data.aws_iam_policy_document.api_contract_bucket will be read during apply
# (config refers to values not yet known)
<= data "aws_iam_policy_document" "api_contract_bucket" {
+ id = (known after apply)
+ json = (known after apply)
+ minified_json = (known after apply)
+ statement {
+ actions = [
+ "s3:*",
]
+ effect = "Deny"
+ resources = [
+ (known after apply),
+ (known after apply),
]
+ sid = "DenyInsecureTransport"
+ condition {
+ test = "Bool"
+ values = [
+ "false",
]
+ variable = "aws:SecureTransport"
}
+ principals {
+ identifiers = [
+ "*",
]
+ type = "*"
}
}
+ statement {
+ actions = [
+ "s3:DeleteObject",
+ "s3:DeleteObjectVersion",
]
+ effect = "Deny"
+ resources = [
+ (known after apply),
]
+ sid = "DenyReleaseDeletion"
+ principals {
+ identifiers = [
+ "*",
]
+ type = "*"
}
}
}
# data.aws_iam_policy_document.ci_deploy_prod_api_contract will be read during apply
# (config refers to values not yet known)
<= data "aws_iam_policy_document" "ci_deploy_prod_api_contract" {
+ id = (known after apply)
+ json = (known after apply)
+ minified_json = (known after apply)
+ statement {
+ actions = [
+ "s3:GetObject",
+ "s3:PutObject",
]
+ effect = "Allow"
+ resources = [
+ (known after apply),
+ (known after apply),
]
}
+ statement {
+ actions = [
+ "s3:ListBucket",
]
+ effect = "Allow"
+ resources = [
+ (known after apply),
]
+ condition {
+ test = "StringLike"
+ values = [
+ "deployed/*",
+ "releases/*",
]
+ variable = "s3:prefix"
}
}
}
# aws_iam_role_policy.ci_deploy_prod_api_contract will be created
+ resource "aws_iam_role_policy" "ci_deploy_prod_api_contract" {
+ id = (known after apply)
+ name = "api-contract"
+ name_prefix = (known after apply)
+ policy = (known after apply)
+ role = "er-ci-deploy-prod"
}
# aws_s3_bucket.api_contract will be created
+ resource "aws_s3_bucket" "api_contract" {
+ acceleration_status = (known after apply)
+ acl = (known after apply)
+ arn = (known after apply)
+ bucket = "er-prod-api-contract-797781631727"
+ bucket_domain_name = (known after apply)
+ bucket_namespace = (known after apply)
+ bucket_prefix = (known after apply)
+ bucket_region = (known after apply)
+ bucket_regional_domain_name = (known after apply)
+ force_destroy = false
+ hosted_zone_id = (known after apply)
+ id = (known after apply)
+ object_lock_enabled = (known after apply)
+ policy = (known after apply)
+ region = "us-east-2"
+ request_payer = (known after apply)
+ tags_all = {
+ "Environment" = "prod"
+ "ManagedBy" = "terraform"
+ "Project" = "entity-resolution"
}
+ website_domain = (known after apply)
+ website_endpoint = (known after apply)
+ cors_rule (known after apply)
+ grant (known after apply)
+ lifecycle_rule (known after apply)
+ logging (known after apply)
+ object_lock_configuration (known after apply)
+ replication_configuration (known after apply)
+ server_side_encryption_configuration (known after apply)
+ versioning (known after apply)
+ website (known after apply)
}
# aws_s3_bucket_lifecycle_configuration.api_contract will be created
+ resource "aws_s3_bucket_lifecycle_configuration" "api_contract" {
+ bucket = (known after apply)
+ expected_bucket_owner = (known after apply)
+ id = (known after apply)
+ region = "us-east-2"
+ transition_default_minimum_object_size = "all_storage_classes_128K"
+ rule {
+ id = "noncurrent-expiry"
+ status = "Enabled"
# (1 unchanged attribute hidden)
+ abort_incomplete_multipart_upload {
+ days_after_initiation = 7
}
+ filter {
# (1 unchanged attribute hidden)
}
+ noncurrent_version_expiration {
+ noncurrent_days = 365
}
}
}
# aws_s3_bucket_policy.api_contract will be created
+ resource "aws_s3_bucket_policy" "api_contract" {
+ bucket = (known after apply)
+ id = (known after apply)
+ policy = (known after apply)
+ region = "us-east-2"
}
# aws_s3_bucket_public_access_block.api_contract will be created
+ resource "aws_s3_bucket_public_access_block" "api_contract" {
+ block_public_acls = true
+ block_public_policy = true
+ bucket = (known after apply)
+ id = (known after apply)
+ ignore_public_acls = true
+ region = "us-east-2"
+ restrict_public_buckets = true
}
# aws_s3_bucket_server_side_encryption_configuration.api_contract will be created
+ resource "aws_s3_bucket_server_side_encryption_configuration" "api_contract" {
+ bucket = (known after apply)
+ id = (known after apply)
+ region = "us-east-2"
+ rule {
+ blocked_encryption_types = (known after apply)
+ bucket_key_enabled = (known after apply)
+ apply_server_side_encryption_by_default {
+ kms_master_key_id = (known after apply)
+ sse_algorithm = "AES256"
}
}
}
# aws_s3_bucket_versioning.api_contract will be created
+ resource "aws_s3_bucket_versioning" "api_contract" {
+ bucket = (known after apply)
+ id = (known after apply)
+ region = "us-east-2"
+ versioning_configuration {
+ mfa_delete = (known after apply)
+ status = "Enabled"
}
}
Plan: 7 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ api_contract_bucket = "er-prod-api-contract-797781631727"
|
…1245) Co-Authored-By: Claude Opus 5.5 <[email protected]>
athvin
temporarily deployed
to
marketing-preview
November 26, 2026 00:58 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1245
What
infra/terraform/envs/prod/api-contract.tf:er-prod-api-contract-797781631727: versioned, SSE-S3, all public access blocked,prevent_destroy, and a 365-day noncurrent expiry;s3:DeleteObject*denied to everyone onreleases/*, so a published release record cannot be deleted;er-ci-deploy-prodgains anapi-contractinline policy:GetObjectandPutObjectondeployed/*andreleases/*only, plusListBucketconditioned to those prefixes. TheListBucketis what makes a missing baseline a 404, which the gate treats as first publication, rather than a 403, which it must treat as unreadable and refuse.SSE-S3, not KMS: the public document is public by construction (no operator route, no credential), and it is committed and served at
/api/openapi. KMS would only add the cross-stack grants #658 named as the expensive part.Why
#1245, part of #658: the API launch gate needs a durable record of what production is serving. This lands ahead of the deploy step that reads and writes it, the #929 → #556 ordering precedent, because a PR carrying both would race the infra apply against the next deploy. The owner authorized this IAM/storage change on 2026-11-25.
Proof
terraform fmt -checkandterraform validate(envs/prod): clean.make tf-static-credentials-check: clean.terraform plan (prod)comment is the change of record; it must show additions only. That is checked before merge, below.Risk & rollback
Additive: one bucket with its configuration, and one inline policy on an existing role. Nothing reads it until the follow-up deploy change. Rollback: revert, though
prevent_destroywill refuse to delete the bucket, which is the intent; empty it by hand only if it is truly unwanted.Post-merge ledger
Closed by: agent · session
Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306onMac· 2026-11-26T01:05:01Zmainis green with this change on it: merge0e72bbc3. Push runs: devcontainer 45732500830 success, frontend 45732500716 success, rust 45732500704 success, infra 45732500833 success.images: n/a. The diff is Terraform and a generated skill reference; nothing that goes into an image changed.deployconverged: n/a for the app. The change of record is the infra apply:apply (prod)succeeded withApply complete! Resources: 7 added, 0 changed, 0 destroyed., creatinger-prod-api-contract-797781631727(with public-access block, SSE, versioning, lifecycle and bucket policy) ander-ci-deploy-prod:api-contract.apply (core)andapply (dev)were no-ops.driftandkindwere already red on schedule before feat(api): typed response structs, batch 3 — reviews+merges (#1193) #1202.Specific to this change
Context — plan, discoveries, measurements, files
Plan
Discoveries
Measurements
Files