Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Commit

Permalink
fixes #78
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwittig committed Aug 15, 2017
1 parent b1d3bd2 commit fc61802
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions import_users.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ fi
: ${USERADD_ARGS:="--create-home --shell /bin/bash"}

# Initizalize INSTANCE variable
INSTANCE_ID=$(curl -s http://instance-data//latest/meta-data/instance-id)
INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
REGION=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')

function log() {
/usr/bin/logger -i -p auth.info -t aws-ec2-ssh "$@"
Expand Down Expand Up @@ -74,10 +75,9 @@ function get_iam_groups_from_tag() {
if [ "${IAM_AUTHORIZED_GROUPS_TAG}" ]
then
IAM_AUTHORIZED_GROUPS=$(\
aws ec2 describe-tags \
aws --region $REGION ec2 describe-tags \
--filters "Name=resource-id,Values=$INSTANCE_ID" "Name=key,Values=$IAM_AUTHORIZED_GROUPS_TAG" \
--query "Tags[0].Value" \
--output text \
--query "Tags[0].Value" --output text \
)
fi
}
Expand Down Expand Up @@ -123,10 +123,9 @@ function get_sudoers_groups_from_tag() {
if [ "${SUDOERS_GROUPS_TAG}" ]
then
SUDOERS_GROUPS=$(\
aws ec2 describe-tags \
aws --region $REGION ec2 describe-tags \
--filters "Name=resource-id,Values=$INSTANCE_ID" "Name=key,Values=$SUDOERS_GROUPS_TAG" \
--query "Tags[0].Value" \
--output text \
--query "Tags[0].Value" --output text \
)
fi
}
Expand Down

0 comments on commit fc61802

Please sign in to comment.