Repository navigation
fix(iac/aws): create_before_destroy on OIDC signing key (follow-up to #1480) - #1512
Conversation
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 33 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTerraform now creates a replacement signing KMS key before destroying the existing key by enabling ChangesKMS Signing Key Replacement
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…1480) #1480 migrated aws_kms_key.signing from RSA_2048 to ECC_NIST_P256, which forces a KMS key replacement. Terraform's default destroy-before-create schedules the live signing key for deletion (immediately unusable for kms:Sign) before the new EC key exists, briefly breaking OIDC client-assertion JWT minting on deploy. Add lifecycle { create_before_destroy = true } so the new key is created and the alias cut over before the old key is scheduled for deletion. GCP crypto keys are versioned (no gap) and Azure Key Vault soft-delete keeps the old key recoverable, so only the AWS KMS key needs this.
2fb8e80 to
b01b9d6
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
✅ Ready for human merge.
Held for your merge (infra / security-adjacent). |
…rant (#1514) Follow-up to #1496. That PR fixed KMSMutateTaggedOnly in policy_compute.tf to use StringEqualsIgnoreCase after discovering the OIDC signing key is tagged Project=cudly (lowercase, from local.common_tags / var.project_name), which overrides the provider default_tags value CUDly and never matched a case-sensitive StringEquals "CUDly". KMSReadTaggedOnly in policy_compute_b.tf gates the deploy role's only grant for kms:GetKeyPolicy on the same tag with case-sensitive StringEquals, so it does not match the signing key either. The AWS provider reads the key policy on every aws_kms_key refresh, so the deploy role hits AccessDenied on kms:GetKeyPolicy when refreshing or replacing the signing key, blocking the RSA to ECC replace that #1496/#1512 exist to support. Switch KMSReadTaggedOnly to StringEqualsIgnoreCase for consistency with KMSMutateTaggedOnly. terraform validate passes.
Follow-up to #1480
#1480 migrated
aws_kms_key.signing(OIDC issuer signing key) fromRSA_2048toECC_NIST_P256(ES256). KMS cannot change a key spec in place, so Terraform must replace the key.Terraform's default destroy-before-create would
ScheduleKeyDeletionon the live signing key (immediately unusable forkms:Sign) before the new EC key exists — briefly breaking OIDC client-assertion JWT minting (Azure AD federation) on deploy.Change
Adds
lifecycle { create_before_destroy = true }toaws_kms_key.signingso the new key is created and the alias cut over before the old key is scheduled for deletion. The alias updates in place (no replace), so it needs no change.Scoped to AWS only: GCP crypto keys are versioned (algorithm change adds a version, no gap) and Azure Key Vault soft-delete keeps the old key recoverable.
terraform fmt+validateclean.Refs #1480, #1496.
Summary by CodeRabbit