Skip to content

Instantly share code, notes, and snippets.

@mrserverless
Last active November 1, 2018 08:18
Show Gist options
  • Save mrserverless/e5cab300e4537cb4ea9b4b4eb56a3077 to your computer and use it in GitHub Desktop.
Save mrserverless/e5cab300e4537cb4ea9b4b4eb56a3077 to your computer and use it in GitHub Desktop.
make assumeRole
_assumeRole:
ifndef AWS_SESSION_TOKEN
$(eval ROLE = "$(shell aws sts assume-role --role-arn "$(TF_VAR_provider_role)" --role-session-name "terraform-assume-role" --query "Credentials.[AccessKeyId, SecretAccessKey, SessionToken]" --output text)")
$(eval export AWS_ACCESS_KEY_ID = $(shell echo $(ROLE) | cut -f1))
$(eval export AWS_SECRET_ACCESS_KEY = $(shell echo $(ROLE) | cut -f2))
$(eval export AWS_SESSION_TOKEN = $(shell echo $(ROLE) | cut -f3))
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment