Skip to content

Commit

Permalink
replace IAM user credentials with IAM role arn
Browse files Browse the repository at this point in the history
  • Loading branch information
danlu1 committed Jun 10, 2024
1 parent da05be2 commit 2be7089
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/configure-tower-projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,16 +528,16 @@ def create_credentials(self) -> int:
assert cred["deleted"] is None
return cred["id"]
# Otherwise, create a new credentials entry for the project
secret_arn = self.stack["TowerForgeServiceUserAccessKeySecretArn"]
secret_arn = self.stack["TowerRoleArn"]
credentials = self.org.aws.get_secret_value(secret_arn)
data = {
"credentials": {
"name": self.stack_name,
"provider": "aws",
"keys": {
"accessKey": credentials["aws_access_key_id"],
"secretKey": credentials["aws_secret_access_key"],
"assumeRoleArn": self.stack["TowerForgeServiceRoleArn"],
#"secretKey": credentials["aws_secret_access_key"],
"assumeRoleArn": self.stack["TowerRoleArn"],
},
"description": f"Credentials for {self.stack_name}",
}
Expand Down
3 changes: 3 additions & 0 deletions templates/tower-project.j2
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ Resources:
- !GetAtt TowerForgeBatchHeadJobRole.Arn
- !GetAtt TowerForgeBatchWorkJobRole.Arn
- !GetAtt TowerForgeServiceRole.Arn
- !GetAtt TowerRole.Arn
- !Join
- ","
- !Ref AccountAdminArns
Expand Down Expand Up @@ -374,6 +375,7 @@ Resources:
- !GetAtt TowerForgeServiceRole.Arn
- !GetAtt TowerForgeBatchHeadJobRole.Arn
- !GetAtt TowerForgeBatchWorkJobRole.Arn
- !GetAtt TowerRole.Arn
Action:
- "s3:GetBucketLocation"
- "s3:ListBucket"
Expand Down Expand Up @@ -511,6 +513,7 @@ Resources:
- !GetAtt TowerForgeServiceRole.Arn
- !GetAtt TowerForgeBatchHeadJobRole.Arn
- !GetAtt TowerForgeBatchWorkJobRole.Arn
- !GetAtt TowerRole.Arn
Action:
- "s3:GetBucketLocation"
- "s3:ListBucket"
Expand Down

0 comments on commit 2be7089

Please sign in to comment.