-
Notifications
You must be signed in to change notification settings - Fork 823
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: refactor to use oidc instead of iam users
Signed-off-by: Richard Case <[email protected]>
- Loading branch information
1 parent
640607f
commit 1f526a9
Showing
5 changed files
with
44 additions
and
130 deletions.
There are no files selected for viewing
37 changes: 0 additions & 37 deletions
37
infra/aws/terraform/cncf-k8s-infra-aws-capa-ami/iam-capa-maintainers-group.tf
This file was deleted.
Oops, something went wrong.
64 changes: 0 additions & 64 deletions
64
infra/aws/terraform/cncf-k8s-infra-aws-capa-ami/iam-capa-maintainers-users.tf
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
resource "aws_iam_openid_connect_provider" "github" { | ||
url = "https://token.actions.githubusercontent.com" | ||
|
||
client_id_list = [ | ||
"sts.amazonaws.com", | ||
] | ||
|
||
thumbprint_list = ["d89e3bd43d5d909b47a18977aa9d5ce36cee184c"] | ||
} | ||
|
||
data "aws_iam_policy_document" "capa-gh-trust" { | ||
statement { | ||
actions = ["sts:AssumeRoleWithWebIdentity"] | ||
|
||
principals { | ||
type = "Federated" | ||
identifiers = [aws_iam_openid_connect_provider.github.arn] | ||
} | ||
|
||
condition { | ||
test = "ForAnyValue:StringEquals" | ||
variable = "token.actions.githubusercontent.com:aud" | ||
values = ["sts.amazonaws.com"] | ||
} | ||
|
||
condition { | ||
test = "StringLike" | ||
variable = "token.actions.githubusercontent.com:sub" | ||
values = ["repo:kubernetes-sigs/cluster-api-provider-aws"] | ||
} | ||
} | ||
} | ||
|
||
resource "aws_iam_role" "gh-image-builder" { | ||
name = "gh-image-builder" | ||
assume_role_policy = data.aws_iam_policy_document.capa-gh-trust.json | ||
} | ||
|
||
resource "aws_iam_role_policy_attachment" "gh-image-builder" { | ||
role = aws_iam_role.gh-image-builder.name | ||
policy_arn = aws_iam_policy.imagebuilder.arn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters