Skip to content

Commit

Permalink
feat(adf-bootstrap): (awslabs#472) fix StringEquals to ArnEquals cond…
Browse files Browse the repository at this point in the history
…ition ⚡
  • Loading branch information
AndreasAugustin committed Sep 7, 2022
1 parent 0f892b8 commit 9c11d71
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Resources:
# - Effect: Allow
# Sid: "AssumeRole"
# Condition:
# StringEquals:
# 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Resources:
Statement:
- Effect: Allow
Condition:
StringEquals:
'aws:PrincipalArn': !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codepipeline-role
ArnEquals:
"aws:PrincipalArn": !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codepipeline-role"
Principal:
AWS: !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
Action:
Expand Down Expand Up @@ -205,8 +205,8 @@ Resources:
- Effect: Allow
Sid: "AssumeRoleLambda"
Condition:
StringEquals:
'aws:PrincipalArn': !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-lambda-role
ArnEquals:
"aws:PrincipalArn": !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-lambda-role"
Principal:
AWS:
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
Expand All @@ -220,11 +220,9 @@ Resources:
Action:
- sts:AssumeRole
Condition:
Fn::And:
- ArnEquals:
"aws:SourceArn": !Sub "arn:${AWS::Partition}:codepipeline:${AWS::Region}:${DeploymentAccountId}:*"
- StringEquals:
'aws:PrincipalArn': !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codepipeline-role
ArnEquals:
"aws:SourceArn": !Sub "arn:${AWS::Partition}:codepipeline:${AWS::Region}:${DeploymentAccountId}:*"
"aws:PrincipalArn": !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codepipeline-role"
Path: /

AdfAutomationRole:
Expand All @@ -241,11 +239,11 @@ Resources:
- Effect: Allow
Sid: "AssumeRole"
Condition:
StringEquals:
'aws:PrincipalArn': !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-pipeline-provisioner-codebuild-role
ArnEquals:
"aws:PrincipalArn": !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-pipeline-provisioner-codebuild-role"
Principal:
AWS:
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
- !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:root"
Action:
- sts:AssumeRole
Path: /
Expand Down Expand Up @@ -346,8 +344,8 @@ Resources:
- Effect: Allow
Sid: "AssumeRole"
Condition:
StringEquals:
'aws:PrincipalArn': !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codebuild-role
ArnEquals:
"aws:PrincipalArn": !Sub "arn:${AWS::Partition}:iam::${DeploymentAccountId}:role/adf-codebuild-role"
Principal:
AWS:
- !Sub arn:${AWS::Partition}:iam::${DeploymentAccountId}:root
Expand Down

0 comments on commit 9c11d71

Please sign in to comment.