Guest User

Untitled

a guest
Jul 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. WebAppRole:
  2. Type: "AWS::IAM::Role"
  3. Properties:
  4. AssumeRolePolicyDocument:
  5. Version: "2012-10-17"
  6. Statement:
  7. - Effect: "Allow"
  8. Action:
  9. - "sts:AssumeRole"
  10. Principal:
  11. AWS:
  12. - !Sub
  13. - "arn:aws:iam::${AccountNumber}:user/<ci_user>"
  14. - { AccountNumber: !FindInMap [ AccountNumberMap, !Ref Env, AccountNumber ] }
  15. ......
  16. ......
  17. ......
  18. BaseCloudFormationPolicy:
  19. Type: "AWS::IAM::Policy"
  20. Properties:
  21. PolicyName: <ci_policy_name>
  22. Users:
  23. - !Ref <ci_user> ## attach to our ci_user
  24. PolicyDocument:
  25. Version: "2012-10-17"
  26. Statement:
  27. - Effect: "Allow"
  28. ...
  29. ...
  30. - "cloudformation:ExecuteChangeSet"
  31. - "cloudformation:DescribeStacks"
  32. Resource:
  33. - !Sub ## the user can only execute the specific stacks we say
  34. - "arn:aws:cloudformation:${Region}:${AccountNumber}:stack/<web-stack>/*"
  35. - { AccountNumber: !FindInMap [ AccountNumberMap, !Ref Env, AccountNumber ], Region: 'AWS::Region' }
  36. ...
  37. ...
  38. - Effect: "Allow"
  39. Action:
  40. - "sts:AssumeRole" ## we actually assume this role instead of pass. This is because we use
  41. ## s3 sync, instead of cloudformation cli & it doens't support --role-arn, only --profile
  42. Resource:
  43. - !Sub
  44. - "arn:aws:iam::${AccountNumber}:role/webapp_deploy_role"
  45. - { AccountNumber: !FindInMap [ AccountNumberMap, !Ref Env, AccountNumber ] }
Add Comment
Please, Sign In to add comment