Skip to content

Commit

Permalink
Update PingOne Neo getting started example
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickcping committed Sep 19, 2023
1 parent 04f1d3b commit bcf2733
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 62 deletions.
20 changes: 17 additions & 3 deletions examples/pingone-neo-getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,18 @@ The following variables can be set prior to running the example:

| Variable name | Required | Data Type | Default Value | Example Value | Description |
|--------------------------------------|----------|-----------|---------------|------------------------------------|----------------------------------------------------------------------------------------------------|
| `pingone_license_id` | Yes | String | *no default* | | A valid license UUID to apply to the new environment. |
| `pingone_environment_license_id` | Yes | String | *no default* | | A valid license UUID to apply to the new environment. See [Finding Required IDs](https://terraform.pingidentity.com/getting-started/pingone/#license-id-organization-id-and-organization-name) for instructions on how to retrieve the `pingone_license_id` value from the PingOne console. |
| `pingone_environment_name` | No | String | `Terraform Example - Getting Started with PingOne Neo` | `My Environment` | A string that represents the name of the PingOne customer environment to create and manage with Terraform. |
| `append_date_to_environment_name` | No | Boolean | `true` | `true` | A boolean that determines whether to append the current date to the pingone_environment_name value.


## Outputs
The following outputs are returned from the example:

| Variable name | Data Type | Sensitive Value | Description |
|-----------------------------------------------------------|-----------|-----------------|------------------------------------------------------------------------------------------------------------------|
| `pingone_environment_name` | String | No | The environment name created by the example |

See [Finding Required IDs](https://terraform.pingidentity.com/getting-started/pingone/#license-id-organization-id-and-organization-name) for instructions on how to retrieve the `pingone_license_id` value from the PingOne console.

## Enable Administrator Access
An existing admin user will need the following roles to be able to view and manage PingOne Credentials:
Expand All @@ -58,4 +65,11 @@ terraform plan -out infra.tfout

```shell
terraform apply "infra.tfout"
```
```

## Clean up resources
Use the following to clean up the environment:

```shell
terraform destroy
```
61 changes: 8 additions & 53 deletions examples/pingone-neo-getting-started/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,7 @@
#
# Reference: https://neoidentity.com
######################################################################################
resource "pingone_environment" "my_environment" {
name = "Terraform Example - Getting Started with PingOne Neo"
description = "This environment was created by Terraform as an example of how to set up a PingOne Verify policy and PingOne Credentials verifiable credentials configuration."
type = "SANDBOX"
license_id = var.pingone_license_id

default_population {
name = "My Default Population"
description = "My new population for users"
}

service {
type = "SSO"
}
service {
type = "MFA"
}
service {
type = "Verify"
}
service {
type = "Credentials"
}
}

######################################################################################
#
Expand Down Expand Up @@ -184,7 +161,7 @@ resource "pingone_digital_wallet_application" "digital_wallet" {
## Create "Getting Started" Example Credential

# configure credential type
resource "pingone_credential_type" "gettingstarted_credential" {
resource "pingone_credential_type" "getting_started_credential" {
environment_id = pingone_environment.my_environment.id
title = "Neo Demonstration"
description = "Getting Started Demo Credential"
Expand All @@ -208,8 +185,8 @@ resource "pingone_credential_type" "gettingstarted_credential" {
bg_opacity_percent = 30

# ensure images have content-type prefix defined and are base64 encoded
background_image = "data:image/png;base64,${filebase64("./images/gettingstarted_background.png")}"
logo_image = "data:image/png;base64,${filebase64("./images/gettingstarted_logo.png")}"
background_image = pingone_image.credentials_card_getting_started_background_image.uploaded_image[0].href
logo_image = pingone_image.credentials_card_getting_started_logo_image.uploaded_image[0].href

card_color = "#69747d"
text_color = "#ffffff"
Expand Down Expand Up @@ -250,22 +227,15 @@ resource "pingone_credential_type" "gettingstarted_credential" {
}

# configure issuance rule
# example uses a group for credential assignment
resource "pingone_group" "gettingstarted_assignment_group" {
environment_id = pingone_environment.my_environment.id

name = "Example group for Getting Started credential assignment"
}

resource "pingone_credential_issuance_rule" "gettingstarted_credential_issuance_rule" {
resource "pingone_credential_issuance_rule" "getting_started_credential_issuance_rule" {
environment_id = pingone_environment.my_environment.id
credential_type_id = pingone_credential_type.gettingstarted_credential.id
credential_type_id = pingone_credential_type.getting_started_credential.id
digital_wallet_application_id = pingone_digital_wallet_application.digital_wallet.id
status = "ACTIVE"

# users added to the group will be issued the credential after they pair their digital wallet
filter = {
group_ids = [pingone_group.gettingstarted_assignment_group.id]
group_ids = [pingone_group.getting_started_assignment_group.id]
}

automation = {
Expand All @@ -283,15 +253,8 @@ resource "pingone_credential_issuance_rule" "gettingstarted_credential_issuance_
## See: https://identity.foundation/jwt-vc-presentation-profile/#credential-type-verifiedemployee

# create displayName attribute used by VerifiedEmployee
data "pingone_schema" "users" {
environment_id = pingone_environment.my_environment.id

name = "User"

}
resource "pingone_schema_attribute" "display_name" {
environment_id = pingone_environment.my_environment.id
schema_id = data.pingone_schema.users.id

name = "displayName"
display_name = "Display Name"
Expand All @@ -316,8 +279,8 @@ resource "pingone_credential_type" "verifiedemployee" {
description = "Demo Proof of Employment"
bg_opacity_percent = 100

background_image = "data:image/png;base64,${filebase64("./images/verifiedemployee_background.png")}"
logo_image = "data:image/png;base64,${filebase64("./images/verifiedemployee_logo.png")}"
background_image = pingone_image.credentials_card_verified_employee_background_image.uploaded_image[0].href
logo_image = pingone_image.credentials_card_verified_employee_logo_image.uploaded_image[0].href

card_color = "#ffffff"
text_color = "#000000"
Expand Down Expand Up @@ -370,14 +333,6 @@ resource "pingone_credential_type" "verifiedemployee" {
}

# configure issuance rule
# example uses a population for credential assignment - an existing default or other population could be used
resource "pingone_population" "demo_population" {
environment_id = pingone_environment.my_environment.id

name = "Demo User Population"
description = "Demo User Population"
}

resource "pingone_credential_issuance_rule" "verified_employee_issuance_rule" {
environment_id = pingone_environment.my_environment.id
credential_type_id = pingone_credential_type.verifiedemployee.id
Expand Down
4 changes: 4 additions & 0 deletions examples/pingone-neo-getting-started/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "pingone_environment_name" {
description = "The environment name created by the example"
value = pingone_environment.my_environment.name
}
66 changes: 66 additions & 0 deletions examples/pingone-neo-getting-started/supporting-configuration.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
locals {
pingone_environment_name = var.append_date_to_environment_name ? format("%s %s", var.pingone_environment_name, formatdate("YYYY-MMM-DD hhmm", time_static.current.id)) : var.pingone_environment_name
}

# example uses a group for credential assignment
resource "pingone_group" "getting_started_assignment_group" {
environment_id = pingone_environment.my_environment.id

name = "Example group for Getting Started credential assignment"
}

# example uses a population for credential assignment - an existing default or other population could be used
resource "pingone_population" "demo_population" {
environment_id = pingone_environment.my_environment.id

name = "Demo User Population"
description = "Demo User Population"
}

resource "pingone_image" "credentials_card_verified_employee_background_image" {
environment_id = pingone_environment.my_environment.id

image_file_base64 = filebase64("./images/verifiedemployee_background.png")
}

resource "pingone_image" "credentials_card_verified_employee_logo_image" {
environment_id = pingone_environment.my_environment.id

image_file_base64 = filebase64("./images/verifiedemployee_logo.png")
}

resource "pingone_image" "credentials_card_getting_started_background_image" {
environment_id = pingone_environment.my_environment.id

image_file_base64 = filebase64("./images/gettingstarted_background.png")
}

resource "pingone_image" "credentials_card_getting_started_logo_image" {
environment_id = pingone_environment.my_environment.id

image_file_base64 = filebase64("./images/gettingstarted_logo.png")
}

resource "pingone_environment" "my_environment" {
name = local.pingone_environment_name
description = "This environment was created by Terraform as an example of how to set up a PingOne Verify policy and PingOne Credentials verifiable credentials configuration."
type = "SANDBOX"
license_id = var.pingone_environment_license_id

default_population {}

service {
type = "SSO"
}
service {
type = "MFA"
}
service {
type = "Verify"
}
service {
type = "Credentials"
}
}

resource "time_static" "current" {}
14 changes: 13 additions & 1 deletion examples/pingone-neo-getting-started/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
variable "pingone_license_id" {
variable "pingone_environment_name" {
description = "A string that represents the name of the PingOne customer environment to create and manage with Terraform."
type = string
default = "Terraform Example - Getting Started with PingOne Neo"
}

variable "append_date_to_environment_name" {
description = "A boolean that determines whether to append the current date to the pingone_environment_name value."
type = bool
default = true
}

variable "pingone_environment_license_id" {
description = "A valid license UUID to apply to the new environment."
type = string
}
15 changes: 10 additions & 5 deletions examples/pingone-neo-getting-started/versions.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
terraform {
required_version = ">= 1.1.0"
required_version = ">= 1.2.0"

required_providers {
pingone = {
source = "pingidentity/pingone"
version = "~> 0.17.1"
version = ">= 0.21.0, < 1.0.0"
}
time = {
source = "hashicorp/time"
version = ">= 0.9.1, < 1.0.0"
}
}
}

provider "pingone" {
# Configuration options
}
provider "pingone" {}

provider "time" {}

0 comments on commit bcf2733

Please sign in to comment.