Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions samtranslator/model/iam.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from samtranslator.model import PropertyType, Resource
from samtranslator.model.types import is_type, is_str
from samtranslator.model.types import is_type, is_str, list_of
from samtranslator.model.intrinsics import ref, fnGetAtt


Expand All @@ -10,7 +10,8 @@ class IAMRole(Resource):
'ManagedPolicyArns': PropertyType(False, is_type(list)),
'Path': PropertyType(False, is_str()),
'Policies': PropertyType(False, is_type(list)),
'PermissionsBoundary': PropertyType(False, is_str())
'PermissionsBoundary': PropertyType(False, is_str()),
'Tags': PropertyType(False, list_of(is_type(dict))),
}

runtime_attrs = {
Expand Down
1 change: 1 addition & 0 deletions samtranslator/model/sam_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ def _construct_role(self, managed_policy_map):
execution_role.ManagedPolicyArns = list(managed_policy_arns)
execution_role.Policies = policy_documents or None
execution_role.PermissionsBoundary = self.PermissionsBoundary
execution_role.Tags = self._construct_tag_list(self.Tags)

return execution_role

Expand Down
8 changes: 7 additions & 1 deletion tests/translator/output/alexa_skill.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
10 changes: 8 additions & 2 deletions tests/translator/output/alexa_skill_with_skill_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
"AssumeRolePolicyDocument": {
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
Expand Down
6 changes: 6 additions & 0 deletions tests/translator/output/all_policy_templates.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
"Tags": [
{
"Key": "lambda:createdBy",
"Value": "SAM"
}
],
"Policies": [
{
"PolicyName": "KitchenSinkFunctionRolePolicy0",
Expand Down
8 changes: 7 additions & 1 deletion tests/translator/output/api_cache.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
8 changes: 7 additions & 1 deletion tests/translator/output/api_endpoint_configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
8 changes: 7 additions & 1 deletion tests/translator/output/api_request_model.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
8 changes: 7 additions & 1 deletion tests/translator/output/api_request_model_openapi_3.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
6 changes: 6 additions & 0 deletions tests/translator/output/api_with_access_log_setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
30 changes: 24 additions & 6 deletions tests/translator/output/api_with_apikey_default_override.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,14 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
"AssumeRolePolicyDocument": {
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
Expand All @@ -183,8 +189,14 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
"AssumeRolePolicyDocument": {
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
Expand All @@ -207,8 +219,14 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
"AssumeRolePolicyDocument": {
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
Expand Down
8 changes: 7 additions & 1 deletion tests/translator/output/api_with_apikey_required.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
8 changes: 7 additions & 1 deletion tests/translator/output/api_with_auth_all_maximum.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
16 changes: 14 additions & 2 deletions tests/translator/output/api_with_auth_all_minimum.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down Expand Up @@ -368,7 +374,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
16 changes: 14 additions & 2 deletions tests/translator/output/api_with_auth_all_minimum_openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down Expand Up @@ -351,7 +357,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down Expand Up @@ -534,7 +540,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
16 changes: 14 additions & 2 deletions tests/translator/output/api_with_auth_no_default.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down Expand Up @@ -358,7 +364,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@
"Properties": {
"ManagedPolicyArns": [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
],
],
"Tags": [
{
"Value": "SAM",
"Key": "lambda:createdBy"
}
],
"AssumeRolePolicyDocument": {
"Version": "2012-10-17",
"Statement": [
Expand Down
Loading