AWS IAM → STACKIT

AWS IAM migration to STACKIT

AWS IAM roles become STACKIT service accounts with project role assignments. StackToIT tells apart the roles your applications use from roles only AWS services need, so you carry over identities, not AWS plumbing.

ECS task roles to STACKIT service accounts

From the published AWS Retail Store run. Left: the AWS source exactly as AWS publishes it. Right: the resource blocks StackToIT wrote; the review comments above each block in the file are left out here.

AWS sourceterraform/lib/ecs/service/iam.tf
resource "aws_iam_role" "task_execution_role" {
  name               = "${var.environment_name}-${var.service_name}-te"
  assume_role_policy = data.aws_iam_policy_document.assume_role_policy.json
  tags               = var.tags
}

resource "aws_iam_role_policy_attachment" "task_execution_role_policy" {
  role       = aws_iam_role.task_execution_role.name
  policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
}

resource "aws_iam_role_policy_attachment" "task_execution_role_additional" {
  count      = length(var.additional_task_execution_role_iam_policy_arns)
  role       = aws_iam_role.task_execution_role.name
  policy_arn = var.additional_task_execution_role_iam_policy_arns[count.index]
}

resource "aws_iam_role" "task_role" {
  name               = "${var.environment_name}-${var.service_name}-task"
  assume_role_policy = data.aws_iam_policy_document.assume_role_policy.json
  tags               = var.tags
}
STACKIT Terraform by StackToITterraform/identity.tf
resource "stackit_service_account" "retail_app_ecs_carts_service_task_execution_role" {
  project_id = var.project_id
  name       = "retail-app-ec-e66809"
}

resource "stackit_authorization_project_role_assignment" "retail_app_ecs_carts_service_task_execution_role" {
  for_each    = toset(var.carts_task_execution_project_roles)
  resource_id = var.project_id
  role        = each.value
  subject     = stackit_service_account.retail_app_ecs_carts_service_task_execution_role.email
}
  • Roles become service accounts

    Each task role and execution role becomes a STACKIT service account, named within STACKIT’s limit of 20 characters.

  • Permissions become role assignments

    AWS actions do not map one to one to STACKIT roles, so the roles are a variable per service account that your architect fills.

  • Service roles fall away

    Roles that only an AWS-managed service uses, such as the EKS control plane, are named as not needed on STACKIT.

  • Trust policies named

    A STACKIT service account has no trust policy. The code says so, and references to role ARNs are listed for update.

What the Retail Store run produced

Identity is more than roles. These are the facts of the published AWS Retail Store run.

  • Ten roles, ten service accounts

    Five services (ui, catalog, carts, checkout, orders) each have a task role and an execution role. Each becomes one stackit_service_account.

  • One variable per account

    Every service account gets a role assignment driven by a variable, such as carts_service_task_project_roles or carts_task_execution_project_roles. The run wrote ten of them for your architect to fill.

  • Names within the limit

    A service account name has at most 20 characters, lowercase letters, digits and single dashes, and is unique in a project. The draft cuts the name and adds a suffix of the SHA-256 of the source address, for example retail-app-ec-e66809. Set the name you prefer.

  • Attachment stays a decision

    For all five ECS services the identity attachment is marked as a decision. The Identity Architect owns the work package Set up the identities and access, with ten steps.

  • Switched-off roles still classified

    In the Retail estate the two RDS enhanced monitoring roles and the VPC flow log role are switched off with count = 0. The run still records how it would treat them: a monitoring role that a database instance uses counts as a role of an AWS-managed service, and a role whose purpose depends on values known only at plan time goes to your architect.

  • Secrets alongside

    Four Secrets Manager secrets map to STACKIT Secrets Manager. A script writes them through its Vault-compatible API once you accept the decision to depend on that API.

Proven on a real AWS estate

The AWS Retail Store Sample App, a public Terraform project from AWS, assessed by StackToIT and published in full, exactly as the run wrote it.

View Case Study
282
Terraform resource declarations analyzed
44
migration units identified
38
target units generated, from 52 considered
331
plan steps written

Questions security teams ask

Does StackToIT translate IAM policies into STACKIT roles?

It maps each role and its policies to a service account with role assignments and leaves the choice of STACKIT roles to your architect, because AWS actions and STACKIT roles do not line up one to one.

Is the STACKIT role assignment resource stable?

stackit_authorization_project_role_assignment belongs to the iam feature of the STACKIT provider, an opt-in feature the provider says may still change. StackToIT enables it explicitly and says so in the code.

What about permissions limited to single resources?

A project role assignment applies to the whole project. Where a source policy limits permissions to specific resources, StackToIT flags it, so you can use per-resource bindings where the STACKIT service offers them.

Does StackToIT decide how a workload authenticates?

It names the question. The run lists, per service, how the workload gets its service account as a decision for the Identity Architect. Whether workload identity federation fits, the privilege differences, break-glass access and human identities stay with your architects, and the run attaches, grants and federates nothing.

Why do the generated service account names look cut?

STACKIT limits a service account name to 20 characters, so a long AWS role name cannot be used as it is. The draft shortens it and adds a hash suffix so that two roles never collide. You can set any valid name.

How many role variables does an estate need?

One per service account. The Retail Store estate has ten roles and the run wrote ten variables, each filled by your architect with the STACKIT roles that service account needs.

Sources

Your next move: STACKIT.

Tell us about your estate. We show you what StackToIT delivers for it: target architecture, Terraform artifacts and a structured migration plan.