Skip to content

Commit

Permalink
Add add_user_to_multiple_services pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
luisffc committed Nov 24, 2023
1 parent 3b70315 commit 77c4c1b
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 0 deletions.
9 changes: 9 additions & 0 deletions add_user_to_multiple_services/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Add User to Multiple Services

Adds a user to multiple services.

## Usage

- Add your services API keys / tokens to `flowpipe.pvars`
- Start your Flowpipe server
- Run the pipeline e.g., `flowpipe pipeline run add_user_to_multiple_services --pipeline-arg [email protected] --pipeline-arg services=['github', 'okta']`
49 changes: 49 additions & 0 deletions add_user_to_multiple_services/add_user_to_multiple_services.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
pipeline "add_user_to_multiple_services" {
title = "Add User to Multiple Services"
description = "Adds a user to multiple services."

param "user_email" {
type = string
description = "The email address of the user to create."
}

param "services" {
type = list(string)
description = "The services to create the user on. Currently supported: github and okta."
}

param "okta_group_id" {
description = "The ID of the Okta group to add the user to."
type = string
default = var.okta_default_group_id
}

step "pipeline" "add_user_to_github_organization" {
if == contains(param.services, "github")
pipeline = github.pipeline.create_organization_invitation
args = {
organization = var.github_organization
email = param.user_email
}
}

step "pipeline" "add_user_to_okta_group" {
if == contains(param.services, "okta")
pipeline = okta.pipeline.create_user
args = {
group_id = param.okta_group_id
user_id = param.user_email
}
}

// output "add_user_to_okta_group" {
// if == contains(param.services, "okta")
// value = step.pipeline.add_user_to_okta_group
// }

output "github_invitation" {
if == contains(param.services, "github")
value = step.pipeline.add_user_to_github_organization
}

}
5 changes: 5 additions & 0 deletions add_user_to_multiple_services/flowpipe.pvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
github_access_token = "ghpat-MyToken1234"
github_organization = "NotAReal_Organization"

okta_api_token = "MyToken1234"
okta_domain = "https://my-domain.okta.com"
24 changes: 24 additions & 0 deletions add_user_to_multiple_services/mod.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
mod "add_user_to_multiple_services" {
title = "Add User to Multiple Services"
description = "Adds a user to multiple services."

require {
mod "github.com/turbot/flowpipe-mod-github" {
version = "v0.0.1"
args = {
access_token = var.github_access_token
}
}
}

require {
mod "github.com/turbot/flowpipe-mod-okta" {
version = "v0.0.1-rc.2"
args = {
api_token = var.okta_api_token
okta_domain = var.okta_domain
}
}
}

}
19 changes: 19 additions & 0 deletions add_user_to_multiple_services/variables.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
variable "github_access_token" {
type = string
description = "Github access token"
}

variable "github_organization" {
type = string
description = "Github organization where the users will be created"
}

variable "okta_api_token" {
type = string
description = "Okta API token"
}

variable "okta_domain" {
type = string
description = "Okta domain"
}

0 comments on commit 77c4c1b

Please sign in to comment.