O Terraform suporta vários provedores
provider.tf
# default provider
provider "aws" {
access_key = "foo"
secret_key = "bar"
region = "us-east-1"
}
provider "aws" {
alias = "aws-assume"
assume_role {
role_arn = "arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME"
session_name = "SESSION_NAME"
external_id = "EXTERNAL_ID"
}
}
e no uso de recursos
resource "aws_instance" "foo" {
provider = "aws.aws-assume"
# ...
}