Updates for IAM changes.
This commit is contained in:
parent
7b81a0cb95
commit
20dda251f8
@ -19,13 +19,20 @@ class Role(object):
|
|||||||
def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
|
def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
|
||||||
properties = cloudformation_json['Properties']
|
properties = cloudformation_json['Properties']
|
||||||
|
|
||||||
return iam_backend.create_role(
|
role = iam_backend.create_role(
|
||||||
role_name=resource_name,
|
role_name=resource_name,
|
||||||
assume_role_policy_document=properties['AssumeRolePolicyDocument'],
|
assume_role_policy_document=properties['AssumeRolePolicyDocument'],
|
||||||
path=properties['Path'],
|
path=properties['Path'],
|
||||||
policies=properties.get('Policies', []),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
policies = properties.get('Policies', [])
|
||||||
|
for policy in policies:
|
||||||
|
policy_name = policy['PolicyName']
|
||||||
|
policy_json = policy['PolicyDocument']
|
||||||
|
role.put_policy(policy_name, policy_json)
|
||||||
|
|
||||||
|
return role
|
||||||
|
|
||||||
def put_policy(self, policy_name, policy_json):
|
def put_policy(self, policy_name, policy_json):
|
||||||
self.policies[policy_name] = policy_json
|
self.policies[policy_name] = policy_json
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user