Skip to content

Commit

Permalink
Fix pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
karanpopat committed Nov 29, 2023
1 parent 24f0216 commit 9a3572b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ Create a user in Okta and assign to a group.
- Create a user in Okta and add to a group. This step is an independent pipeline to create user and assign to a group e.g.

```
flowpipe pipeline run create_user_assign_to_group --arg first_name='Foo' --arg last_name='Bar' --arg email='[email protected]' --arg login='foo.bar' --arg password='password' --arg group_id='00g1x2x3x4x5x6x7x8x9'
flowpipe pipeline run create_okta_user_assign_to_group --arg first_name='Foo' --arg last_name='Bar' --arg email='[email protected]' --arg login='foo.bar' --arg password='password' --arg group_id='00g1x2x3x4x5x6x7x8x9'
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pipeline "create_user_assign_to_group" {
pipeline "create_okta_user_assign_to_group" {
title = "Create User Assign Group"
description = "Create a user and assign it to a group."

Expand All @@ -11,48 +11,44 @@ pipeline "create_user_assign_to_group" {
param "domain" {
description = "The domain of your Okta account."
type = string
default = var.okta_domain
}

param "group_id" {
description = "The ID of the group."
type = string
default = var.group_id
default = var.domain
}

param "first_name" {
description = "Given name of the user."
type = string
default = var.first_name
}

param "last_name" {
description = "The family name of the user."
type = string
default = var.last_name
}

param "email" {
description = "The primary email address of the user."
type = string
default = var.email
}

param "login" {
description = "The unique identifier for the user."
type = string
default = var.login
}

param "password" {
description = "Specifies the password for a user."
type = string
default = var.password
}

param "group_id" {
description = "The ID of the group."
type = string
}

step "pipeline" "create_user" {
pipeline = pipeline.create_user
pipeline = okta.pipeline.create_user
args = {
api_token = param.api_token
domain = param.domain
first_name = param.first_name
last_name = param.last_name
email = param.email
Expand All @@ -62,20 +58,33 @@ pipeline "create_user_assign_to_group" {
}

step "pipeline" "assign_user" {
pipeline = pipeline.assign_user
pipeline = okta.pipeline.assign_user
args = {
api_token = param.api_token
domain = param.domain
group_id = param.group_id
user_id = step.pipeline.create_user.output.user.id
}
}

step "pipeline" "list_member_users" {
depends_on = [step.pipeline.assign_user]

pipeline = okta.pipeline.list_member_users
args = {
group_id = param.group_id
user_id = jsondecode(step.pipeline.create_user.user).id
api_token = param.api_token
domain = param.domain
group_id = param.group_id
}
}

output "user" {
value = step.pipeline.create_user.response_body
description = "User details."
value = step.pipeline.create_user.output
}

output "assignment" {
value = step.pipeline.assign_user.response_body
description = "Group assignment details for a user."
output "group_members" {
description = "List of users that are members of the group."
value = step.pipeline.list_member_users.output
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
mod "create_user_assign_to_group" {
mod "create_okta_user_assign_to_group" {
title = "Create User and Assign Group"
description = "Create a user in Okta and assign to a group."

require {
mod "github.com/turbot/flowpipe-mod-okta" {
version = "v0.0.2-rc.1"
version = "v0.0.2-rc.2"
args = {
api_token = var.api_token
domain = var.domain
Expand Down
9 changes: 9 additions & 0 deletions create_okta_user_assign_to_group/variables.fp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "domain" {
type = string
description = "The URL of the Okta domain. Exmaple: 'https://dev-50078045.okta.com'"
}

variable "api_token" {
type = string
description = "The Okta personal access api_token to authenticate to the Okta APIs, e.g., '00B630jSCGU4jV4o5Yh4KQMAdqizwE2OgVcS7N9UHb'. Please see https://developer.okta.com/docs/guides/create-an-api-api_token/main/#oauth-2-0-instead-of-api-api_tokens for more information."
}
39 changes: 0 additions & 39 deletions create_user_assign_to_group/variables.fp

This file was deleted.

0 comments on commit 9a3572b

Please sign in to comment.