diff --git a/available-connectors b/available-connectors index 8a91fcf..41f942b 100755 --- a/available-connectors +++ b/available-connectors @@ -1,8 +1,11 @@ #!/bin/bash -RED='\e[0;31m' -BLUE='\e[0;34m' -NC='\e[0m' # No Color +COLORSCHEME_SH="$(dirname "$0")/set-term-colorscheme.sh" +if [ -f "$COLORSCHEME_SH" ]; then + source "$COLORSCHEME_SH" +else + ERR='\033[0;31m'; SUCCESS='\033[0;32m'; WARN='\033[1;33m'; INFO='\033[0;34m'; CODE='\033[0;36m'; NC='\033[0m' +fi # default to .terraform/modules/psoxy/ if no argument provided (this is the correct thing when # running from the root of the psoxy repo) @@ -11,14 +14,13 @@ PSOXY_BASE_DIR=${1:-".terraform/modules/psoxy/"} MODULE_PATH="${PSOXY_BASE_DIR}infra/modules/worklytics-connector-specs" if [ ! -d "$MODULE_PATH" ]; then - printf "${RED}Connector specs module not found at ${MODULE_PATH}.${NC}\n" - printf "(if testing from root of main psoxy repo, run this script as ${BLUE}./tools/available-connectors.sh ./${NC})\n" - printf "(if testing from inside example, run this script as ${BLUE}../../../tools/available-connectors.sh ../../../${NC})\n" + printf "${ERR}Connector specs module not found at ${MODULE_PATH}.${NC}\n" + printf "(if testing from root of main psoxy repo, run this script as ${INFO}./tools/available-connectors.sh ./${NC})\n" + printf "(if testing from inside example, run this script as ${INFO}../../../tools/available-connectors.sh ../../../${NC})\n" printf "Exiting.${NC}\n" exit 1 fi - # init worklytics-connector-specs module as if it's a terraform config, so subsequent 'console' call # will work terraform -chdir="${MODULE_PATH}" init >> /dev/null @@ -30,11 +32,11 @@ rm -rf "${MODULE_PATH}/.terraform" 2> /dev/null rm "${MODULE_PATH}/.terraform.lock.hcl" 2> /dev/null if [ -z "$AVAILABLE_CONNECTORS" ]; then - printf "${RED}Failed to generate list of available connectors${NC} Contact support for assistance.\n" + printf "${ERR}Failed to generate list of available connectors${NC} Contact support for assistance.\n" else printf "The following connector configurations are available for the current version of the proxy Terraform modules you're using:\n" echo "$AVAILABLE_CONNECTORS" | jq -r 'fromjson | .' - printf "To use a connector, add its id from the above list to ${BLUE}enabled_connectors${NC} in your ${BLUE}terraform.tfvars${NC} file.\n"; - printf "Review the documentation for the connector at ${BLUE}https://docs.worklytics.co/psoxy/sources${NC} for more information.\n" + printf "To use a connector, add its id from the above list to ${INFO}enabled_connectors${NC} in your ${INFO}terraform.tfvars${NC} file.\n"; + printf "Review the documentation for the connector at ${INFO}https://docs.worklytics.co/psoxy/sources${NC} for more information.\n" fi diff --git a/check-prereqs b/check-prereqs index 65a12ef..db63bcb 100755 --- a/check-prereqs +++ b/check-prereqs @@ -11,20 +11,20 @@ HOMEBREW_AVAILABLE=`brew -v &> /dev/null` source "$(dirname "$0")/set-term-colorscheme.sh" if ! git --version &> /dev/null ; then - printf "${ERROR}Git not installed.${NC} Not entirely sure how you got here without it, but to install see https://git-scm.com/book/en/v2/Getting-Started-Installing-Git\n" + printf "${ERR}Git not installed.${NC} Not entirely sure how you got here without it, but to install see https://git-scm.com/book/en/v2/Getting-Started-Installing-Git\n" if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install git${NC}\n"; fi exit 1 fi if ! terraform -v &> /dev/null ; then - printf "${ERROR}Terraform CLI not available.${NC} Psoxy examples / deployment scripts require it. See ${CODE}https://developer.hashicorp.com/terraform/downloads${NC} for installation options\n" + printf "${ERR}Terraform CLI not available.${NC} Psoxy examples / deployment scripts require it. See ${CODE}https://developer.hashicorp.com/terraform/downloads${NC} for installation options\n" exit 1 fi # Check Maven installation if ! mvn -v &> /dev/null ; then - printf "${WARNING}Maven not installed.${NC} It is REQUIRED unless you will use a pre-built JAR. To install, see https://maven.apache.org/install.html\n" + printf "${WARN}Maven not installed.${NC} It is REQUIRED unless you will use a pre-built JAR. To install, see https://maven.apache.org/install.html\n" if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install maven${NC}\n"; fi printf " (Using a prebuilt jar requires adding ${CODE}deployment_bundle=""${NC} to your ${CODE}terraform.tfvars${NC} file, and filling with s3/gcs uri for your desired JAR)\n" else @@ -36,7 +36,7 @@ else MVN_MAJOR=$(echo "$MVN_VERSION_MAJOR_MINOR" | cut -d. -f1) MVN_MINOR=$(echo "$MVN_VERSION_MAJOR_MINOR" | cut -d. -f2) if (( MVN_MAJOR < 3 || (MVN_MAJOR == 3 && MVN_MINOR < 6) )); then - printf "${ERROR}This Maven version appears to be unsupported.${NC} Psoxy requires a supported version of Maven 3.6 or later.\n" + printf "${ERR}This Maven version appears to be unsupported.${NC} Psoxy requires a supported version of Maven 3.6 or later.\n" printf "We recommend you upgrade. See https://maven.apache.org/install.html\n" printf "Maven is used to build the package that will be deployed to your host platform as an AWS lambda or a GCP Cloud Function\n" fi @@ -50,7 +50,7 @@ else printf "Your Maven installation uses ${CODE}${JAVA_VERSION}${NC}.\n" if [[ "$JAVA_VERSION_MAJOR" != 17 && "$JAVA_VERSION_MAJOR" != 21 && "$JAVA_VERSION_MAJOR" != 23 && "$JAVA_VERSION_MAJOR" != 24 ]]; then - printf "${ERROR}This Java version appears to be unsupported. You should upgrade it, or may have compile errors.${NC} Psoxy requires an Oracle-supported version of Java 17 or later; as of April 2025, this includes Java 17, 21, or 24. See https://maven.apache.org/install.html\n" + printf "${ERR}This Java version appears to be unsupported. You should upgrade it, or may have compile errors.${NC} Psoxy requires an Oracle-supported version of Java 17 or later; as of April 2025, this includes Java 17, 21, or 24. See https://maven.apache.org/install.html\n" if $HOMEBREW_AVAILABLE; then printf "or as you have Homebrew available, run ${CODE}brew install openjdk@17${NC}\n"; fi printf "If you have an alternative JDK installed, then you must update your ${CODE}JAVA_HOME${NC} environment variable to point to it.\n" fi @@ -63,7 +63,7 @@ else MVN_VERSION_FULL=$(echo "$MVN_VERSION" | sed -n 's/^Apache Maven \([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/p') MVN_PATCH=$(echo "$MVN_VERSION_FULL" | cut -d. -f3) if (( MVN_MAJOR < 3 || (MVN_MAJOR == 3 && MVN_MINOR < 9) || (MVN_MAJOR == 3 && MVN_MINOR == 9 && MVN_PATCH < 10) )); then - printf "${ERROR}Maven < 3.9.10 has compatibility issues with Java 24.${NC} If you're using Java 24, psoxy will NOT build correctly unless you upgrade Maven to 3.9.10 or later.\n" + printf "${ERR}Maven < 3.9.10 has compatibility issues with Java 24.${NC} If you're using Java 24, psoxy will NOT build correctly unless you upgrade Maven to 3.9.10 or later.\n" printf "See https://maven.apache.org/install.html\n" fi fi @@ -71,19 +71,17 @@ else printf "\n" fi - # Check NPM installation if ! npm -v &> /dev/null ; then - printf "${WARNING}NodeJS (node) and Node Package Manager (npm) are not installed but are required for the local test tooling to work. ${NC} While this is optional, we recommend you install them to be able to test your instances. See https://nodejs.org/\n" + printf "${WARN}NodeJS (node) and Node Package Manager (npm) are not installed but are required for the local test tooling to work. ${NC} While this is optional, we recommend you install them to be able to test your instances. See https://nodejs.org/\n" if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install node${NC}\n"; fi fi - # Check AWS installation AWSCLI_REASON="Required if deploying to AWS." if ! aws --version &> /dev/null ; then - printf "${ERROR}AWS CLI is not installed.${NC} ${AWSCLI_REASON} See https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html\n" + printf "${ERR}AWS CLI is not installed.${NC} ${AWSCLI_REASON} See https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html\n" if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install awscli${NC}\n"; fi else printf "AWS CLI version ${CODE}`aws --version`${NC} is installed.\n" @@ -96,7 +94,7 @@ printf "\n" # Check GCloud CLI installation GCLOUD_REASON="Required if deploying to GCP or using Google Workspace data sources." if ! gcloud --version &> /dev/null ; then - printf "${ERROR}Google Cloud SDK is not installed.${NC} ${GCLOUD_REASON} See https://cloud.google.com/sdk/docs/install\n" + printf "${ERR}Google Cloud SDK is not installed.${NC} ${GCLOUD_REASON} See https://cloud.google.com/sdk/docs/install\n" if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install --cask google-cloud-sdk${NC}\n"; fi else printf "Google Cloud SDK version ${CODE}`gcloud --version 2> /dev/null | head -n 1`${NC} is installed.\n" @@ -108,7 +106,7 @@ printf "\n" # Check Azure CLI installation AZCLI_REASON="Required if deploying to Azure or using Microsoft 365 data sources." if ! az --version &> /dev/null ; then - printf "${ERROR}Azure CLI is not installed.${NC} ${AZCLI_REASON} See https://docs.microsoft.com/en-us/cli/azure/install-azure-cli\n" + printf "${ERR}Azure CLI is not installed.${NC} ${AZCLI_REASON} See https://docs.microsoft.com/en-us/cli/azure/install-azure-cli\n" if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install azure-cli${NC}\n"; fi else # how can pipe to sed or something to strip extra whitespace out? diff --git a/google-workspace.tf b/google-workspace.tf index ffad333..c8e6970 100644 --- a/google-workspace.tf +++ b/google-workspace.tf @@ -7,7 +7,7 @@ provider "google" { module "worklytics_connectors_google_workspace" { - source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-google-workspace?ref=v0.5.17" + source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-google-workspace?ref=v0.5.18" providers = { diff --git a/init b/init index 0f46815..c49e2a0 100755 --- a/init +++ b/init @@ -27,13 +27,12 @@ # Source centralized color scheme source "$(dirname "$0")/set-term-colorscheme.sh" - EXPLICIT_REPO_CLONE_DIR=$1 TF_CONFIG_ROOT=`pwd` if ! terraform -v &> /dev/null ; then - printf "${ERROR}Terraform not available; required for this Psoxy example. See https://github.com/Worklytics/psoxy#prerequisites ${NC}\n" + printf "${ERR}Terraform not available; required for this Psoxy example. See https://github.com/Worklytics/psoxy#prerequisites ${NC}\n" exit 1 fi @@ -43,7 +42,7 @@ terraform init TF_INIT_EXIT_CODE=$? if [[ $TF_INIT_EXIT_CODE -ne 0 ]]; then - printf "${ERROR}Terraform init failed. See above for details. Cannot continue to initialize example configuration.${NC}\n" + printf "${ERR}Terraform init failed. See above for details. Cannot continue to initialize example configuration.${NC}\n" exit 1 fi @@ -52,7 +51,7 @@ if [[ -z "$EXPLICIT_REPO_CLONE_DIR" ]]; then if [[ -d ".terraform/modules/psoxy/" ]]; then REPO_CLONE_BASE_DIR=".terraform/modules/psoxy/" else - printf "${ERROR}No explicit path to repo clone provided, and 'psoxy' module in Terraform configuration.${NC}\n" + printf "${ERR}No explicit path to repo clone provided, and 'psoxy' module in Terraform configuration.${NC}\n" printf "Try running this script with a Terraform module named 'psoxy' that references to GitHub repo https://github.com/Worklytics/psoxy, or pass the path to a clone of that as the first argument to the script.\n" printf " eg ${CODE}./init ~/code/psoxy${NC}\n" exit 1 diff --git a/main.tf b/main.tf index 91365a3..147942b 100644 --- a/main.tf +++ b/main.tf @@ -20,7 +20,7 @@ terraform { # general cases module "worklytics_connectors" { - source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors?ref=v0.5.17" + source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors?ref=v0.5.18" enabled_connectors = var.enabled_connectors chat_gpt_enterprise_example_workspace_id = var.chat_gpt_enterprise_example_workspace_id @@ -37,6 +37,8 @@ module "worklytics_connectors" { github_copilot_installation_id = var.github_copilot_installation_id github_organization = var.github_organization github_example_repository = var.github_example_repository + gong_instance_subdomain = var.gong_instance_subdomain + glean_instance_subdomain = var.glean_instance_subdomain salesforce_example_account_id = var.salesforce_example_account_id todos_as_local_files = var.todos_as_local_files todo_step = 1 @@ -103,7 +105,7 @@ locals { } module "psoxy" { - source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-host?ref=v0.5.17" + source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-host?ref=v0.5.18" environment_name = var.environment_name aws_account_id = var.aws_account_id @@ -176,7 +178,7 @@ locals { 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.17" + source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-psoxy-connection-aws?ref=v0.5.18" proxy_instance_id = each.key worklytics_host = var.worklytics_host diff --git a/misc-data-source-variables.tf b/misc-data-source-variables.tf index 3f9c614..68b9fef 100644 --- a/misc-data-source-variables.tf +++ b/misc-data-source-variables.tf @@ -87,6 +87,18 @@ variable "github_example_repository" { description = "(Only required if using Github connector) Name for the repository to be used as part of example calls for Github (ex: psoxy)" } +variable "glean_instance_subdomain" { + type = string + default = null + description = "(Only required if using Glean connector) Subdomain of your Glean instance (ex: if your Glean URL is 'acme-be.glean.com', the instance subdomain is 'acme-be')" +} + +variable "gong_instance_subdomain" { + type = string + default = null + description = "(Only required if using Gong connector) Subdomain of your Gong instance (ex: if your Gong URL is 'acme.gong.io', the instance subdomain is 'acme')" +} + variable "salesforce_example_account_id" { type = string default = null @@ -110,4 +122,22 @@ locals { (!local.validate_github_enterprise_server_host ? local.validate_github_enterprise_server_host_message : "")) -} \ No newline at end of file + + + validate_glean_instance_subdomain = (var.glean_instance_subdomain == null || var.glean_instance_subdomain == "") && contains(var.enabled_connectors, "glean") + validate_glean_instance_subdomain_message = "The glean_instance_subdomain var should be populated if Glean connector is enabled." + validate_glean_instance_subdomain_check = regex( + "^${local.validate_glean_instance_subdomain_message}$", + (!local.validate_glean_instance_subdomain + ? local.validate_glean_instance_subdomain_message + : "")) + + validate_gong_instance_subdomain = (var.gong_instance_subdomain == null || var.gong_instance_subdomain == "") && contains(var.enabled_connectors, "gong-metrics") + validate_gong_instance_subdomain_message = "The gong_instance_subdomain var should be populated if Gong connector is enabled." + validate_gong_instance_subdomain_check = regex( + "^${local.validate_gong_instance_subdomain_message}$", + (!local.validate_gong_instance_subdomain + ? local.validate_gong_instance_subdomain_message + : "")) + +} diff --git a/msft-365.tf b/msft-365.tf index 909e28d..d2a5ead 100644 --- a/msft-365.tf +++ b/msft-365.tf @@ -1,7 +1,7 @@ # BEGIN MSFT module "worklytics_connectors_msft_365" { - source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-msft-365?ref=v0.5.17" + source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-msft-365?ref=v0.5.18" enabled_connectors = var.enabled_connectors @@ -47,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.17" + source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-cognito-pool?ref=v0.5.18" developer_provider_name = local.developer_provider_name name = "${local.env_qualifier}-azure-ad-federation" @@ -69,7 +69,7 @@ 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.17" + source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-cognito-identity-cli?ref=v0.5.18" aws_region = data.aws_region.current.id @@ -106,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.17" + source = "git::https://github.com/worklytics/psoxy//infra/modules/azuread-federated-credentials?ref=v0.5.18" application_id = each.value.connector_id display_name = "${local.env_qualifier}AccessFromAWS" diff --git a/reset-example b/reset-example index e6019f0..5ad0935 100755 --- a/reset-example +++ b/reset-example @@ -1,16 +1,17 @@ #!/bin/bash - # colors -RED='\e[0;31m' -BLUE='\e[0;34m' -NC='\e[0m' # No Color - +COLORSCHEME_SH="$(dirname "$0")/set-term-colorscheme.sh" +if [ -f "$COLORSCHEME_SH" ]; then + source "$COLORSCHEME_SH" +else + ERR='\033[0;31m'; SUCCESS='\033[0;32m'; WARN='\033[1;33m'; INFO='\033[0;34m'; CODE='\033[0;36m'; NC='\033[0m' +fi # warn user that will delete a bunch of files -printf "This script will ${RED}delete${NC} the your local terraform state, variable files, etc, to " -printf "reset to example template prior to ${BLUE}./init${NC} and any terraform init/plan/apply you've done.\n" -printf "If you have ${RED}NOT${NC} committed these files and/or your local changes, they will be lost.\n" +printf "This script will ${ERR}delete${NC} the your local terraform state, variable files, etc, to " +printf "reset to example template prior to ${INFO}./init${NC} and any terraform init/plan/apply you've done.\n" +printf "If you have ${ERR}NOT${NC} committed these files and/or your local changes, they will be lost.\n" printf "Do you want to continue? (y/N): " read -r response if [[ ! "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then @@ -28,7 +29,7 @@ rm terraform.tfvars 2>/dev/null rm terraform.tfstate 2>/dev/null # restore main.tf, if modified -printf "Restoring ${BLUE}main.tf${NC} configuration file ...\n" +printf "Restoring ${INFO}main.tf${NC} configuration file ...\n" git checkout HEAD -- main.tf # check source-specific files that may have been deleted @@ -40,13 +41,13 @@ check_and_restore_file() { # Check the git status to find out if the file was deleted if git status --short | grep -q "^ D $file"; then # The file is deleted, restore it from the HEAD - printf "Configuration file ${BLUE}$file${NC} was deleted, restoring...\n" + printf "Configuration file ${INFO}$file${NC} was deleted, restoring...\n" git checkout HEAD -- "$file" if [ $? -eq 0 ]; then - printf "${BLUE}$file${NC} has been successfully restored.\n" + printf "${INFO}$file${NC} has been successfully restored.\n" else - printf "${RED}Error occurred while restoring '$file'${NC}\n" + printf "${ERR}Error occurred while restoring '$file'${NC}\n" return 1 fi fi @@ -61,4 +62,3 @@ if [[ -f upgrade-terraform-modules ]]; then rm upgrade-terraform-modules fi -