This guide will walk you through the process of setting up an OIDC Provider in AWS IAM for CircleCI using Terraform.
- AWS Account with necessary permissions.
- CircleCI account.
- Terraform installed on your local machine.
To set up an OIDC Provider, you need your CircleCI Organization ID. Follow these steps to obtain it:
- Log in to your CircleCI account.
- Navigate to the Organization Settings.
- Look for the organization ID in the URL or in the settings.
For more detailed instructions, watch this YouTube video.
-
Navigate to : Identity providers
-
Click on add Provider Button
-
Provider URL: https://oidc.circleci.com/org/${YOUR ORGANIZATION ID}
-
Audience : ${YOUR ORGANIZATION ID}
Create Role with "Custom trust policy"
your Trust policy will be
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::${account id}:oidc-provider/oidc.circleci.com/org/${YOUR ORGANIZATION ID}"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringLike": {
"oidc.circleci.com/org/${YOUR ORGANIZATION ID}:sub": "org/${YOUR ORGANIZATION ID}/project/${Project ID}/user/*"
}
}
}
]
}
For more detailed instructions, watch this YouTube video.