Skip to content

How do I remove a user from Reference Architecture? #728

Discussion options

You must be logged in to vote

Since MFA tokens are likely created outside of Terraform, you will need to delete these prior to running terraform to remove the account.

I wrote a script for you to handle this a bit easier than Click Ops in the console. I added in deletion of access keys as well, just in case those have to be removed prior to user deletion as well. Extend as you see fit, of course! This script just echoes to the screen, but can trivially be modified to actually run the aws commands.

#!/bin/bash

user=$1

if [[ -z $user ]] ; then
	echo "Specify user to remove access keys and tokens from."
	exit 0
fi

# Check to see if the user exists
aws iam get-user --user-name $user > /dev/null
if [[ $? -ne 0 ]] ; then…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pete0emerson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants