Interview Prep/Real-World Interview/Infrastructure as Code & Terraform state

How did you handle multiple AWS accounts in Terraform?

AdvancedBehavioralInfrastructure as Code & Terraform state
Answer

Good answer looks like → "Each environment had its own AWS account. CI assumed a deploy role in the target account using OIDC into a central account, then assume_role in the provider block. Shared resources like Route 53 zones lived in a networking account, managed via a provider alias."

provider "aws" {
  alias  = "network"
  region = "ap-south-1"
  assume_role {
    role_arn = "arn:aws:iam::111122223333:role/terraform-deploy"
  }
}

Follow-ups to expect → How did you bootstrap the roles themselves? How did you create new accounts?

Red flags → One set of admin credentials used for every account.

All Real-World Interview questions Roadmap: Interview readiness

More on Infrastructure as Code & Terraform state