Terraform module to configure Bitbucket pipelines with AWS Identity Provider Open ID Connect (ODIC.)
This allows Bitbucket pipelines to authenticate against AWS without using any long-lived keys.
This module provisions the necessary role and permissions as defined in the
Bitbucket docs.
Multiple repo configuration
This module allows you to create roles for lists of repos(subjects) and policies in the AWS account.
Curently it only supports policies in the same account as the role being created.
This is helpful for non-mono repo style groups as well as for large organizations where teams have separate repo ownership for the same AWS account.
Debugging features
The assume_role_names input allows you to assume the OIDC role and act as if you were the Bitbucket pipeline.
This is very useful for debugging while you're getting things setup.
Note: we recommend removing this once your production ready so that all further changes are only applied via the pipeline.
Example Bitbucket Pipeline
image: amazon/aws-clipipelines:
default:
- step:
name: 'test oidc'oidc: truescript:
- export AWS_REGION=us-west-2
- export AWS_ROLE_ARN=arn:aws:iam::{accountid}:role/bucket-test
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
- aws sts get-caller-identity --query "Arn" --output textn be up to the max set in the terraform module, defaults to 15 min
Maximum session duration in seconds. - by default assume role will be 15 minutes - when calling from actions you'll need to increase up to the maximum allowed hwere
role name to repos and policies mapping. role name as the key and object value for repo subjects ie "{REPOSITORY_UUID}[:{ENVIRONMENT_UUID}]:{STEP_UUID} or " as well as a list of policy arns ie ["Administrator"] and list of roles that can assume the new role for debugging