Skip to content

Commit

Permalink
Github Automation App Access Role (#81)
Browse files Browse the repository at this point in the history
Signed-off-by: Prudhvi Godithi <[email protected]>
  • Loading branch information
prudhvigodithi authored Oct 2, 2024
1 parent 582e7a2 commit 6a23bf1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion infrastructure/lib/infrastructure-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export class InfrastructureStack extends Stack {
new ArnPrincipal(Project.JENKINS_MASTER_ROLE),
new ArnPrincipal(Project.JENKINS_AGENT_ROLE)
]
}
},
githubAutomationAppAccess: gitHubAutomationApp.githubAppRole.roleArn
});

// Create OpenSearch Metrics Lambda setup
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/lib/stacks/opensearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface OpenSearchStackProps {
readonly vpcStack: VpcStack;
readonly enableNginxCognito: boolean;
readonly jenkinsAccess?: jenkinsAccess;
readonly githubAutomationAppAccess?: string;
}


Expand Down Expand Up @@ -130,6 +131,9 @@ export class OpenSearchDomainStack extends Stack {
});
clusterAccessPolicy.addPrincipals(new ArnPrincipal(jenkinsAccessRole.roleArn))
}
if (props.githubAutomationAppAccess) {
clusterAccessPolicy.addPrincipals(new ArnPrincipal(props.githubAutomationAppAccess))
}

this.domain = new Domain(this, 'OpenSearchHealthDomain', {
version: EngineVersion.OPENSEARCH_2_13,
Expand Down
3 changes: 2 additions & 1 deletion infrastructure/test/opensearch-stack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ test('OpenSearchDomain Stack Test', () => {
new ArnPrincipal(Project.JENKINS_MASTER_ROLE),
new ArnPrincipal(Project.JENKINS_AGENT_ROLE)
]
}
},
githubAutomationAppAccess: "sample-role-arn"
});
const openSearchDomainStackTemplate = Template.fromStack(openSearchDomainStack);
openSearchDomainStackTemplate.resourceCountIs('AWS::IAM::Role', 8);
Expand Down

0 comments on commit 6a23bf1

Please sign in to comment.