Terraform

How to manage multiple AWS accounts?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

One way is to define multiple different provider blocks, each with its own "assume_role"

provider "aws" {
  region = "us-west-1"
  alias = "some-region"

  assume_role {
    role_arn = "arn:aws:iam:::role/"
  }
}