Skip to content

Commit 260e473

Browse files
to-mckeetonian
authored andcommitted
feat: function role tag propagation (#1194)
1 parent a882020 commit 260e473

File tree

393 files changed

+4349
-448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

393 files changed

+4349
-448
lines changed

samtranslator/model/iam.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from samtranslator.model import PropertyType, Resource
2-
from samtranslator.model.types import is_type, is_str
2+
from samtranslator.model.types import is_type, is_str, list_of
33
from samtranslator.model.intrinsics import ref, fnGetAtt
44

55

@@ -10,7 +10,8 @@ class IAMRole(Resource):
1010
'ManagedPolicyArns': PropertyType(False, is_type(list)),
1111
'Path': PropertyType(False, is_str()),
1212
'Policies': PropertyType(False, is_type(list)),
13-
'PermissionsBoundary': PropertyType(False, is_str())
13+
'PermissionsBoundary': PropertyType(False, is_str()),
14+
'Tags': PropertyType(False, list_of(is_type(dict))),
1415
}
1516

1617
runtime_attrs = {

samtranslator/model/sam_resources.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ def _construct_role(self, managed_policy_map):
269269
execution_role.ManagedPolicyArns = list(managed_policy_arns)
270270
execution_role.Policies = policy_documents or None
271271
execution_role.PermissionsBoundary = self.PermissionsBoundary
272+
execution_role.Tags = self._construct_tag_list(self.Tags)
272273

273274
return execution_role
274275

tests/translator/output/alexa_skill.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
"Properties": {
88
"ManagedPolicyArns": [
99
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
10-
],
10+
],
11+
"Tags": [
12+
{
13+
"Value": "SAM",
14+
"Key": "lambda:createdBy"
15+
}
16+
],
1117
"AssumeRolePolicyDocument": {
1218
"Version": "2012-10-17",
1319
"Statement": [

tests/translator/output/alexa_skill_with_skill_id.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77
"Properties": {
88
"ManagedPolicyArns": [
99
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
10-
],
11-
"AssumeRolePolicyDocument": {
10+
],
11+
"Tags": [
12+
{
13+
"Value": "SAM",
14+
"Key": "lambda:createdBy"
15+
}
16+
],
17+
"AssumeRolePolicyDocument": {
1218
"Version": "2012-10-17",
1319
"Statement": [
1420
{

tests/translator/output/all_policy_templates.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
"ManagedPolicyArns": [
3030
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
3131
],
32+
"Tags": [
33+
{
34+
"Key": "lambda:createdBy",
35+
"Value": "SAM"
36+
}
37+
],
3238
"Policies": [
3339
{
3440
"PolicyName": "KitchenSinkFunctionRolePolicy0",

tests/translator/output/api_cache.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
"Properties": {
66
"ManagedPolicyArns": [
77
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
8-
],
8+
],
9+
"Tags": [
10+
{
11+
"Value": "SAM",
12+
"Key": "lambda:createdBy"
13+
}
14+
],
915
"AssumeRolePolicyDocument": {
1016
"Version": "2012-10-17",
1117
"Statement": [

tests/translator/output/api_endpoint_configuration.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@
3333
"Properties": {
3434
"ManagedPolicyArns": [
3535
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
36-
],
36+
],
37+
"Tags": [
38+
{
39+
"Value": "SAM",
40+
"Key": "lambda:createdBy"
41+
}
42+
],
3743
"AssumeRolePolicyDocument": {
3844
"Version": "2012-10-17",
3945
"Statement": [

tests/translator/output/api_request_model.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
"Properties": {
66
"ManagedPolicyArns": [
77
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
8-
],
8+
],
9+
"Tags": [
10+
{
11+
"Value": "SAM",
12+
"Key": "lambda:createdBy"
13+
}
14+
],
915
"AssumeRolePolicyDocument": {
1016
"Version": "2012-10-17",
1117
"Statement": [

tests/translator/output/api_request_model_openapi_3.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
"Properties": {
66
"ManagedPolicyArns": [
77
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
8-
],
8+
],
9+
"Tags": [
10+
{
11+
"Value": "SAM",
12+
"Key": "lambda:createdBy"
13+
}
14+
],
915
"AssumeRolePolicyDocument": {
1016
"Version": "2012-10-17",
1117
"Statement": [

tests/translator/output/api_with_access_log_setting.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
"ManagedPolicyArns": [
3030
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
3131
],
32+
"Tags": [
33+
{
34+
"Value": "SAM",
35+
"Key": "lambda:createdBy"
36+
}
37+
],
3238
"AssumeRolePolicyDocument": {
3339
"Version": "2012-10-17",
3440
"Statement": [

0 commit comments

Comments
 (0)