Skip to content

fix(review): drop the plan input cap and tell the model it has the whole plan - #147

Merged
Alexanderamiri merged 1 commit into
mainfrom
fix/review-truncation
Oct 24, 2026
Merged

Alexanderamiri merged 1 commit into
mainfrom
fix/review-truncation

Conversation

@Alexanderamiri

Copy link
Copy Markdown
Member

Why

Reviews kept saying "Plan is truncated; the remaining changes ... could not be reviewed". Where the input was actually cut:

Reviews Cut by Real?
#134, #135 (14:14, 14:31), #137, #138, #139 on 2026-10-23, before #141 merged at 15:43 the old 80k cut in review-plan.py yes. These include the quoted "other roles, Lambdas, or networking" review (#135, 14:31)
#135 on 2026-10-24 09:53 (run 40083680062) #141's 400k cap: the plan was 830k chars, 231 destroys (destroy diffs print every attribute) yes. The model saw 28 of 231 changes and correctly said so
#145 (2026-10-24 09:25, 09:40), #146, app reviews (cupcake#258, frosting#249/#250) none no truncation claims

Ruled out:

  • (a) The PR comment's 60k cut: the review reads plan-output.txt itself. The cut was silent to humans, though, so the comment now says when it is cut.
  • (b) run-plan.sh writes the full -no-color output with no head/tail.
  • (c) platform-ci reviews terraform/platform/plan-output.txt, the full file.
  • (e) No reviews hit max_tokens. Converse is still called without inferenceConfig (no maxTokens set, on purpose), but a stopReason: max_tokens answer is now discarded instead of trusted.
  • (f) The Lambda reads the whole S3 object.

What changed

  • scripts/review-plan.py: no default input cap. The whole plan goes to Haiku 5.5, which has a 1M-token context. REVIEW_MAX_PLAN_CHARS still turns on the existing notice + change-list mode if it is set.
  • The prompt now opens with COMPLETE PLAN (change count + the Plan: line) and says not to call the plan truncated. It also explains that Terraform hides parts of every plan by design: # (N unchanged attributes/blocks/elements hidden), (sensitive value), (known after apply) and partial jsonencode diffs are not truncation.
  • stopReason == "max_tokens" → returns None. Platform CI records FAILED; the Lambda retries.
  • scripts/post-plan-comment.sh: adds a notice when the plan is cut at 60k (GitHub's comment limit) and keeps the cut-off point configurable.
  • Docs: docs/ci-workflow.md.

Trade-off: a plan larger than the model's context now fails the review (FAILED, override available) instead of being cut.

Checks

  • python3 -m unittest discover -s scripts/tests: 38 OK. New tests: the complete-plan declaration, the elision markers, no default cap (2M-char plan), an 830k destroy plan sent whole, max_tokens discarded, and the comment cut notice.
  • python3 -m unittest discover -s terraform/lambda-src/tests: 63 OK. New tests: COMPLETE PLAN reaches Bedrock, and a max_tokens answer is retried.
  • terraform fmt -check -recursive terraform: OK. shellcheck scripts/post-plan-comment.sh: OK. No workflow changes.

🤖 Generated with Claude Code

…ole plan

The 400k-char cap from #141 still cut real plans: PR #135's 231-destroy plan
(830k chars, destroy diffs print every attribute) reached the model as 28 of
231 changes. Every other "plan is truncated" review was from before #141 (80k
cut). Haiku 5.5 has a 1M-token context, so there is no default input cap now;
REVIEW_MAX_PLAN_CHARS can still opt into one.

The prompt now states the plan is complete (with its change count and Plan:
line) and explains Terraform's own elision markers so they are not reported
as truncation. A max_tokens stopReason discards the answer. The PR comment
says when its 60k plan excerpt is cut.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Alexanderamiri
Alexanderamiri requested a review from a team as a code owner October 24, 2026 10:00
@github-actions

Copy link
Copy Markdown

Terraform Plan

🚧 Changes detected — Plan: 0 to add, 3 to change, 231 to destroy.

Plan output
Acquiring state lock. This may take a few moments...
aws_ssm_parameter.atlassian_org_id: Refreshing state... [id=/javabin/platform/atlassian-org-id]
aws_ssm_parameter.atlassian_api_key: Refreshing state... [id=/javabin/platform/atlassian-api-key]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place
  - destroy

Terraform will perform the following actions:

  # module.iam.aws_iam_policy.team_guardrails["cake"] will be destroyed
  # (because key ["cake"] is not in for_each map)
  - resource "aws_iam_policy" "team_guardrails" {
      - arn              = "arn:aws:iam::553637109631:policy/javabin-team-cake-guardrails" -> null
      - attachment_count = 0 -> null
      - description      = "Developer boundary rules for team cake, for its Identity Center permission set" -> null
      - id               = "arn:aws:iam::553637109631:policy/javabin-team-cake-guardrails" -> null
      - name             = "javabin-team-cake-guardrails" -> null
      - path             = "/" -> null
      - policy           = jsonencode(
            {
              - Statement = [
                  - {
                      - Action   = "*"
                      - Effect   = "Allow"
                      - Resource = "*"
                      - Sid      = "Allow"
                    },
                  - {
                      - Action   = [
                          - "iam:DeletePolicy",
                          - "iam:DeletePolicyVersion",
                          - "iam:CreatePolicyVersion",
                          - "iam:SetDefaultPolicyVersion",
                          - "iam:CreatePolicy",
                          - "iam:TagPolicy",
                          - "iam:UntagPolicy",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:iam::553637109631:policy/javabin-developer-boundary",
                          - "arn:aws:iam::553637109631:policy/javabin-team-*-guardrails",
                        ]
                      - Sid      = "DenyBndMod"
                    },
                  - {
                      - Action    = [
                          - "iam:CreateRole",
                          - "iam:PutRolePermissionsBoundary",
                        ]
                      - Condition = {
                          - StringNotEquals = {
                              - "iam:PermissionsBoundary" = "arn:aws:iam::553637109631:policy/javabin-developer-boundary"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyNoBnd"
                    },
                  - {
                      - Action   = "iam:DeleteRolePermissionsBoundary"
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyStripBnd"
                    },
                  - {
                      - Action   = [
                          - "iam:CreateUser",
                          - "iam:CreateLoginProfile",
                          - "iam:UpdateLoginProfile",
                          - "iam:CreateAccessKey",
                          - "iam:DeactivateMFADevice",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyIAMUsers"
                    },
                  - {
                      - Action   = [
                          - "organizations:*",
                          - "sso:*",
                          - "sso-directory:*",
                          - "identitystore:*",
                          - "account:*",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyOrgSSO"
                    },
                  - {
                      - Action   = [
                          - "ec2:CreateVpc",
                          - "ec2:DeleteVpc",
                          - "ec2:ModifyVpcAttribute",
                          - "ec2:CreateSubnet",
                          - "ec2:DeleteSubnet",
                          - "ec2:CreateInternetGateway",
                          - "ec2:DeleteInternetGateway",
                          - "ec2:AttachInternetGateway",
                          - "ec2:DetachInternetGateway",
                          - "ec2:CreateNatGateway",
                          - "ec2:DeleteNatGateway",
                          - "ec2:CreateRouteTable",
                          - "ec2:DeleteRouteTable",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyNetwork"
                    },
                  - {
                      - Action   = [
                          - "ecs:DeleteCluster",
                          - "ecs:UpdateCluster",
                          - "elasticloadbalancing:DeleteLoadBalancer",
                          - "elasticloadbalancing:ModifyLoadBalancerAttributes",
                          - "s3:DeleteBucket",
                          - "s3:PutBucketPolicy",
                          - "s3:DeleteBucketPolicy",
                          - "s3:PutBucketVersioning",
                          - "s3:PutEncryptionConfiguration",
                          - "dynamodb:DeleteTable",
                          - "dynamodb:UpdateTable",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:ecs:eu-central-1:553637109631:cluster/javabin-platform",
                          - "arn:aws:elasticloadbalancing:eu-central-1:553637109631:loadbalancer/app/javabin-*",
                          - "arn:aws:s3:::javabin-terraform-*",
                          - "arn:aws:s3:::javabin-ci-*",
                          - "arn:aws:dynamodb:eu-central-1:553637109631:table/javabin-terraform-*",
                        ]
                      - Sid      = "DenyPlatInfra"
                    },
                  - {
                      - Action   = [
                          - "guardduty:*",
                          - "securityhub:*",
                          - "config:*",
                          - "cloudtrail:*",
                          - "bedrock:Invoke*",
                          - "bedrock:Converse*",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenySecSvcs"
                    },
                  - {
                      - Action      = "*"
                      - Condition   = {
                          - Null            = {
                              - "aws:ResourceTag/team" = "false"
                            }
                          - StringNotEquals = {
                              - "aws:ResourceTag/team" = [
                                  - "cake",
                                  - "shared",
                                ]
                            }
                        }
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:s3:::javabin-terraform-state-553637109631",
                          - "arn:aws:s3:::javabin-terraform-state-553637109631/*",
                          - "arn:aws:dynamodb:eu-central-1:553637109631:table/javabin-terraform-app-locks",
                          - "arn:aws:s3:::javabin-ci-plan-artifacts-553637109631",
                          - "arn:aws:s3:::javabin-ci-plan-artifacts-553637109631/*",
                        ]
                      - Sid         = "DenyXTeam"
                    },
                  - {
                      - Action    = [
                          - "ec2:Delete*",
                          - "ec2:Modify*",
                          - "elasticloadbalancing:Delete*",
                          - "elasticloadbalancing:Modify*",
                          - "ecs:DeleteCluster",
                          - "ecs:UpdateCluster",
                          - "ecs:UpdateClusterSettings",
                          - "iam:DeleteRole",
                          - "iam:UpdateRole",
                          - "iam:DeleteRolePolicy",
                          - "iam:UpdateAssumeRolePolicy",
                          - "iam:PutRolePolicy",
                          - "iam:AttachRolePolicy",
                          - "iam:DetachRolePolicy",
                          - "route53:DeleteHostedZone",
                          - "sns:DeleteTopic",
                          - "sns:SetTopicAttributes",
                          - "ec2:AuthorizeSecurityGroup*",
                          - "ec2:RevokeSecurityGroup*",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "aws:ResourceTag/team" = "shared"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyShared"
                    },
                  - {
                      - Action    = [
                          - "ec2:DeleteTags",
                          - "ec2:CreateTags",
                          - "ecs:TagResource",
                          - "ecs:UntagResource",
                          - "elasticloadbalancing:AddTags",
                          - "elasticloadbalancing:RemoveTags",
                          - "iam:TagRole",
                          - "iam:UntagRole",
                          - "sns:TagResource",
                          - "sns:UntagResource",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "aws:ResourceTag/team" = [
                                  - "shared",
                                  - "platform",
                                ]
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyTagStrip"
                    },
                  - {
                      - Action   = [
                          - "ssm:GetParameter*",
                          - "ssm:GetParametersByPath",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:ssm:*:*:parameter/javabin/platform/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/slack/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/platform-overrides/*",
                        ]
                      - Sid      = "DenyPlatSSM"
                    },
                  - {
                      - Action      = "iam:PassRole"
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:iam::*:role/cake-*",
                          - "arn:aws:iam::*:role/javabin-ecs-exec-cake",
                        ]
                      - Sid         = "DenyPassRole"
                    },
                  - {
                      - Action      = [
                          - "logs:GetLogEvents",
                          - "logs:FilterLogEvents",
                          - "logs:StartQuery",
                          - "logs:GetQueryResults",
                        ]
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:logs:*:*:log-group:/ecs/cake/*",
                          - "arn:aws:logs:*:*:log-group:/ecs/cake/*:*",
                        ]
                      - Sid         = "DenyXLogs"
                    },
                  - {
                      - Action   = [
                          - "iam:PutRolePolicy",
                          - "iam:DeleteRolePolicy",
                          - "iam:AttachRolePolicy",
                          - "iam:DetachRolePolicy",
                          - "iam:DeleteRole",
                          - "iam:UpdateRole",
                          - "iam:UpdateAssumeRolePolicy",
                        ]
                      - Effect   = "Deny"
                      - Resource = "arn:aws:iam::553637109631:role/javabin-ci-*"
                      - Sid      = "DenyModCI"
                    },
                  - {
                      - Action    = "ec2:CreateSecurityGroup"
                      - Condition = {
                          - StringNotEqualsIfExists = {
                              - "aws:RequestTag/team" = "cake"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyNoTag"
                    },
                  - {
                      - Action      = [
                          - "s3:CreateBucket",
                          - "dynamodb:CreateTable",
                          - "sqs:CreateQueue",
                          - "sns:CreateTopic",
                          - "rds:CreateDBInstance",
                          - "rds:CreateDBSubnetGroup",
                          - "ecs:CreateService",
                          - "ecs:RegisterTaskDefinition",
                          - "ecr:CreateRepository",
                          - "logs:CreateLogGroup",
                          - "ssm:PutParameter",
                          - "lambda:CreateFunction",
                          - "events:PutRule",
                          - "states:CreateStateMachine",
                        ]
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:s3:::cake-*",
                          - "arn:aws:dynamodb:*:*:table/cake-*",
                          - "arn:aws:sqs:*:*:cake-*",
                          - "arn:aws:sns:*:*:cake-*",
                          - "arn:aws:rds:*:*:db:cake-*",
                          - "arn:aws:rds:*:*:subgrp:cake-*",
                          - "arn:aws:ecs:*:*:service/*/cake-*",
                          - "arn:aws:ecs:*:*:task-definition/cake-*:*",
                          - "arn:aws:ecr:*:*:repository/cake-*",
                          - "arn:aws:logs:*:*:log-group:/ecs/cake/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/apps/cake/*",
                          - "arn:aws:lambda:*:*:function:cake-*",
                          - "arn:aws:events:*:*:rule/cake-*",
                          - "arn:aws:states:*:*:stateMachine:cake-*",
                        ]
                      - Sid         = "DenyBadName"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - policy_id        = "ANPAYBZ2X3572ELDCKZ77" -> null
      - tags             = {
          - "Name"     = "javabin-team-cake-guardrails"
          - "for-team" = "cake"
          - "team"     = "shared"
        } -> null
      - tags_all         = {
          - "Name"        = "javabin-team-cake-guardrails"
          - "environment" = "production"
          - "for-team"    = "cake"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "shared"
        } -> null
    }

  # module.iam.aws_iam_policy.team_guardrails["commandchimps"] will be destroyed
  # (because key ["commandchimps"] is not in for_each map)
  - resource "aws_iam_policy" "team_guardrails" {
      - arn              = "arn:aws:iam::553637109631:policy/javabin-team-commandchimps-guardrails" -> null
      - attachment_count = 0 -> null
      - description      = "Developer boundary rules for team commandchimps, for its Identity Center permission set" -> null
      - id               = "arn:aws:iam::553637109631:policy/javabin-team-commandchimps-guardrails" -> null
      - name             = "javabin-team-commandchimps-guardrails" -> null
      - path             = "/" -> null
      - policy           = jsonencode(
            {
              - Statement = [
                  - {
                      - Action   = "*"
                      - Effect   = "Allow"
                      - Resource = "*"
                      - Sid      = "Allow"
                    },
                  - {
                      - Action   = [
                          - "iam:DeletePolicy",
                          - "iam:DeletePolicyVersion",
                          - "iam:CreatePolicyVersion",
                          - "iam:SetDefaultPolicyVersion",
                          - "iam:CreatePolicy",
                          - "iam:TagPolicy",
                          - "iam:UntagPolicy",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:iam::553637109631:policy/javabin-developer-boundary",
                          - "arn:aws:iam::553637109631:policy/javabin-team-*-guardrails",
                        ]
                      - Sid      = "DenyBndMod"
                    },
                  - {
                      - Action    = [
                          - "iam:CreateRole",
                          - "iam:PutRolePermissionsBoundary",
                        ]
                      - Condition = {
                          - StringNotEquals = {
                              - "iam:PermissionsBoundary" = "arn:aws:iam::553637109631:policy/javabin-developer-boundary"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyNoBnd"
                    },
                  - {
                      - Action   = "iam:DeleteRolePermissionsBoundary"
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyStripBnd"
                    },
                  - {
                      - Action   = [
                          - "iam:CreateUser",
                          - "iam:CreateLoginProfile",
                          - "iam:UpdateLoginProfile",
                          - "iam:CreateAccessKey",
                          - "iam:DeactivateMFADevice",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyIAMUsers"
                    },
                  - {
                      - Action   = [
                          - "organizations:*",
                          - "sso:*",
                          - "sso-directory:*",
                          - "identitystore:*",
                          - "account:*",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyOrgSSO"
                    },
                  - {
                      - Action   = [
                          - "ec2:CreateVpc",
                          - "ec2:DeleteVpc",
                          - "ec2:ModifyVpcAttribute",
                          - "ec2:CreateSubnet",
                          - "ec2:DeleteSubnet",
                          - "ec2:CreateInternetGateway",
                          - "ec2:DeleteInternetGateway",
                          - "ec2:AttachInternetGateway",
                          - "ec2:DetachInternetGateway",
                          - "ec2:CreateNatGateway",
                          - "ec2:DeleteNatGateway",
                          - "ec2:CreateRouteTable",
                          - "ec2:DeleteRouteTable",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyNetwork"
                    },
                  - {
                      - Action   = [
                          - "ecs:DeleteCluster",
                          - "ecs:UpdateCluster",
                          - "elasticloadbalancing:DeleteLoadBalancer",
                          - "elasticloadbalancing:ModifyLoadBalancerAttributes",
                          - "s3:DeleteBucket",
                          - "s3:PutBucketPolicy",
                          - "s3:DeleteBucketPolicy",
                          - "s3:PutBucketVersioning",
                          - "s3:PutEncryptionConfiguration",
                          - "dynamodb:DeleteTable",
                          - "dynamodb:UpdateTable",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:ecs:eu-central-1:553637109631:cluster/javabin-platform",
                          - "arn:aws:elasticloadbalancing:eu-central-1:553637109631:loadbalancer/app/javabin-*",
                          - "arn:aws:s3:::javabin-terraform-*",
                          - "arn:aws:s3:::javabin-ci-*",
                          - "arn:aws:dynamodb:eu-central-1:553637109631:table/javabin-terraform-*",
                        ]
                      - Sid      = "DenyPlatInfra"
                    },
                  - {
                      - Action   = [
                          - "guardduty:*",
                          - "securityhub:*",
                          - "config:*",
                          - "cloudtrail:*",
                          - "bedrock:Invoke*",
                          - "bedrock:Converse*",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenySecSvcs"
                    },
                  - {
                      - Action      = "*"
                      - Condition   = {
                          - Null            = {
                              - "aws:ResourceTag/team" = "false"
                            }
                          - StringNotEquals = {
                              - "aws:ResourceTag/team" = [
                                  - "commandchimps",
                                  - "shared",
                                ]
                            }
                        }
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:s3:::javabin-terraform-state-553637109631",
                          - "arn:aws:s3:::javabin-terraform-state-553637109631/*",
                          - "arn:aws:dynamodb:eu-central-1:553637109631:table/javabin-terraform-app-locks",
                          - "arn:aws:s3:::javabin-ci-plan-artifacts-553637109631",
                          - "arn:aws:s3:::javabin-ci-plan-artifacts-553637109631/*",
                        ]
                      - Sid         = "DenyXTeam"
                    },
                  - {
                      - Action    = [
                          - "ec2:Delete*",
                          - "ec2:Modify*",
                          - "elasticloadbalancing:Delete*",
                          - "elasticloadbalancing:Modify*",
                          - "ecs:DeleteCluster",
                          - "ecs:UpdateCluster",
                          - "ecs:UpdateClusterSettings",
                          - "iam:DeleteRole",
                          - "iam:UpdateRole",
                          - "iam:DeleteRolePolicy",
                          - "iam:UpdateAssumeRolePolicy",
                          - "iam:PutRolePolicy",
                          - "iam:AttachRolePolicy",
                          - "iam:DetachRolePolicy",
                          - "route53:DeleteHostedZone",
                          - "sns:DeleteTopic",
                          - "sns:SetTopicAttributes",
                          - "ec2:AuthorizeSecurityGroup*",
                          - "ec2:RevokeSecurityGroup*",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "aws:ResourceTag/team" = "shared"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyShared"
                    },
                  - {
                      - Action    = [
                          - "ec2:DeleteTags",
                          - "ec2:CreateTags",
                          - "ecs:TagResource",
                          - "ecs:UntagResource",
                          - "elasticloadbalancing:AddTags",
                          - "elasticloadbalancing:RemoveTags",
                          - "iam:TagRole",
                          - "iam:UntagRole",
                          - "sns:TagResource",
                          - "sns:UntagResource",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "aws:ResourceTag/team" = [
                                  - "shared",
                                  - "platform",
                                ]
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyTagStrip"
                    },
                  - {
                      - Action   = [
                          - "ssm:GetParameter*",
                          - "ssm:GetParametersByPath",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:ssm:*:*:parameter/javabin/platform/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/slack/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/platform-overrides/*",
                        ]
                      - Sid      = "DenyPlatSSM"
                    },
                  - {
                      - Action      = "iam:PassRole"
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:iam::*:role/commandchimps-*",
                          - "arn:aws:iam::*:role/javabin-ecs-exec-commandchimps",
                        ]
                      - Sid         = "DenyPassRole"
                    },
                  - {
                      - Action      = [
                          - "logs:GetLogEvents",
                          - "logs:FilterLogEvents",
                          - "logs:StartQuery",
                          - "logs:GetQueryResults",
                        ]
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:logs:*:*:log-group:/ecs/commandchimps/*",
                          - "arn:aws:logs:*:*:log-group:/ecs/commandchimps/*:*",
                        ]
                      - Sid         = "DenyXLogs"
                    },
                  - {
                      - Action   = [
                          - "iam:PutRolePolicy",
                          - "iam:DeleteRolePolicy",
                          - "iam:AttachRolePolicy",
                          - "iam:DetachRolePolicy",
                          - "iam:DeleteRole",
                          - "iam:UpdateRole",
                          - "iam:UpdateAssumeRolePolicy",
                        ]
                      - Effect   = "Deny"
                      - Resource = "arn:aws:iam::553637109631:role/javabin-ci-*"
                      - Sid      = "DenyModCI"
                    },
                  - {
                      - Action    = "ec2:CreateSecurityGroup"
                      - Condition = {
                          - StringNotEqualsIfExists = {
                              - "aws:RequestTag/team" = "commandchimps"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyNoTag"
                    },
                  - {
                      - Action      = [
                          - "s3:CreateBucket",
                          - "dynamodb:CreateTable",
                          - "sqs:CreateQueue",
                          - "sns:CreateTopic",
                          - "rds:CreateDBInstance",
                          - "rds:CreateDBSubnetGroup",
                          - "ecs:CreateService",
                          - "ecs:RegisterTaskDefinition",
                          - "ecr:CreateRepository",
                          - "logs:CreateLogGroup",
                          - "ssm:PutParameter",
                          - "lambda:CreateFunction",
                          - "events:PutRule",
                          - "states:CreateStateMachine",
                        ]
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:s3:::commandchimps-*",
                          - "arn:aws:dynamodb:*:*:table/commandchimps-*",
                          - "arn:aws:sqs:*:*:commandchimps-*",
                          - "arn:aws:sns:*:*:commandchimps-*",
                          - "arn:aws:rds:*:*:db:commandchimps-*",
                          - "arn:aws:rds:*:*:subgrp:commandchimps-*",
                          - "arn:aws:ecs:*:*:service/*/commandchimps-*",
                          - "arn:aws:ecs:*:*:task-definition/commandchimps-*:*",
                          - "arn:aws:ecr:*:*:repository/commandchimps-*",
                          - "arn:aws:logs:*:*:log-group:/ecs/commandchimps/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/apps/commandchimps/*",
                          - "arn:aws:lambda:*:*:function:commandchimps-*",
                          - "arn:aws:events:*:*:rule/commandchimps-*",
                          - "arn:aws:states:*:*:stateMachine:commandchimps-*",
                        ]
                      - Sid         = "DenyBadName"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - policy_id        = "ANPAYBZ2X3576APVBTR3N" -> null
      - tags             = {
          - "Name"     = "javabin-team-commandchimps-guardrails"
          - "for-team" = "commandchimps"
          - "team"     = "shared"
        } -> null
      - tags_all         = {
          - "Name"        = "javabin-team-commandchimps-guardrails"
          - "environment" = "production"
          - "for-team"    = "commandchimps"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "shared"
        } -> null
    }

  # module.iam.aws_iam_policy.team_guardrails["developer"] will be destroyed
  # (because key ["developer"] is not in for_each map)
  - resource "aws_iam_policy" "team_guardrails" {
      - arn              = "arn:aws:iam::553637109631:policy/javabin-team-developer-guardrails" -> null
      - attachment_count = 0 -> null
      - description      = "Developer boundary rules for team developer, for its Identity Center permission set" -> null
      - id               = "arn:aws:iam::553637109631:policy/javabin-team-developer-guardrails" -> null
      - name             = "javabin-team-developer-guardrails" -> null
      - path             = "/" -> null
      - policy           = jsonencode(
            {
              - Statement = [
                  - {
                      - Action   = "*"
                      - Effect   = "Allow"
                      - Resource = "*"
                      - Sid      = "Allow"
                    },
                  - {
                      - Action   = [
                          - "iam:DeletePolicy",
                          - "iam:DeletePolicyVersion",
                          - "iam:CreatePolicyVersion",
                          - "iam:SetDefaultPolicyVersion",
                          - "iam:CreatePolicy",
                          - "iam:TagPolicy",
                          - "iam:UntagPolicy",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:iam::553637109631:policy/javabin-developer-boundary",
                          - "arn:aws:iam::553637109631:policy/javabin-team-*-guardrails",
                        ]
                      - Sid      = "DenyBndMod"
                    },
                  - {
                      - Action    = [
                          - "iam:CreateRole",
                          - "iam:PutRolePermissionsBoundary",
                        ]
                      - Condition = {
                          - StringNotEquals = {
                              - "iam:PermissionsBoundary" = "arn:aws:iam::553637109631:policy/javabin-developer-boundary"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyNoBnd"
                    },
                  - {
                      - Action   = "iam:DeleteRolePermissionsBoundary"
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyStripBnd"
                    },
                  - {
                      - Action   = [
                          - "iam:CreateUser",
                          - "iam:CreateLoginProfile",
                          - "iam:UpdateLoginProfile",
                          - "iam:CreateAccessKey",
                          - "iam:DeactivateMFADevice",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyIAMUsers"
                    },
                  - {
                      - Action   = [
                          - "organizations:*",
                          - "sso:*",
                          - "sso-directory:*",
                          - "identitystore:*",
                          - "account:*",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyOrgSSO"
                    },
                  - {
                      - Action   = [
                          - "ec2:CreateVpc",
                          - "ec2:DeleteVpc",
                          - "ec2:ModifyVpcAttribute",
                          - "ec2:CreateSubnet",
                          - "ec2:DeleteSubnet",
                          - "ec2:CreateInternetGateway",
                          - "ec2:DeleteInternetGateway",
                          - "ec2:AttachInternetGateway",
                          - "ec2:DetachInternetGateway",
                          - "ec2:CreateNatGateway",
                          - "ec2:DeleteNatGateway",
                          - "ec2:CreateRouteTable",
                          - "ec2:DeleteRouteTable",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyNetwork"
                    },
                  - {
                      - Action   = [
                          - "ecs:DeleteCluster",
                          - "ecs:UpdateCluster",
                          - "elasticloadbalancing:DeleteLoadBalancer",
                          - "elasticloadbalancing:ModifyLoadBalancerAttributes",
                          - "s3:DeleteBucket",
                          - "s3:PutBucketPolicy",
                          - "s3:DeleteBucketPolicy",
                          - "s3:PutBucketVersioning",
                          - "s3:PutEncryptionConfiguration",
                          - "dynamodb:DeleteTable",
                          - "dynamodb:UpdateTable",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:ecs:eu-central-1:553637109631:cluster/javabin-platform",
                          - "arn:aws:elasticloadbalancing:eu-central-1:553637109631:loadbalancer/app/javabin-*",
                          - "arn:aws:s3:::javabin-terraform-*",
                          - "arn:aws:s3:::javabin-ci-*",
                          - "arn:aws:dynamodb:eu-central-1:553637109631:table/javabin-terraform-*",
                        ]
                      - Sid      = "DenyPlatInfra"
                    },
                  - {
                      - Action   = [
                          - "guardduty:*",
                          - "securityhub:*",
                          - "config:*",
                          - "cloudtrail:*",
                          - "bedrock:Invoke*",
                          - "bedrock:Converse*",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenySecSvcs"
                    },
                  - {
                      - Action      = "*"
                      - Condition   = {
                          - Null            = {
                              - "aws:ResourceTag/team" = "false"
                            }
                          - StringNotEquals = {
                              - "aws:ResourceTag/team" = [
                                  - "developer",
                                  - "shared",
                                ]
                            }
                        }
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:s3:::javabin-terraform-state-553637109631",
                          - "arn:aws:s3:::javabin-terraform-state-553637109631/*",
                          - "arn:aws:dynamodb:eu-central-1:553637109631:table/javabin-terraform-app-locks",
                          - "arn:aws:s3:::javabin-ci-plan-artifacts-553637109631",
                          - "arn:aws:s3:::javabin-ci-plan-artifacts-553637109631/*",
                        ]
                      - Sid         = "DenyXTeam"
                    },
                  - {
                      - Action    = [
                          - "ec2:Delete*",
                          - "ec2:Modify*",
                          - "elasticloadbalancing:Delete*",
                          - "elasticloadbalancing:Modify*",
                          - "ecs:DeleteCluster",
                          - "ecs:UpdateCluster",
                          - "ecs:UpdateClusterSettings",
                          - "iam:DeleteRole",
                          - "iam:UpdateRole",
                          - "iam:DeleteRolePolicy",
                          - "iam:UpdateAssumeRolePolicy",
                          - "iam:PutRolePolicy",
                          - "iam:AttachRolePolicy",
                          - "iam:DetachRolePolicy",
                          - "route53:DeleteHostedZone",
                          - "sns:DeleteTopic",
                          - "sns:SetTopicAttributes",
                          - "ec2:AuthorizeSecurityGroup*",
                          - "ec2:RevokeSecurityGroup*",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "aws:ResourceTag/team" = "shared"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyShared"
                    },
                  - {
                      - Action    = [
                          - "ec2:DeleteTags",
                          - "ec2:CreateTags",
                          - "ecs:TagResource",
                          - "ecs:UntagResource",
                          - "elasticloadbalancing:AddTags",
                          - "elasticloadbalancing:RemoveTags",
                          - "iam:TagRole",
                          - "iam:UntagRole",
                          - "sns:TagResource",
                          - "sns:UntagResource",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "aws:ResourceTag/team" = [
                                  - "shared",
                                  - "platform",
                                ]
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyTagStrip"
                    },
                  - {
                      - Action   = [
                          - "ssm:GetParameter*",
                          - "ssm:GetParametersByPath",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:ssm:*:*:parameter/javabin/platform/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/slack/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/platform-overrides/*",
                        ]
                      - Sid      = "DenyPlatSSM"
                    },
                  - {
                      - Action      = "iam:PassRole"
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:iam::*:role/developer-*",
                          - "arn:aws:iam::*:role/javabin-ecs-exec-developer",
                        ]
                      - Sid         = "DenyPassRole"
                    },
                  - {
                      - Action      = [
                          - "logs:GetLogEvents",
                          - "logs:FilterLogEvents",
                          - "logs:StartQuery",
                          - "logs:GetQueryResults",
                        ]
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:logs:*:*:log-group:/ecs/developer/*",
                          - "arn:aws:logs:*:*:log-group:/ecs/developer/*:*",
                        ]
                      - Sid         = "DenyXLogs"
                    },
                  - {
                      - Action   = [
                          - "iam:PutRolePolicy",
                          - "iam:DeleteRolePolicy",
                          - "iam:AttachRolePolicy",
                          - "iam:DetachRolePolicy",
                          - "iam:DeleteRole",
                          - "iam:UpdateRole",
                          - "iam:UpdateAssumeRolePolicy",
                        ]
                      - Effect   = "Deny"
                      - Resource = "arn:aws:iam::553637109631:role/javabin-ci-*"
                      - Sid      = "DenyModCI"
                    },
                  - {
                      - Action    = "ec2:CreateSecurityGroup"
                      - Condition = {
                          - StringNotEqualsIfExists = {
                              - "aws:RequestTag/team" = "developer"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyNoTag"
                    },
                  - {
                      - Action      = [
                          - "s3:CreateBucket",
                          - "dynamodb:CreateTable",
                          - "sqs:CreateQueue",
                          - "sns:CreateTopic",
                          - "rds:CreateDBInstance",
                          - "rds:CreateDBSubnetGroup",
                          - "ecs:CreateService",
                          - "ecs:RegisterTaskDefinition",
                          - "ecr:CreateRepository",
                          - "logs:CreateLogGroup",
                          - "ssm:PutParameter",
                          - "lambda:CreateFunction",
                          - "events:PutRule",
                          - "states:CreateStateMachine",
                        ]
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:s3:::developer-*",
                          - "arn:aws:dynamodb:*:*:table/developer-*",
                          - "arn:aws:sqs:*:*:developer-*",
                          - "arn:aws:sns:*:*:developer-*",
                          - "arn:aws:rds:*:*:db:developer-*",
                          - "arn:aws:rds:*:*:subgrp:developer-*",
                          - "arn:aws:ecs:*:*:service/*/developer-*",
                          - "arn:aws:ecs:*:*:task-definition/developer-*:*",
                          - "arn:aws:ecr:*:*:repository/developer-*",
                          - "arn:aws:logs:*:*:log-group:/ecs/developer/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/apps/developer/*",
                          - "arn:aws:lambda:*:*:function:developer-*",
                          - "arn:aws:events:*:*:rule/developer-*",
                          - "arn:aws:states:*:*:stateMachine:developer-*",
                        ]
                      - Sid         = "DenyBadName"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - policy_id        = "ANPAYBZ2X357YOHVAQJAF" -> null
      - tags             = {
          - "Name"     = "javabin-team-developer-guardrails"
          - "for-team" = "developer"
          - "team"     = "shared"
        } -> null
      - tags_all         = {
          - "Name"        = "javabin-team-developer-guardrails"
          - "environment" = "production"
          - "for-team"    = "developer"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "shared"
        } -> null
    }

  # module.iam.aws_iam_policy.team_guardrails["java-no"] will be destroyed
  # (because key ["java-no"] is not in for_each map)
  - resource "aws_iam_policy" "team_guardrails" {
      - arn              = "arn:aws:iam::553637109631:policy/javabin-team-java-no-guardrails" -> null
      - attachment_count = 0 -> null
      - description      = "Developer boundary rules for team java-no, for its Identity Center permission set" -> null
      - id               = "arn:aws:iam::553637109631:policy/javabin-team-java-no-guardrails" -> null
      - name             = "javabin-team-java-no-guardrails" -> null
      - path             = "/" -> null
      - policy           = jsonencode(
            {
              - Statement = [
                  - {
                      - Action   = "*"
                      - Effect   = "Allow"
                      - Resource = "*"
                      - Sid      = "Allow"
                    },
                  - {
                      - Action   = [
                          - "iam:DeletePolicy",
                          - "iam:DeletePolicyVersion",
                          - "iam:CreatePolicyVersion",
                          - "iam:SetDefaultPolicyVersion",
                          - "iam:CreatePolicy",
                          - "iam:TagPolicy",
                          - "iam:UntagPolicy",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:iam::553637109631:policy/javabin-developer-boundary",
                          - "arn:aws:iam::553637109631:policy/javabin-team-*-guardrails",
                        ]
                      - Sid      = "DenyBndMod"
                    },
                  - {
                      - Action    = [
                          - "iam:CreateRole",
                          - "iam:PutRolePermissionsBoundary",
                        ]
                      - Condition = {
                          - StringNotEquals = {
                              - "iam:PermissionsBoundary" = "arn:aws:iam::553637109631:policy/javabin-developer-boundary"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyNoBnd"
                    },
                  - {
                      - Action   = "iam:DeleteRolePermissionsBoundary"
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyStripBnd"
                    },
                  - {
                      - Action   = [
                          - "iam:CreateUser",
                          - "iam:CreateLoginProfile",
                          - "iam:UpdateLoginProfile",
                          - "iam:CreateAccessKey",
                          - "iam:DeactivateMFADevice",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyIAMUsers"
                    },
                  - {
                      - Action   = [
                          - "organizations:*",
                          - "sso:*",
                          - "sso-directory:*",
                          - "identitystore:*",
                          - "account:*",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyOrgSSO"
                    },
                  - {
                      - Action   = [
                          - "ec2:CreateVpc",
                          - "ec2:DeleteVpc",
                          - "ec2:ModifyVpcAttribute",
                          - "ec2:CreateSubnet",
                          - "ec2:DeleteSubnet",
                          - "ec2:CreateInternetGateway",
                          - "ec2:DeleteInternetGateway",
                          - "ec2:AttachInternetGateway",
                          - "ec2:DetachInternetGateway",
                          - "ec2:CreateNatGateway",
                          - "ec2:DeleteNatGateway",
                          - "ec2:CreateRouteTable",
                          - "ec2:DeleteRouteTable",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenyNetwork"
                    },
                  - {
                      - Action   = [
                          - "ecs:DeleteCluster",
                          - "ecs:UpdateCluster",
                          - "elasticloadbalancing:DeleteLoadBalancer",
                          - "elasticloadbalancing:ModifyLoadBalancerAttributes",
                          - "s3:DeleteBucket",
                          - "s3:PutBucketPolicy",
                          - "s3:DeleteBucketPolicy",
                          - "s3:PutBucketVersioning",
                          - "s3:PutEncryptionConfiguration",
                          - "dynamodb:DeleteTable",
                          - "dynamodb:UpdateTable",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:ecs:eu-central-1:553637109631:cluster/javabin-platform",
                          - "arn:aws:elasticloadbalancing:eu-central-1:553637109631:loadbalancer/app/javabin-*",
                          - "arn:aws:s3:::javabin-terraform-*",
                          - "arn:aws:s3:::javabin-ci-*",
                          - "arn:aws:dynamodb:eu-central-1:553637109631:table/javabin-terraform-*",
                        ]
                      - Sid      = "DenyPlatInfra"
                    },
                  - {
                      - Action   = [
                          - "guardduty:*",
                          - "securityhub:*",
                          - "config:*",
                          - "cloudtrail:*",
                          - "bedrock:Invoke*",
                          - "bedrock:Converse*",
                        ]
                      - Effect   = "Deny"
                      - Resource = "*"
                      - Sid      = "DenySecSvcs"
                    },
                  - {
                      - Action      = "*"
                      - Condition   = {
                          - Null            = {
                              - "aws:ResourceTag/team" = "false"
                            }
                          - StringNotEquals = {
                              - "aws:ResourceTag/team" = [
                                  - "java-no",
                                  - "shared",
                                ]
                            }
                        }
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:s3:::javabin-terraform-state-553637109631",
                          - "arn:aws:s3:::javabin-terraform-state-553637109631/*",
                          - "arn:aws:dynamodb:eu-central-1:553637109631:table/javabin-terraform-app-locks",
                          - "arn:aws:s3:::javabin-ci-plan-artifacts-553637109631",
                          - "arn:aws:s3:::javabin-ci-plan-artifacts-553637109631/*",
                        ]
                      - Sid         = "DenyXTeam"
                    },
                  - {
                      - Action    = [
                          - "ec2:Delete*",
                          - "ec2:Modify*",
                          - "elasticloadbalancing:Delete*",
                          - "elasticloadbalancing:Modify*",
                          - "ecs:DeleteCluster",
                          - "ecs:UpdateCluster",
                          - "ecs:UpdateClusterSettings",
                          - "iam:DeleteRole",
                          - "iam:UpdateRole",
                          - "iam:DeleteRolePolicy",
                          - "iam:UpdateAssumeRolePolicy",
                          - "iam:PutRolePolicy",
                          - "iam:AttachRolePolicy",
                          - "iam:DetachRolePolicy",
                          - "route53:DeleteHostedZone",
                          - "sns:DeleteTopic",
                          - "sns:SetTopicAttributes",
                          - "ec2:AuthorizeSecurityGroup*",
                          - "ec2:RevokeSecurityGroup*",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "aws:ResourceTag/team" = "shared"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyShared"
                    },
                  - {
                      - Action    = [
                          - "ec2:DeleteTags",
                          - "ec2:CreateTags",
                          - "ecs:TagResource",
                          - "ecs:UntagResource",
                          - "elasticloadbalancing:AddTags",
                          - "elasticloadbalancing:RemoveTags",
                          - "iam:TagRole",
                          - "iam:UntagRole",
                          - "sns:TagResource",
                          - "sns:UntagResource",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "aws:ResourceTag/team" = [
                                  - "shared",
                                  - "platform",
                                ]
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyTagStrip"
                    },
                  - {
                      - Action   = [
                          - "ssm:GetParameter*",
                          - "ssm:GetParametersByPath",
                        ]
                      - Effect   = "Deny"
                      - Resource = [
                          - "arn:aws:ssm:*:*:parameter/javabin/platform/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/slack/*",
                          - "arn:aws:ssm:*:*:parameter/javabin/platform-overrides/*",
                        ]
                      - Sid      = "DenyPlatSSM"
                    },
                  - {
                      - Action      = "iam:PassRole"
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:iam::*:role/java-no-*",
                          - "arn:aws:iam::*:role/javabin-ecs-exec-java-no",
                        ]
                      - Sid         = "DenyPassRole"
                    },
                  - {
                      - Action      = [
                          - "logs:GetLogEvents",
                          - "logs:FilterLogEvents",
                          - "logs:StartQuery",
                          - "logs:GetQueryResults",
                        ]
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:logs:*:*:log-group:/ecs/java-no/*",
                          - "arn:aws:logs:*:*:log-group:/ecs/java-no/*:*",
                        ]
                      - Sid         = "DenyXLogs"
                    },
                  - {
                      - Action   = [
                          - "iam:PutRolePolicy",
                          - "iam:DeleteRolePolicy",
                          - "iam:AttachRolePolicy",
                          - "iam:DetachRolePolicy",
                          - "iam:DeleteRole",
                          - "iam:UpdateRole",
                          - "iam:UpdateAssumeRolePolicy",
                        ]
                      - Effect   = "Deny"
                      - Resource = "arn:aws:iam::553637109631:role/javabin-ci-*"
                      - Sid      = "DenyModCI"
                    },
                  - {
                      - Action    = "ec2:CreateSecurityGroup"
                      - Condition = {
                          - StringNotEqualsIfExists = {
                              - "aws:RequestTag/team" = "java-no"
                            }
                        }
                      - Effect    = "Deny"
                      - Resource  = "*"
                      - Sid       = "DenyNoTag"
                    },
                  - {
                      - Action      = [
                          - "s3:CreateBucket",
                          - "dynamodb:CreateTable",
                          - "sqs:CreateQueue",
                          - "sns:CreateTopic",
                          - "rds:CreateDBInstance",
                          - "rds:CreateDBSubnetGroup",
                          - "ecs:CreateService",
                          - "ecs:RegisterTaskDefinition",
                          - "ecr:CreateRepository",
                          - "logs:CreateLogGroup",
                          - "ssm:PutParameter",
                          - "lambda:CreateFunction",
                          - "events:PutRule",
                          - "states:CreateStateMachine",
                        ]
                      - Effect      = "Deny"
                      - NotResource = [
                          - "arn:aws:s3:::java-no-*",
                          - "arn:aws:dynamodb:*

✂️ Plan output above is cut at 60000 of 832191 characters (GitHub comment size limit). The full plan is in the workflow log; the LLM review below is not affected by this cut.


LLM Review

Risk: 🔴 HIGH

Plan destroys 231 IAM resources (team guardrail policies, CI deploy/team roles and their inline policies, ECS exec roles and attachments) for every team except cake-like keys that are missing from the for_each map, while updating 3 Lambda/IAM resources in place: this looks like an accidental for_each key removal and would break CI deploys and ECS task execution across all teams.

  • 💥 [destruction] 231 destroys across module.iam: aws_iam_policy.team_guardrails, aws_iam_role.ci_deploy, aws_iam_role.ci_team, aws_iam_role.ecs_exec_team and their inline policies/attachments. Every destroy reason is 'key is not in for_each map', which means the team set fed to the module is wrong (likely a shrunken or empty team list), not an intentional decommission. Only cake's roles are referenced by cake-only paths in the plan, and nearly all teams are affected, including 'shared'-tagged resources.
  • 💥 [destruction] Destroying javabin-ecs-exec-* task execution roles and javabin-ci-deploy-* roles will break running ECS services (task pulls/secret reads fail on redeploy) and any CI pipeline that assumes these roles via javabin-ci-broker. Recovery requires re-creating roles with new unique IDs and re-attaching policies.
  • 🔒 [security] Removing the team_guardrails developer boundary policies and the ci_team permission-boundary references means the permissions_boundary attachments disappear with their roles; no boundary is removed from surviving principals in this plan, but the destroyed guardrail policies are the baseline that constrains developer Identity Center permission sets, so the state of boundary enforcement after apply must be verified before anything is applied.
  • ✅ [routine] module.lambdas: aws_iam_role_policy.password_set narrows Resource from the wildcard javabin/platform/* to javabin/platform/password-token-signing-key, and aws_lambda_function.plan_review and team_provisioner receive code updates (source_code_hash changes); team_provisioner also adds ATLASSIAN_* environment variables. These are normal in-place changes, low risk on their own, but the IAM scope reduction should be confirmed as intended.
  • 💰 [cost] No new billable resources are created (0 to add). Destroys reduce IAM objects only, which have no direct cost, so there is no cost concern in this plan.

@Alexanderamiri
Alexanderamiri merged commit 2308ce9 into main Oct 24, 2026
4 checks passed
@Alexanderamiri
Alexanderamiri deleted the fix/review-truncation branch October 24, 2026 10:02
Alexanderamiri added a commit that referenced this pull request Oct 24, 2026
Follow-up to #147, which merged before this review fix was pushed.

## Why
With no ceiling, a plan beyond Haiku 5.5's 1M-token context fails the
review with a Bedrock ValidationException, which blocks the apply until
a board override. The review of #147 recommended a ceiling well above
any real plan.

## What changed
- `REVIEW_MAX_PLAN_CHARS` defaults to 2,000,000 chars, about 500–800k
tokens and 2.4× the largest real plan (#135, 830k chars). Real plans are
still sent whole. Only a pathological plan falls back to the change-list
mode (every change listed, diff cut at a resource boundary, with a
notice).
- The prompt's `(known after apply)` explanation is corrected: the value
is derived from other resources too, so judge the expression, not a
value.
- `post-plan-comment.sh` removes its temp file.

## Checks
Both test suites pass, with new tests for real-size plans sent whole and
the fallback above the ceiling.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant