Earnest-Labs / aws-sts

Generation of AWS STS tokens via SAML authentication.
67 stars 18 forks source link

sortigoza/support-iam-role-refresh-okta-setup #18

Closed sortigoza closed 5 years ago

sortigoza commented 5 years ago

Adds support for the upcoming changes in the "IAM Role Refresh" project which involves splitting the AWS Okta application to one per account instead of one for all account.

This impacts some logic in the STS script since we are now not proxying from the tools account.

The changes in this PR enable to get the STS token for both the previous setup and the new setup.

there are BREAKING CHANGES, the configuration accounts were previously defined as:

"accounts": {
    "development": "aws-account-id",
    "staging": "aws-account-id",
    ...
  },

and now, the account items were upgraded to an object, with fields accountNumber and idpEntryUrl.

"accounts": {
    "development": {
      "accountNumber": "aws-account-id",
      "idpEntryUrl": "https://xxx.okta.com/home/amazon_aws/xxx"
    },
    "staging": {
      "accountNumber": "aws-account-id",
      "idpEntryUrl": "https://xxx.okta.com/home/amazon_aws/xxx"
    },
    ...
  },

The compatibility is maintained by falling back to the config.idpEntryUrl and doing the proxy thing if the account does not have the idpEntryUrl key defined.

Some side changes include:

Splitting this PR into chunks: