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
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,13 @@ Resources:
Statement:
- Effect: Allow
Sid: "AssumeRole"
Condition:
ArnEquals:
"aws:PrincipalArn":
- !GetAtt PipelineManagementApplication.Outputs.CreateRepositoryLambdaRoleArn
- !GetAtt PipelineManagementApplication.Outputs.CreateOrUpdateRuleLambdaRoleArn
Principal:
AWS:
- !GetAtt PipelineManagementApplication.Outputs.CreateRepositoryLambdaRoleArn
- !GetAtt PipelineManagementApplication.Outputs.CreateOrUpdateRuleLambdaRoleArn
AWS: !Sub arn:${AWS::Partition}:iam::${AWS::AccountId}:root
Action:
- sts:AssumeRole
Path: /
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ Resources:
# Statement:
# - Effect: Allow
# Sid: "AssumeRole"
# 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
# Principal:
# AWS:
# - !Sub arn:aws:iam::${DeploymentAccountId}:role/adf-codebuild-role
# AWS: !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
# Action:
# - sts:AssumeRole
# Path: /
Expand Down Expand Up @@ -103,12 +107,16 @@ Resources:
# Statement:
# - Effect: Allow
# Sid: "AssumeRole"
# 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
# # The above role would be created on the deployment account
# # for the purpose deploying this custom resource via CodeBuild
# Principal:
# AWS:
# # 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
# # The above role would be created on the deployment account for the purpose deploying this custom resource via codebuild
# 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 @@ -154,9 +157,12 @@ Resources:
Statement:
- Effect: Allow
Principal:
AWS:
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codepipeline-role
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-cloudformation-role
AWS: !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
Condition:
ArnEquals:
"aws:PrincipalArn":
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codepipeline-role
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-cloudformation-role
Action:
- sts:AssumeRole
Path: /
Expand Down Expand Up @@ -203,12 +209,13 @@ Resources:
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 All @@ -220,9 +227,11 @@ Resources:
Statement:
- Effect: Allow
Sid: "AssumeRoleByEnableCrossAccountLambda"
Condition:
ArnEquals:
"aws:PrincipalArn": !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-enable-cross-account-access-lambda-role
Principal:
AWS:
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-enable-cross-account-access-lambda-role
AWS: !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
Action:
- sts:AssumeRole
Path: /
Expand Down Expand Up @@ -252,10 +261,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 +369,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