GithubHelp home page GithubHelp logo

ministryofjustice / moj-terraform-scim-github Goto Github PK

View Code? Open in Web Editor NEW
0.0 9.0 2.0 211 KB

Lambda function for automatic SCIM provisioning based on GitHub relationships • This repository is defined and managed in Terraform

License: MIT License

JavaScript 65.87% HCL 34.13%
operations-engineering

moj-terraform-scim-github's Introduction

moj-terraform-scim-github

repo standards badge

This Terraform module configures a Lambda function for provisioning (and deprovisioning) AWS SSO Identity Store users and groups from GitHub.

The Lambda function used to use the SCIM endpoints (hence its name, moj-terraform-scim-github), but now uses the direct Identity Store API. The SCIM API has limitations such as not being able to list more than 50 groups or members (and doesn't support startIndex, so you can't paginate them), whereas the Identity Store API does allow pagination. This allows us to deprovision users and groups using the Identity Store API, which you cannot do easily with the SCIM API.

Usage

module "scim" {
  source                = "github.com/ministryofjustice/moj-terraform-scim-github"
  github_organisation   = "ministryofjustice"
  github_token          = "${var.github_token}"
  sso_aws_region        = "eu-west-2"
  sso_email_suffix      = "@example.com"
  sso_identity_store_id = "${var.sso_tenant_id}"
  not_dry_run           = true
}

Requirements

Name Version
terraform >= 1.0
archive >= 2.4.0
aws >= 5.0.0
external >= 2.3.0

Providers

Name Version
archive >= 2.4.0
aws >= 5.0.0
external >= 2.3.0

Modules

No modules.

Resources

Name Type
aws_cloudwatch_event_rule.default resource
aws_cloudwatch_event_target.default resource
aws_cloudwatch_log_group.default resource
aws_iam_policy.default resource
aws_iam_role.default resource
aws_iam_role_policy_attachment.default resource
aws_lambda_function.default resource
aws_lambda_permission.default resource
archive_file.function data source
aws_caller_identity.current data source
aws_iam_policy_document.assume-role data source
aws_iam_policy_document.default data source
aws_kms_alias.lambda data source
external_external.node_modules data source

Inputs

Name Description Type Default Required
github_organisation GitHub organisation to sync SSO groups and members from string n/a yes
github_token GitHub token to perform API calls. Must have the following scopes: read:org string n/a yes
not_dry_run Whether this is a dry run Lambda or not string false no
sso_aws_region Region that AWS SSO is configured in (required for the SCIM URL) string n/a yes
sso_email_suffix Email suffix to use in AWS SSO. It's arbitrary, but may be useful if syncing more than one GitHub organisation string n/a yes
sso_identity_store_id AWS SSO Identity Store ID. Available from the AWS SSO Identity Source settings string n/a yes
tags Tags to apply to resources, where applicable map(any) {} no

Outputs

No outputs.

Running the function locally

To run the function locally add the following line to the end of the index.js file:

(async function() { await module.exports.handler() })()

From the function folder, ensure you have the correct version of node installed and run npm install. Set your AWS root account credentials and then run the fuction with:

GITHUB_ORGANISATION=ministryofjustice GITHUB_TOKEN=<your token> SSO_AWS_REGION=eu-west-2 SSO_EMAIL_SUFFIX='@digital.justice.gov.uk' SSO_IDENTITY_STORE_ID=<the ID from console> node index.js

Replacing with an appropriate GitHub token etc.

moj-terraform-scim-github's People

Contributors

ben-al avatar davidkelliott avatar dependabot[bot] avatar github-actions[bot] avatar jakemulley avatar jasonbirchall avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moj-terraform-scim-github's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.