Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions infra/examples-dev/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ module "psoxy" {
bulk_input_expiration_days = var.bulk_input_expiration_days
}

module "connection_via_tenant_api" {
# dev example path: "../../../../terraform-aws-worklytics/examples/create_psoxy_connections"
# TODO URL of the actual repo to illustrate... initial version not released yet
source = "git::https://github.com/worklytics/terraform-aws-worklytics/examples/create_psoxy_connections?ref=v0.1.0"

# TODO review this: using the 1st unique ID while testing is OK, but maybe we should define a
# an explicit variable for it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably; and that variable by default could have caller_gcp_service_account_ids[0]

worklytics_tenant_id = var.caller_gcp_service_account_ids[0]
user_principal_email = var.user_principal_email
psoxy_connections = module.psoxy.tenant_api_connection_settings
psoxy_connection_script_path = path.module
}

# if you generated these, you may want them to import back into your data warehouse
output "lookup_tables" {
value = module.psoxy.lookup_tables
Expand Down
5 changes: 5 additions & 0 deletions infra/examples-dev/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -299,3 +299,8 @@ variable "todos_as_outputs" {
description = "whether to render TODOs as outputs or flat files (former useful if you're using Terraform Cloud/Enterprise, or somewhere else where the filesystem is not readily accessible to you)"
default = false
}

variable "user_principal_email" {
type = string
description = "The email of the user that has been granted access to the Worklytics Tenant API (configure in Worklytics Web App)."
}
12 changes: 12 additions & 0 deletions infra/examples-dev/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ module "connection_in_worklytics" {
try(each.value.settings_to_provide, {}))
}

module "connection_via_tenant_api" {
# dev example path = "../../../../terraform-gcp-worklytics/examples/create_psoxy_connections"
# TODO URL of the actual repo to illustrate... initial version not released yet
source = "git::https://github.com/worklytics/terraform-gcp-worklytics/examples/create_psoxy_connections?ref=v0.1.0"

project_id = var.gcp_project_id
service_account_id = "worklytics-tenant-api" # it's the default value
worklytics_tenant_id = var.worklytics_tenant_id
psoxy_connections = [for connection in module.connection_in_worklytics : connection.tenant_api_connection_settings]
psoxy_connection_script_path = path.module
}

output "path_to_deployment_jar" {
description = "Path to the package to deploy (JAR)."
value = module.psoxy.path_to_deployment_jar
Expand Down
10 changes: 10 additions & 0 deletions infra/examples-dev/gcp/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ variable "worklytics_sa_emails" {
description = "service accounts for your organization's Worklytics instances (list supported for test/dev scenarios)"
}

variable "worklytics_tenant_id" {
type = string
description = "Numeric ID of your Worklytics tenant's service account (obtain from Worklytics Web App)."

validation {
condition = var.worklytics_tenant_id == null || can(regex("^\\d{21}$", var.worklytics_tenant_id))
error_message = "`worklytics_tenant_id` must be a 21-digit numeric value."
}
}

variable "psoxy_base_dir" {
type = string
description = "the path where your psoxy repo resides"
Expand Down
7 changes: 7 additions & 0 deletions infra/modular-examples/aws/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@ output "caller_role_arn" {
value = module.psoxy_aws.api_caller_role_arn
}

output "tenant_api_connection_settings" {
value = concat(
values(module.worklytics_psoxy_connection)[*].tenant_api_settings,
values(module.worklytics_psoxy_connection_google_workspace)[*].tenant_api_settings,
values(module.psoxy_bulk_to_worklytics)[*].tenant_api_settings
)
}
4 changes: 4 additions & 0 deletions infra/modules/worklytics-psoxy-connection-aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ output "next_todo_step" {
output "todo" {
value = module.generic.todo
}

output "tenant_api_connection_settings" {
value = module.generic.tenant_api_connection_settings
}
12 changes: 12 additions & 0 deletions infra/modules/worklytics-psoxy-connection-generic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,15 @@ output "next_todo_step" {
output "todo" {
value = local.todo_content
}

output "tenant_api_connection_settings" {
value = merge(
{ integration = var.connector_id },
contains(keys(var.settings_to_provide), "Psoxy Base URL") ? { endpoint = var.settings_to_provide["Psoxy Base URL"] } : {},
contains(keys(var.settings_to_provide), "Bucket Name") ? { bucket = var.settings_to_provide["Bucket Name"] } : {},
contains(keys(var.settings_to_provide), "AWS Psoxy Region") ? { region = var.settings_to_provide["AWS Psoxy Region"] } : {},
contains(keys(var.settings_to_provide), "AWS Psoxy Role ARN") ? { role_arn = var.settings_to_provide["AWS Psoxy Role ARN"] } : {},
contains(keys(var.settings_to_provide), "Parser") ? { parser_id = var.settings_to_provide["Parser"] } : {},
contains(keys(var.settings_to_provide), "GitHub Organization") ? { github_organization = var.settings_to_provide["GitHub Organization"] } : {},
)
}
4 changes: 4 additions & 0 deletions infra/modules/worklytics-psoxy-connection/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ output "todo" {
output "next_todo_step" {
value = module.generic.next_todo_step
}

output "tenant_api_connection_settings" {
value = module.generic.tenant_api_connection_settings
}
Loading