File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232# [$source_profile]
3333# The profile to use for credentials to assume the specified role
3434#
35+ # [credential_source]
36+ # Used within EC2 instances or EC2 containers to specify where the AWS CLI can find credentials
37+ # to use to assume the role you specified with the role_arn parameter.
38+ # You cannot specify both source_profile and credential_source in the same profile.
39+ #
3540# [$role_session_name]
3641# An identifier for the assumed role session
3742#
7075 $aws_secret_access_key = undef ,
7176 $role_arn = undef ,
7277 $source_profile = undef ,
78+ $credential_source = undef ,
7379 $role_session_name = undef ,
7480 $aws_region = ' us-east-1' ,
7581 $profile_name = ' default' ,
108114 $group_real = $group
109115 }
110116
117+ if ($source_profile != undef and $credential_source != undef ) {
118+ fail(" aws cli profile cannot contain both source_profile and credential_source config option" )
119+ }
120+ $valid_credential_sources = [' Environment' , ' Ec2InstanceMetadata' , ' EcsContainer' ]
121+ if (!$credential_source in $valid_credential_sources ) {
122+ fail(" credential_source config option can contain only $valid_credential_sources " )
123+ }
124+
111125 # ensure $homedir/.aws is available
112126 if !defined (File [" ${homedir_real} /.aws" ]) {
113127 file { "${homedir_real}/.aws" :
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ role_arn=<%= @role_arn %>
1111<% if @source_profile -%>
1212source_profile=<%= @source_profile %>
1313<% end -%>
14+ <% if @credential_source -%>
15+ credential_source=<%= @credential_source %>
16+ <% end -%>
1417<% if @role_session_name -%>
1518role_session_name=<%= @role_session_name %>
1619<% end -%>
You can’t perform that action at this time.
0 commit comments