-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add create-profile.USERNAME.sh generation
- Loading branch information
Showing
6 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,3 +57,6 @@ | |
|
|
||
| * 2.7.4 -- 2022-06-27 | ||
| - fix pgp key detection | ||
|
|
||
| * 2.8.0 -- 2022-08-01 | ||
| - add create-profile.USERNAME.sh generation | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/bin/bash | ||
|
|
||
| VERSION="1.0.2" | ||
| SOURCE_PROFILE=$1 | ||
| if [ -z "$SOURCE_PROFILE" ] | ||
| then | ||
| SOURCE_PROFILE="${source_profile}" | ||
| fi | ||
|
|
||
| if [ -z $USER ] | ||
| then | ||
| USER="${username}" | ||
| fi | ||
|
|
||
| %{ for group,arn in groups ~} | ||
| NEW_PROFILE="${profile_prefix}-${group}" | ||
| if [ $(aws configure list-profiles | grep -c ^$NEW_PROFILE$) == 0 ] | ||
| then | ||
| echo "echo \"# v$VERSION: creating assume-role profile $NEW_PROFILE\"" | ||
| echo "aws configure set profile.$NEW_PROFILE.source_profile $SOURCE_PROFILE" | ||
| echo "aws configure set profile.$NEW_PROFILE.region ${source_region}" | ||
| echo "aws configure set profile.$NEW_PROFILE.role_arn ${arn}" | ||
| echo "aws configure set profile.$NEW_PROFILE.role_session_name $USER" | ||
| else | ||
| echo "echo \"# profile $NEW_PROFILE already created with source_profile $SOURCE_PROFILE\"" | ||
| fi | ||
| echo "echo \"# TEST: aws --profile $NEW_PROFILE sts get-caller-identity\"" | ||
| echo "echo \"\"" | ||
|
|
||
| %{ endfor ~} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| #!/bin/bash | ||
|
|
||
| VERSION="1.0.1" | ||
| SOURCE_PROFILE=$1 | ||
| if [ -z "$SOURCE_PROFILE" ] | ||
| then | ||
| SOURCE_PROFILE="${source_profile}" | ||
| fi | ||
|
|
||
| if [ -z $USER ] | ||
| then | ||
| USER="${username}" | ||
| fi | ||
|
|
||
| if [ -z $FILE ] | ||
| then | ||
| FILE="access_key.yml" | ||
| fi | ||
|
|
||
| if [ ! -r $FILE ] | ||
| then | ||
| echo "# unable to find $FILE, exiting" | ||
| exit 1 | ||
| fi | ||
|
|
||
| aws_access_key_id=$( grep ^access_key_id: $FILE | sed -e 's/^.*: *//') | ||
| aws_secret_access_key=$( grep ^access_secret_key: $FILE | sed -e 's/^.*: *//') | ||
|
|
||
| if [ -z $aws_access_key_id ] | ||
| then | ||
| echo "# access_key_id missing from $FILE" | ||
| exit 1 | ||
| fi | ||
| if [ -z $aws_secret_access_key ] | ||
| then | ||
| echo "# acess_secret_key missing from $FILE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ $(aws configure list-profiles | grep -c ^$SOURCE_PROFILE$) == 0 ] | ||
| then | ||
| echo "echo \"# v$VERSION: creating source profile $SOURCE_PROFILE\"" | ||
| echo "aws configure set profile.$SOURCE_PROFILE.aws_access_key_id $aws_access_key_id" | ||
| echo "aws configure set profile.$SOURCE_PROFILE.aws_secret_access_key $aws_secret_access_key" | ||
| echo "aws configure set profile.$SOURCE_PROFILE.region ${source_region}" | ||
| echo "aws configure set profile.$SOURCE_PROFILE.output json" | ||
| else | ||
| echo "echo \"# profile $SOURCE_PROFILE already created\"" | ||
| fi | ||
| echo "echo \"# TEST: aws --profile $SOURCE_PROFILE sts get-caller-identity\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| locals { | ||
| _module_name = "aws-iam-user" | ||
| _module_version = "2.7.4" | ||
| _module_version = "2.8.0" | ||
| } |