|
32 | 32 | # [$source_profile] |
33 | 33 | # The profile to use for credentials to assume the specified role |
34 | 34 | # |
| 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 | +# |
35 | 40 | # [$role_session_name] |
36 | 41 | # An identifier for the assumed role session |
37 | 42 | # |
|
62 | 67 | # } |
63 | 68 | # |
64 | 69 | define awscli::profile( |
65 | | - $ensure = 'present', |
66 | | - $user = 'root', |
67 | | - $group = undef, |
68 | | - $homedir = undef, |
69 | | - $aws_access_key_id = undef, |
70 | | - $aws_secret_access_key = undef, |
71 | | - $role_arn = undef, |
72 | | - $source_profile = undef, |
73 | | - $role_session_name = undef, |
74 | | - $aws_region = 'us-east-1', |
75 | | - $profile_name = 'default', |
76 | | - $output = 'json', |
| 70 | + $ensure = 'present', |
| 71 | + $user = 'root', |
| 72 | + $group = undef, |
| 73 | + $homedir = undef, |
| 74 | + $aws_access_key_id = undef, |
| 75 | + $aws_secret_access_key = undef, |
| 76 | + $role_arn = undef, |
| 77 | + $source_profile = undef, |
| 78 | + Optional[Enum['Environment', 'Ec2InstanceMetadata', 'EcsContainer']] $credential_source = undef, |
| 79 | + $role_session_name = undef, |
| 80 | + $aws_region = 'us-east-1', |
| 81 | + $profile_name = 'default', |
| 82 | + $output = 'json', |
77 | 83 | ) { |
78 | 84 | if $aws_access_key_id == undef and $aws_secret_access_key == undef { |
79 | 85 | info ('AWS keys for awscli::profile. Your will need IAM roles configured.') |
|
108 | 114 | $group_real = $group |
109 | 115 | } |
110 | 116 |
|
| 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 | + |
111 | 121 | # ensure $homedir/.aws is available |
112 | 122 | if !defined(File["${homedir_real}/.aws"]) { |
113 | 123 | file { "${homedir_real}/.aws": |
|
0 commit comments