Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(adf-bootstrap): (#472) modify trust relations for roles ⚡ #526

Merged
merged 7 commits into from
Jul 24, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,15 @@ Resources:
# Statement:
# - Effect: Allow
# Sid: "AssumeRole"
# Principal:
# AWS:
# Condition:
# ArnEquals:
# 'aws:PrincipalArn':
# # This would allow all codebuild projects to be able to assume this role
# # - !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codebuild-role
# - !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/my-custom-codebuild-role
# # - !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codebuild-role
# - !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/my-custom-codebuild-role
# # The above role would be created on the deployment account for the purpose deploying this custom resource via codebuild
# Principal:
# AWS: !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
# Action:
# - sts:AssumeRole
# Path: /
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ Resources:
Version: "2012-10-17"
Statement:
- Effect: Allow
Condition:
ArnEquals:
"aws:PrincipalArn": !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codepipeline-role"
Principal:
AWS: !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codepipeline-role
AWS: !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
Action:
- sts:AssumeRole
- Effect: Allow
Expand Down Expand Up @@ -199,16 +202,27 @@ Resources:
- cloudformation.amazonaws.com
Action:
- sts:AssumeRole
- Effect: Allow
Sid: "AssumeRoleLambda"
Principal:
AWS:
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
Action:
- sts:AssumeRole
Condition:
ArnEquals:
"aws:PrincipalArn": !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-lambda-role"
sbkok marked this conversation as resolved.
Show resolved Hide resolved
- Effect: Allow
Sid: "AssumeRole"
Principal:
AWS:
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codepipeline-role
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
Action:
- sts:AssumeRole
Condition:
ArnEquals:
"aws:SourceArn": !Sub "arn:${AWS::Partition}:codepipeline:${AWS::Region}:${DeploymentAccountId}:*"
"aws:PrincipalArn": !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codepipeline-role"
Path: /

UpdateCrossAccountAccessByDeploymentAccountRole:
Expand Down Expand Up @@ -252,10 +266,14 @@ Resources:
Statement:
- Effect: Allow
Sid: "AssumeRole"
Condition:
ArnEquals:
"aws:PrincipalArn":
- !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-automation/adf-pipeline-create-update-rule"
- !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-automation/adf-pipeline-create-repository"
Principal:
AWS:
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-automation/adf-pipeline-create-update-rule
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-automation/adf-pipeline-create-repository
- !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:root"
Action:
- sts:AssumeRole
Path: /
Expand Down Expand Up @@ -356,9 +374,12 @@ Resources:
Statement:
- Effect: Allow
Sid: "AssumeRole"
Condition:
ArnEquals:
"aws:PrincipalArn": !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codebuild-role"
Principal:
AWS:
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codebuild-role
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
Action:
- sts:AssumeRole
Path: /
Expand Down
Loading