Skip to content
Merged
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
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ git clone https://github.com/{{YOUR_ORG_ID}}/{{YOUR_REPO_NAME}}.git

3. Authenticate your tools as needed:

- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) - `aws sts get-caller-identity` should work and return your expected account/user
- if plan to get data from Google Workspace, auth [GCloud CLI](https://cloud.google.com/sdk/docs/authorizing) - `gcloud auth login` to authenticate, then `gcloud auth list` to verify you have expected account/user
- if plan to get data from Microsoft 365, auth [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) - `az login --allow-no-subscription` to authenticate, then `az account list` to verify you have expected account/user

- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html) - `aws get-caller-identity` should work and return your expected account/user
- if plan to get data from Google Workspace, auth [GCloud CLI](https://cloud.google.com/sdk/docs/authorizing) - `gcloud auth login` to authenticate, then `gcloud auth list` to verify you have the expected account/user
- if plan to get data from Microsoft 365, auth [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) - `az login --allow-no-subscription` to authenticate, then `az account list` to verify you have the expected account/user

4. Initialize your configuration

Expand Down
3 changes: 2 additions & 1 deletion google-workspace.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ provider "google" {


module "worklytics_connectors_google_workspace" {
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-google-workspace?ref=v0.5.10"
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-google-workspace?ref=v0.5.11"


providers = {
google = google.google_workspace
Expand Down
34 changes: 21 additions & 13 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ terraform {

# general cases
module "worklytics_connectors" {
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors?ref=v0.5.10"
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors?ref=v0.5.11"

enabled_connectors = var.enabled_connectors
chat_gpt_enterprise_example_workspace_id = var.chat_gpt_enterprise_example_workspace_id
Expand Down Expand Up @@ -54,6 +54,11 @@ locals {
{}
)

bulk_connectors = merge(
module.worklytics_connectors.enabled_bulk_connectors,
var.custom_bulk_connectors,
)

source_authorization_todos = concat(
module.worklytics_connectors.todos,
module.worklytics_connectors_google_workspace.todos,
Expand All @@ -70,13 +75,6 @@ locals {
)
}

locals {
bulk_connectors = merge(
module.worklytics_connectors.enabled_bulk_connectors,
var.custom_bulk_connectors,
)
}


## Host platform (AWS) configuration

Expand Down Expand Up @@ -105,7 +103,7 @@ locals {
}

module "psoxy" {
source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-host?ref=v0.5.10"
source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-host?ref=v0.5.11"

environment_name = var.environment_name
aws_account_id = var.aws_account_id
Expand Down Expand Up @@ -161,14 +159,24 @@ module "psoxy" {
# Worklytics API / Terraform provider

locals {
all_connectors = merge(local.api_connectors, local.bulk_connectors)
all_instances = merge(module.psoxy.bulk_connector_instances, module.psoxy.api_connector_instances)
# Webhook collectors are handled separately to avoid cycles - their metadata comes from outputs
webhook_connectors_for_worklytics = {
for k, v in module.psoxy.webhook_collector_instances : k => {
source_kind = var.webhook_collectors[k].source_kind
sanitized_bucket_name = v.output_sanitized_bucket_id
display_name = var.webhook_collectors[k].display_name
settings_to_provide = {}
}
}

all_connectors = merge(local.api_connectors, local.bulk_connectors, local.webhook_connectors_for_worklytics)
all_instances = merge(module.psoxy.bulk_connector_instances, module.psoxy.api_connector_instances, module.psoxy.webhook_collector_instances)
}

module "connection_in_worklytics" {
for_each = local.all_instances

source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-psoxy-connection-aws?ref=v0.5.10"
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-psoxy-connection-aws?ref=v0.5.11"

proxy_instance_id = each.key
worklytics_host = var.worklytics_host
Expand All @@ -177,7 +185,7 @@ module "connection_in_worklytics" {
proxy_endpoint_url = try(each.value.endpoint_url, null)
bucket_name = try(each.value.sanitized_bucket, null)
connector_id = try(local.all_connectors[each.key].worklytics_connector_id, "")
display_name = try(local.all_connectors[each.key].worklytics_connector_name, "${local.all_connectors[each.key].display_name} via Psoxy")
display_name = try(local.all_connectors[each.key].worklytics_connector_name, "${local.all_connectors[each.key].display_name} via Psoxy", "")
todo_step = module.psoxy.next_todo_step
todos_as_local_files = var.todos_as_local_files

Expand Down
10 changes: 6 additions & 4 deletions msft-365.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# BEGIN MSFT

module "worklytics_connectors_msft_365" {
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-msft-365?ref=v0.5.10"
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-msft-365?ref=v0.5.11"


enabled_connectors = var.enabled_connectors
environment_id = var.environment_name
Expand Down Expand Up @@ -46,7 +47,7 @@ data "aws_region" "current" {
module "cognito_identity_pool" {
count = local.msft_365_enabled ? 1 : 0 # only provision identity pool if MSFT-365 connectors are enabled

source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-cognito-pool?ref=v0.5.10"
source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-cognito-pool?ref=v0.5.11"

developer_provider_name = local.developer_provider_name
name = "${local.env_qualifier}-azure-ad-federation"
Expand All @@ -68,7 +69,8 @@ locals {
module "cognito_identity" {
count = local.msft_365_enabled ? 1 : 0 # only provision identity pool if MSFT-365 connectors are enabled

source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-cognito-identity-cli?ref=v0.5.10"
source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-cognito-identity-cli?ref=v0.5.11"


aws_region = data.aws_region.current.id
aws_role = var.aws_assume_role_arn
Expand Down Expand Up @@ -104,7 +106,7 @@ locals {
module "msft_connection_auth_federation" {
for_each = local.provision_entraid_apps ? local.enabled_to_entraid_object : local.shared_to_entraid_object

source = "git::https://github.com/worklytics/psoxy//infra/modules/azuread-federated-credentials?ref=v0.5.10"
source = "git::https://github.com/worklytics/psoxy//infra/modules/azuread-federated-credentials?ref=v0.5.11"

application_id = each.value.connector_id
display_name = "${local.env_qualifier}AccessFromAWS"
Expand Down
6 changes: 5 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,11 @@ variable "custom_side_outputs" {

variable "webhook_collectors" {
type = map(object({
rules_file = string
worklytics_connector_id = optional(string, "work-data-generic-psoxy")
worklytics_connector_name = optional(string, "Workplace Metadata via Psoxy")
display_name = optional(string, "Webhooks Collected via Psoxy")
source_kind = optional(string, "work-event") # source kind for this webhook collector, used for labeling and categorization
rules_file = string
provision_auth_key = optional(object({ # whether to provision auth keys for webhook collector; if not provided, will not provision any
rotation_days = optional(number, null) # null means no rotation; if > 0, will rotate every N days
key_spec = optional(string, "RSA_2048") # RSA_2048, RSA_3072, or RSA_4096; defaults to RSA_2048, which should be sufficient this use-case
Expand Down