-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add add_user_to_multiple_services pipeline
- Loading branch information
Showing
5 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
49
add_user_to_multiple_services/add_user_to_multiple_services.hcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |