Skip to content

Commit

Permalink
Merge pull request #2531 from guardian/aa/GitHubOidcProvider-tags
Browse files Browse the repository at this point in the history
fix(GitHubOidcProvider): Ensure `AWS::IAM::OIDCProvider` resource is tagged
  • Loading branch information
akash1810 authored Dec 6, 2024
2 parents 5f483a0 + 60639fd commit c07d5c7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/nasty-parrots-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@guardian/cdk": patch
---

Apply the standard `Stack`, `Stage`, `App` and `gu:repo` tags to the `AWS::IAM::OIDCProvider` resource
created via the `GitHubOidcProvider` construct.
13 changes: 11 additions & 2 deletions src/constructs/iam/roles/github-actions.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Template } from "aws-cdk-lib/assertions";
import { simpleGuStackForTesting } from "../../../utils/test";
import { GuTemplate, simpleGuStackForTesting } from "../../../utils/test";
import { GuGetS3ObjectsPolicy } from "../policies";
import { GuGithubActionsRole } from "./github-actions";
import { GitHubOidcProvider, GuGithubActionsRole } from "./github-actions";

describe("The GitHubActionsRole construct", () => {
it("should create the correct resources with minimal config", () => {
Expand Down Expand Up @@ -47,3 +47,12 @@ describe("The GitHubActionsRole construct", () => {
});
});
});

describe("The GitHubOidcProvider construct", () => {
it("should be tagged correctly", () => {
const stack = simpleGuStackForTesting();
new GitHubOidcProvider(stack);

GuTemplate.fromStack(stack).hasGuTaggedResource("AWS::IAM::OIDCProvider");
});
});
1 change: 1 addition & 0 deletions src/constructs/iam/roles/github-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export class GitHubOidcProvider extends CfnResource {
Url: `https://${GITHUB_ACTIONS_ID_TOKEN_REQUEST_DOMAIN}`,
ClientIdList: ["sts.amazonaws.com"],
ThumbprintList: GITHUB_ACTIONS_ID_TOKEN_REQUEST_DOMAIN_THUMBPRINTS,
Tags: scope.tags.renderedTags,
},
});
}
Expand Down

0 comments on commit c07d5c7

Please sign in to comment.