Skip to content

fix(ci): create team CI roles only for registry teams - #135

Merged
Alexanderamiri merged 3 commits into
mainfrom
fix/registry-team-source
Oct 24, 2026
Merged

Alexanderamiri merged 3 commits into
mainfrom
fix/registry-team-source

Conversation

@Alexanderamiri

Copy link
Copy Markdown
Member

Why

sync-registered-teams.py lists every GitHub org team, so applying #132 created AWS CI and deploy roles (javabin-ci-team-*, javabin-ci-deploy-*) for 21 org teams that are not app teams: owners, developer, java-no, team-* and others. Any repo in one of those GitHub teams could request those roles through the broker.

What changed

The sync reads teams/*.yaml from javaBin/registry, the documented source of truth: cupcake, jzwatch, testteam. The committed tfvars are updated to match.

Expected plan: 148 to destroy, HIGH risk

21 teams × 7 role resources = 147, plus 1 that only appears if #134 hasn't merged yet. None belong to cupcake, jzwatch or testteam. The roles were created hours ago by #132 and have never been used.

The apply needs a board override through approve-override.yml. That is why this change is split out of #134.

🤖 Generated with Claude Code

sync-registered-teams listed every GitHub org team, so non-app teams like
owners and developer got AWS CI and deploy roles. Use teams/*.yaml in
javaBin/registry, the documented source of truth.

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 23, 2026 14:13
@github-actions

Copy link
Copy Markdown

Terraform Plan

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

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

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

Terraform will perform the following actions:

  # module.iam.aws_iam_role.ci_deploy["cake"] will be destroyed
  # (because key ["cake"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-cake" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:08Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-cake" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-cake" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-cake"
          - "team" = "cake"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-cake"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "cake"
        } -> null
      - unique_id             = "AROAYBZ2X3574IM43BNTE" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/cake/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/cake/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/cake-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "cake"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/cake-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["commandchimps"] will be destroyed
  # (because key ["commandchimps"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-commandchimps" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-commandchimps" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-commandchimps" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-commandchimps"
          - "team" = "commandchimps"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-commandchimps"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "commandchimps"
        } -> null
      - unique_id             = "AROAYBZ2X357RK4KR5VYP" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/commandchimps/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/commandchimps/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/commandchimps-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "commandchimps"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/commandchimps-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["developer"] will be destroyed
  # (because key ["developer"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-developer" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-developer" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-developer" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-developer"
          - "team" = "developer"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-developer"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "developer"
        } -> null
      - unique_id             = "AROAYBZ2X357YGNZIWO6E" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/developer/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/developer/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/developer-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "developer"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/developer-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["java-no"] will be destroyed
  # (because key ["java-no"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-java-no" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-java-no" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-java-no" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-java-no"
          - "team" = "java-no"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-java-no"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "java-no"
        } -> null
      - unique_id             = "AROAYBZ2X357VKB5DVGLS" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/java-no/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/java-no/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/java-no-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "java-no"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/java-no-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["javazone-no"] will be destroyed
  # (because key ["javazone-no"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-javazone-no" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-javazone-no" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-javazone-no" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-javazone-no"
          - "team" = "javazone-no"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-javazone-no"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "javazone-no"
        } -> null
      - unique_id             = "AROAYBZ2X3574JJ53X2NU" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/javazone-no/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/javazone-no/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/javazone-no-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "javazone-no"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/javazone-no-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["javazone-work"] will be destroyed
  # (because key ["javazone-work"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-javazone-work" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:08Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-javazone-work" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-javazone-work" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-javazone-work"
          - "team" = "javazone-work"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-javazone-work"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "javazone-work"
        } -> null
      - unique_id             = "AROAYBZ2X357VING4C52E" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/javazone-work/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/javazone-work/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/javazone-work-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "javazone-work"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/javazone-work-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["owners"] will be destroyed
  # (because key ["owners"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-owners" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-owners" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-owners" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-owners"
          - "team" = "owners"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-owners"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "owners"
        } -> null
      - unique_id             = "AROAYBZ2X3576ZFNZPELG" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/owners/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/owners/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/owners-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "owners"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/owners-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["partnermanagement"] will be destroyed
  # (because key ["partnermanagement"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-partnermanagement" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:08Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-partnermanagement" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-partnermanagement" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-partnermanagement"
          - "team" = "partnermanagement"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-partnermanagement"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "partnermanagement"
        } -> null
      - unique_id             = "AROAYBZ2X3575MZEFVNYP" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/partnermanagement/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/partnermanagement/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/partnermanagement-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "partnermanagement"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/partnermanagement-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["team-apps"] will be destroyed
  # (because key ["team-apps"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-team-apps" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-team-apps" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-team-apps" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-team-apps"
          - "team" = "team-apps"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-team-apps"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "team-apps"
        } -> null
      - unique_id             = "AROAYBZ2X3577J7MPNFWM" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/team-apps/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/team-apps/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/team-apps-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "team-apps"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/team-apps-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                          

LLM Review

Risk: 🔴 HIGH

Plan destroys ci_deploy IAM roles (cake, commandchimps, developer, java-no, and likely more) because their for_each keys were removed from the configuration, which breaks CI deploy access for those teams and is not visible as an intentional, reviewed change.

  • 💥 [destruction] Terraform will destroy module.iam.aws_iam_role.ci_deploy for keys such as "cake", "commandchimps", "developer", "java-no" (output truncated, so more may follow). Each is 'not in for_each map', meaning the team entries were removed from the input variable/config. Destroying these roles removes the deploy identities these teams use for ECR push, ECS deploy and SSM access, and their inline policies go with them.
  • 💥 [destruction] Deleting the roles also breaks the ci_broker trust path (sts:AssumeRole from javabin-ci-broker), so any pipeline that still assumes these roles will fail immediately. Confirm whether the teams were offboarded on purpose or whether this is a variable/workspace mistake that dropped entries from the map.
  • 🔒 [security] The destroyed roles carry the permissions boundary javabin-developer-boundary, and their policies allow ecs:RegisterTaskDefinition, iam:PassRole on the ecs-execution role and -* roles, and ecr:CreateRepository. Removing them is a reduction in attack surface, but the removal should be verified against the team offboarding record.
  • ✅ [routine] The visible changes are all deletions of IAM roles and inline policies. No new public exposure, security group opening, or billable resource creation is visible in the shown portion of the plan. The remaining plan (truncated) should be checked for any database, NAT, or security group changes.
  • ✅ [routine] Recommend pausing the apply until the removed for_each keys are confirmed as intentional. If they are intentional, remove the matching ci_team and ci_team_allow entries too, and check for any state drift or dangling references to these roles in CI configuration.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Terraform Plan

🚧 Changes detected — Plan: 0 to add, 0 to change, 147 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:
  - destroy

Terraform will perform the following actions:

  # module.iam.aws_iam_role.ci_deploy["cake"] will be destroyed
  # (because key ["cake"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-cake" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:08Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-cake" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-cake" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-cake"
          - "team" = "cake"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-cake"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "cake"
        } -> null
      - unique_id             = "AROAYBZ2X3574IM43BNTE" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/cake/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/cake/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/cake-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "cake"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/cake-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["commandchimps"] will be destroyed
  # (because key ["commandchimps"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-commandchimps" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-commandchimps" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-commandchimps" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-commandchimps"
          - "team" = "commandchimps"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-commandchimps"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "commandchimps"
        } -> null
      - unique_id             = "AROAYBZ2X357RK4KR5VYP" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/commandchimps/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/commandchimps/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/commandchimps-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "commandchimps"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/commandchimps-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["developer"] will be destroyed
  # (because key ["developer"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-developer" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-developer" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-developer" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-developer"
          - "team" = "developer"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-developer"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "developer"
        } -> null
      - unique_id             = "AROAYBZ2X357YGNZIWO6E" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/developer/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/developer/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/developer-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "developer"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/developer-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["java-no"] will be destroyed
  # (because key ["java-no"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-java-no" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-java-no" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-java-no" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-java-no"
          - "team" = "java-no"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-java-no"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "java-no"
        } -> null
      - unique_id             = "AROAYBZ2X357VKB5DVGLS" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/java-no/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/java-no/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/java-no-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "java-no"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/java-no-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["javazone-no"] will be destroyed
  # (because key ["javazone-no"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-javazone-no" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-javazone-no" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-javazone-no" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-javazone-no"
          - "team" = "javazone-no"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-javazone-no"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "javazone-no"
        } -> null
      - unique_id             = "AROAYBZ2X3574JJ53X2NU" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/javazone-no/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/javazone-no/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/javazone-no-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "javazone-no"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/javazone-no-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["javazone-work"] will be destroyed
  # (because key ["javazone-work"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-javazone-work" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:08Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-javazone-work" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-javazone-work" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-javazone-work"
          - "team" = "javazone-work"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-javazone-work"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "javazone-work"
        } -> null
      - unique_id             = "AROAYBZ2X357VING4C52E" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/javazone-work/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/javazone-work/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/javazone-work-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "javazone-work"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/javazone-work-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["owners"] will be destroyed
  # (because key ["owners"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-owners" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-owners" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-owners" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-owners"
          - "team" = "owners"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-owners"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "owners"
        } -> null
      - unique_id             = "AROAYBZ2X3576ZFNZPELG" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/owners/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/owners/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/owners-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "owners"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/owners-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["partnermanagement"] will be destroyed
  # (because key ["partnermanagement"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-partnermanagement" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:08Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-partnermanagement" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-partnermanagement" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-partnermanagement"
          - "team" = "partnermanagement"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-partnermanagement"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "partnermanagement"
        } -> null
      - unique_id             = "AROAYBZ2X3575MZEFVNYP" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/partnermanagement/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/partnermanagement/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/partnermanagement-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "partnermanagement"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/partnermanagement-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                              - "ssm:GetParameters",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ssm:eu-central-1:553637109631:parameter/javabin/platform-overrides/*"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
    }

  # module.iam.aws_iam_role.ci_deploy["team-apps"] will be destroyed
  # (because key ["team-apps"] is not in for_each map)
  - resource "aws_iam_role" "ci_deploy" {
      - arn                   = "arn:aws:iam::553637109631:role/javabin-ci-deploy-team-apps" -> null
      - assume_role_policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sts:AssumeRole"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::553637109631:role/javabin-ci-broker"
                        }
                      - Sid       = "AllowViaCIBroker"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
      - create_date           = "2026-10-23T13:50:07Z" -> null
      - force_detach_policies = false -> null
      - id                    = "javabin-ci-deploy-team-apps" -> null
      - managed_policy_arns   = [] -> null
      - max_session_duration  = 3600 -> null
      - name                  = "javabin-ci-deploy-team-apps" -> null
      - path                  = "/" -> null
      - permissions_boundary  = "arn:aws:iam::553637109631:policy/javabin-developer-boundary" -> null
      - tags                  = {
          - "Name" = "javabin-ci-deploy-team-apps"
          - "team" = "team-apps"
        } -> null
      - tags_all              = {
          - "Name"        = "javabin-ci-deploy-team-apps"
          - "environment" = "production"
          - "managed-by"  = "terraform"
          - "repo"        = "javaBin/platform"
          - "service"     = "platform"
          - "team"        = "team-apps"
        } -> null
      - unique_id             = "AROAYBZ2X3577J7MPNFWM" -> null

      - inline_policy {
          - name   = "cloudwatch-logs" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "logs:CreateLogGroup",
                              - "logs:CreateLogStream",
                              - "logs:PutLogEvents",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/team-apps/*",
                              - "arn:aws:logs:eu-central-1:553637109631:log-group:/ecs/team-apps/*:*",
                            ]
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecr-push" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ecr:GetAuthorizationToken",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcrAuth"
                        },
                      - {
                          - Action   = [
                              - "ecr:BatchCheckLayerAvailability",
                              - "ecr:PutImage",
                              - "ecr:InitiateLayerUpload",
                              - "ecr:UploadLayerPart",
                              - "ecr:CompleteLayerUpload",
                              - "ecr:GetDownloadUrlForLayer",
                              - "ecr:BatchGetImage",
                              - "ecr:CreateRepository",
                              - "ecr:DescribeRepositories",
                            ]
                          - Effect   = "Allow"
                          - Resource = "arn:aws:ecr:eu-central-1:553637109631:repository/team-apps-*"
                          - Sid      = "EcrPush"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ecs-deploy" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action    = [
                              - "ecs:UpdateService",
                              - "ecs:DescribeServices",
                            ]
                          - Condition = {
                              - StringEquals = {
                                  - "aws:ResourceTag/team" = "team-apps"
                                }
                            }
                          - Effect    = "Allow"
                          - Resource  = "*"
                          - Sid       = "EcsServiceManagement"
                        },
                      - {
                          - Action   = [
                              - "ecs:DescribeTaskDefinition",
                              - "ecs:RegisterTaskDefinition",
                              - "ecs:DeregisterTaskDefinition",
                            ]
                          - Effect   = "Allow"
                          - Resource = "*"
                          - Sid      = "EcsTaskDefinitionManagement"
                        },
                      - {
                          - Action   = [
                              - "iam:PassRole",
                            ]
                          - Effect   = "Allow"
                          - Resource = [
                              - "arn:aws:iam::553637109631:role/javabin-ecs-execution",
                              - "arn:aws:iam::553637109631:role/team-apps-*",
                            ]
                          - Sid      = "PassRole"
                        },
                    ]
                  - Version   = "2012-10-17"
                }
            ) -> null
        }
      - inline_policy {
          - name   = "ssm-read-overrides" -> null
          - policy = jsonencode(
                {
                  - Statement = [
                      - {
                          - Action   = [
                              - "ssm:GetParameter",
                          

LLM Review

Risk: 🔴 HIGH

The plan destroys multiple per-team CI deploy IAM roles (for keys no longer in the for_each map, e.g. cake, commandchimps, developer, java-no, and likely more in the truncated output), which would break those teams' CI/CD pipelines; the output is truncated so the full scope cannot be confirmed.

  • 💥 [destruction] module.iam.aws_iam_role.ci_deploy is being destroyed for keys cake, commandchimps, developer, java-no (and possibly others in the truncated remainder) because they are no longer in the for_each map. Each role carries inline policies (ecr-push, ecs-deploy, ssm-read-overrides, cloudwatch-logs) that will be deleted with it, so any team still relying on these roles will lose the ability to push images, deploy ECS services, and read overrides.
  • 💥 [destruction] Related per-team resources (ci_team roles, ci_deploy_ecr/ecs/ssm/logs policies, ci_team_allow policies) for the removed keys are likely also being destroyed; the truncated output prevents full verification. Confirm whether the removal of these teams from the map is intentional and whether the teams have been migrated or offboarded.
  • 🔒 [security] The destroyed roles were all attached to the module.iam developer permissions boundary and trusted only javabin-ci-broker. Removal reduces attack surface, but the removal should be confirmed as deliberate rather than an accidental edit to the for_each input (e.g. a filtered or incomplete team list).
  • ✅ [routine] Plan is truncated; the remaining changes (other roles, Lambdas, or networking) could not be reviewed. Obtain the full plan output before approving an apply.
  • 💰 [cost] Destroying IAM roles has no direct cost impact; no new billable resources (NAT gateways, RDS, load balancers) are visible in the portion shown.

Alexanderamiri added a commit that referenced this pull request Oct 23, 2026
…es (#134)

Closes three of the isolation holes found while exploring app-to-app
support. All of them matter before cupcake stores real credentials. Its
sleepingpill credentials can read every talk submission.

## Why
1. **Cross-team secret access.** The shared `javabin-ecs-execution` role
could read every `/javabin/apps/*` parameter, and every team was allowed
to pass it. Any team could mount another team's secrets, or since #132
their Cognito client secrets, in its own task definition.
2. **Shared security group editable by teams.** `DenyShared` blocked
`ec2:Delete*`/`Modify*` but not
`ec2:AuthorizeSecurityGroupIngress`/`Revoke*`. The IAM policy simulator
confirms `javabin-ci-team-testteam` may edit `javabin-ecs-tasks-sg`. Any
team could open every app to every other app, or remove the ALB rule and
take all apps offline.
3. **Broker and gate trusted the payload.** `ci-broker` and `apply-gate`
took the repo from the request. The gate's `sign` action (approve a
HIGH-risk plan) accepted any caller. Code running in an app's platform
job (a Terraform `external` data source, say) could claim another repo's
team credentials or sign its own override.

## What changed
- **Execution roles:** per-team `javabin-ecs-exec-{team}`, reading only
`/javabin/apps/{team}/*`. They are tagged `team=shared`, so teams can't
edit them. `platform-data` takes `team` and returns that role. The
boundary's `DenyPassRole` only allows
`javabin-ecs-exec-${PrincipalTag/team}`. The shared role loses its
secrets policy.
- **Boundary:** `DenyShared` now covers `ec2:AuthorizeSecurityGroup*`,
`ec2:RevokeSecurityGroup*` and `iam:UpdateAssumeRolePolicy`. Without the
last one, a team could make another team's execution role trust its own
CI role. Size goes up about 110 bytes, to roughly 5,835 of 6,144.
- **Broker and gate:** callers send a GitHub OIDC token
(`scripts/github-oidc-token.sh`). The Lambdas verify it against GitHub's
JWKS (`shared/github_oidc.py`, RS256 verified in plain Python, no
dependencies or binaries) and take the repo from its signed `repository`
claim.
- `check` also requires the plan key to be under
`plans/javaBin/<repo>/`.
- `sign` requires a token from `approve-override.yml` in
javaBin/platform, in the `override-approval` environment. The approver
is the token's `actor`.
- **approve-override.yml:** passes inputs through env instead of
interpolating them into shell.

Switching team roles to registry teams was split out into #135, because
it destroys unused roles and plans HIGH. Until that merges, execution
roles are created for every GitHub org team, like the CI roles today.

## Not in this PR
- `service-rds` still allows ingress from the shared tasks SG, so team
databases share a network path (password still required). Fixing that
needs per-app SGs; recorded in CLAUDE.md. cupcake has no database.
- Team roles can still write other repos' objects in the plan bucket.
#137 denies writing `risk.json`/`review.json`/`override.json`.
Overwriting another repo's `tfplan` only makes its apply fail the SHA256
check, so it's a nuisance, not an escalation. Prefix-scoping the bucket
per repo is follow-up work.

## Checks
- `python3 -m unittest discover -s terraform/lambda-src/tests`: 20 tests
pass. The new ones sign real RS256 tokens: tampered payload, wrong
audience/org/workflow/branch, the override-signing workflow and
environment pin, non-object claims, and verification without any
subprocess.
- Reviewed by an independent agent. Its blockers are fixed in the last
commit: the exec-role trust takeover, and the openssl dependency (the
live runtime does have openssl, but verification no longer needs it).
- Generator tests pass.
- `terraform validate` on `terraform/platform`.
- actionlint.

## Rollout
- Scripts are read from `main`, so they send `id_token` from the moment
this merges. The old Lambdas ignore it until the apply replaces them.
The override script still sends `approved_by`, which the old gate needs.
- The apply creates the exec roles before apps regenerate against the
new `platform-data`.
- platform-test-app has no running tasks, so dropping the shared role's
secrets policy affects nothing live.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Terraform Plan

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

Plan output
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:
  - 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:*:*:table/java-no-*",
                          - "arn:aws:sqs:*:*:java-no

LLM Review

Risk: 🔴 HIGH

The plan destroys all 231 IAM resources (0 to add, 0 to change, 231 to destroy) for the team guardrail policies, CI deploy and CI team roles, ECS exec roles, and their inline/attached policies, as all of these team keys have been removed from the for_each maps; this is a near-total teardown of team IAM access and only part of the diff (lines 1–8134, 28 of 231 changes) was reviewed.

  • 💥 [destruction] All 231 changes are destroys with zero creates, caused by team keys (cake, commandchimps, developer, java-no, javazone-no, javazone-work, owners, partnermanagement, team-apps, team-cibus, team-cibus2, team-ems, team-incogito, team-javazone-badge, team-javazone-video, team-jz-text-adventure, team-portal, team-scala-training-code, team-submitit, teammoosehead, teamteknologihuset) being absent from the for_each maps. This looks like an accidental config or input change (for example a filtered or empty team list) rather than an intentional decommission. Confirm before applying.
  • 🔒 [security] Destroying the javabin-developer-boundary-scoped CI deploy roles, guardrail policies, and ECS exec roles removes the team permission boundaries and CI deployment paths. Teams lose the ability to deploy through CI, and any Identity Center permission sets referencing these guardrail policies would be affected. Deleting the guardrail policies also removes boundary controls that other roles depend on.
  • 💥 [destruction] The destroyed roles are in production (environment=production). Destroying ecs_exec_team roles and their secrets policies can break running ECS tasks that assume them on their next restart or redeploy. The ecs_exec_team_secrets policies and team IAM roles are not visible in the diff, so the exact impact cannot be verified from this review.
  • ✅ [routine] The guardrail policy diffs show a consistent structure (Allow * with Deny statements for DenyBndMod, DenyNoBnd, DenyPlatInfra, DenyXTeam, DenyShared, DenyModCI, and similar). No new Allow grants or public exposure appear in the destroy diff. Only policy removals are shown, so no new permission grants were introduced.
  • ✅ [routine] Diffs for 203 changes (most of the IAM role, role policy, and attachment resources, including ci_team roles and ci_deploy_ecr/ecs/logs/ssm policies) were not shown, and the plan output after line 8134 (warnings, outputs) was not reviewed. The findings above cover only the first 28 changes, so the full impact could not be assessed.

@Alexanderamiri
Alexanderamiri merged commit 339d876 into main Oct 24, 2026
4 checks passed
@Alexanderamiri
Alexanderamiri deleted the fix/registry-team-source branch October 24, 2026 09:54
Alexanderamiri added a commit that referenced this pull request Oct 24, 2026
…accounts (#148)

## What
- `atlassian.py`: a group with `all_java_no_accounts: true` also gets
every active, managed `@java.no` account. Those are exactly the Google
Workspace users, because the Google user sync mirrors them into
Atlassian. Unmanaged accounts on a java.no address (e.g. the old
`drift@java.no` login) and inactive accounts are excluded.
- `provision-atlassian.py` passes the flag through.
- Still report-only (`atlassian_sync_apply` unchanged).

## Why
Confluence access should cover everyone with a java.no Google account,
not just `helter`.

## Verification
- Unit tests: lambda-src 63 OK, scripts 31 OK.
- Live report run with registry#39's updated YAML: `confluence-users`
+47 / −118 (all 118 removals are personal accounts), no member missing
an account, no java.no account removed.

## Merge order
After this applies, merge javaBin/registry#39 (it uses the flag). Note:
main's apply is currently blocked behind #135's HIGH-risk destroys and
needs the board override; this change rides along.

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

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Alexanderamiri added a commit that referenced this pull request Oct 24, 2026
…ole plan (#147)

## 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](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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>
Alexanderamiri added a commit that referenced this pull request Oct 24, 2026
#135 switched team sync to registry `teams/*.yaml`, but the old "GitHub
org teams" row survived the merge next to the new one. One-line removal.

🤖 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