Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3
Terraform module to configure GitLab Runner as an IAM OIDC identity provider in AWS
License
saidsef/terraform-aws-gitlab-oidc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This Terraform module enables you to configure GitLab Runners as an AWS IAM OIDC identity provider in AWS, which enables GitLab Runners to access resources within an AWS account(s) without requiring long-lived credentials to be stored as GitLab secrets.
- AWS Account(s) and credentials
- GitLab repository
- Terraform >= 1.x
- ...
- Profit?
provider"aws" {region=var.region}module"gitlab_oidc" {source="saidsef/gitlab-oidc/aws"version=">= 1"attach_read_only_policy=truegitlab_organisation="saidsef"gitlab_repositories=[ { name="terraform-aws-gitlab-oidc", refs= ["main","pr-*","*pull*","*"] ref_type="branch" }, { name="terraform-aws-gitlab-oidc", refs= ["*"] ref_type="tag" }]tags=var.tags}
Please seeTERRAFORM.md
Retrieve temporary credentials viaGitLab Runner
terraform-aws-gitlab-oidc/.gitlab-ci.yml
Lines 16 to 28 ina9f7cf0
.assume-role: | |
before_script: | |
-> | |
STS=($(aws sts assume-role-with-web-identity | |
--role-arn $ROLE_ARN | |
--role-session-name "GitLabRunner-${CI_PROJECT_ID}-${CI_PIPELINE_ID}" | |
--web-identity-token $CI_JOB_JWT_V2 | |
--duration-seconds 3600 | |
--query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' | |
--output text)) | |
-export AWS_ACCESS_KEY_ID="${STS[0]}" | |
-export AWS_SECRET_ACCESS_KEY="${STS[1]}" | |
-export AWS_SESSION_TOKEN="${STS[2]}" |
CI_JOB_JWT
andCI_JOB_JWT_V2
weredeprecated in GitLab 15.9 and are scheduled to be removed in GitLab 17.0. UseID tokens instead.
terraform-aws-gitlab-oidc/.gitlab-ci.yml
Lines 16 to 32 in3546911
.assume-role: | |
id_tokens: | |
AWS_ID_TOKEN: | |
aud:https://oidc.provider.com | |
before_script: | |
-> | |
STS=($(aws sts assume-role-with-web-identity | |
--role-arn $ROLE_ARN | |
--region $AWS_REGION | |
--role-session-name "GitLabRunner-${CI_PROJECT_ID}-${CI_PIPELINE_ID}" | |
--web-identity-token $AWS_ID_TOKEN | |
--duration-seconds 3600 | |
--query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]' | |
--output text)) | |
-export AWS_ACCESS_KEY_ID="${STS[0]}" | |
-export AWS_SECRET_ACCESS_KEY="${STS[1]}" | |
-export AWS_SESSION_TOKEN="${STS[2]}" |
Our latest and greatest source ofterraform-aws-gitlab-oidc
can be found onGitHub. Fork us!
We would ❤️ you to contribute by making apull request.
Please read the officialContribution Guide for more information on how you can contribute.
About
Terraform module to configure GitLab Runner as an IAM OIDC identity provider in AWS
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.