Deploy to AWS using ADFS login

Viewed 274

We assume roles in AWS via ADFS as a saml IDP. Now I would like to deploy to AWS from Terraform.

Is there any way of configuring Terraforms AWS Provider to use ADFS?

1 Answers

If you can run the AWS CLI, you can run terraform. There are multiple ways to use ADFS to log in. This answer will focus on using environment variables.

You need AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN to be set as environment variables when calling terraform.

AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are fixed per account, and only change if rotated. AWS_SESSION_TOKEN is temporary, and typically is set to time out after an hour. You get the session token by using the get-session-token command.

There are multiple tools set up to simplify getting the session token - aws-adfs is a useful python based one.

Related