Skip to content

Register GitHub OIDC on AWS Identity Providers. Create IAM Role and Policy to grant access to ECR repositories from GitHub Actions.

Notifications You must be signed in to change notification settings

shamimice03/terraform-aws-github-oidc-ecr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Register GitHub OIDC and Grant Access to Amazon ECR

Usage:

module "github_to_ecr" {

    source = "github.com/shamimice03/terraform-aws-github-oidc-ecr"

    iam_role_name        = "github-actions-to-ecr"
    iam_role_description = "IAM role to access ecr from github actions using OIDC"
    github_repo_name     = "shamimice03/thumbnail-api-app"
    allowed_branches     = ["main", "dev"]
    ecr_region           = "ap-northeast-1"
    ecr_repo_names       = ["thumbnail-api", "thumbnail-task"]
}

Requirements

Name Version
terraform >= 1.0.0
aws >= 5.0.0
tls >= 4.0.4

Providers

Name Version
aws 5.25.0
tls 4.0.4

Modules

No modules.

Resources

Name Type
aws_iam_openid_connect_provider.github_actions resource
aws_iam_policy.ecr resource
aws_iam_role.github_actions resource
aws_iam_role_policy_attachment.admin resource
aws_caller_identity.current data source
aws_iam_policy_document.ecr data source
aws_iam_policy_document.trust_policy data source
tls_certificate.github_actions data source

Inputs

Name Description Type Default Required
allowed_branches Allowed github branches list(any) [] no
ecr_region ECR region string "" no
ecr_repo_names Name of the ECR repository list(any) [] no
github_repo_name Name of the Github Repo string "" no
iam_role_description IAM Role to access ECR repo from GitHub Actions string "" no
iam_role_name Name of the IAM role for GitHub Actions string "" no

Outputs

Name Description
role_arn arn of the role

About

Register GitHub OIDC on AWS Identity Providers. Create IAM Role and Policy to grant access to ECR repositories from GitHub Actions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages