diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..658951ef4 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,11 @@ +FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu + +# Install Genesys Cloud CLI +RUN curl -s https://sdk-cdn.mypurecloud.com/external/go-cli/linux/dl/install.sh | sudo bash + +# Install the Archy CLI +RUN cd ~ && \ + mkdir archy && \ + curl https://sdk-cdn.mypurecloud.com/archy/latest/archy-linux.zip > archy-linux.zip && \ + unzip archy-linux.zip -d ~/archy && \ + cd ~ \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..06605faf9 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +{ + "name": "Terraform and Go", + "build": { + "dockerfile": "Dockerfile" + }, + "features": { + "ghcr.io/devcontainers/features/terraform:1":{}, + "ghcr.io/devcontainers/features/go:1":{ + "version": "1.20" + }, + "ghcr.io/devcontainers/features/python": {} + }, + "containerEnv": { + "TF_ACC": "-" + }, + "hostRequirements": { + "cpus": 4, + "memory": "16gb", + "storage": "32gb" + }, + "forwardPorts": [ + 8080 + ] +} \ No newline at end of file diff --git a/GNUmakefile b/GNUmakefile index 4b9cf8322..d77f28939 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -54,6 +54,7 @@ clean: build: mkdir -p ${DIST_DIR} + go mod tidy go build -o ${DIST_DIR} ./... GOOS = $(shell go env GOOS) diff --git a/scripts/generate_env.py b/scripts/generate_env.py new file mode 100644 index 000000000..28b78bcb0 --- /dev/null +++ b/scripts/generate_env.py @@ -0,0 +1,39 @@ +## This script is included in our .devcontainers setup. We basically use this to generate our an environment variables file that can be used to set the Genesys Cloud environment variables. + +import os + +def get_user_input(prompt): + return input(prompt).strip() + +def generate_shell_script(client_id, client_secret, region): + script_content = f"""#!/bin/bash + +export GENESYSCLOUD_OAUTHCLIENT_ID="{client_id}" +export GENESYSCLOUD_OAUTHCLIENT_SECRET="{client_secret}" +export GENESYSCLOUD_REGION="{region}" + +echo "Environment variables set successfully!" +""" + return script_content + +def main(): + print("Please enter the following values to generate the environment variables needed to run terraform against your target environment: ") + + client_id = get_user_input("GENESYSCLOUD_OAUTHCLIENT_ID: ") + client_secret = get_user_input("GENESYSCLOUD_OAUTHCLIENT_SECRET: ") + region = get_user_input("GENESYSCLOUD_REGION: ") + + script_content = generate_shell_script(client_id, client_secret, region) + + script_filename = "/tmp/set_genesys_env.sh" + with open(script_filename, "w") as f: + f.write(script_content) + + print(f"\nShell script '{script_filename}' has been generated.") + print(f"To use it, run: source {script_filename}") + + #Make the script executable + os.chmod(script_filename, 0o755) + +if __name__ == "__main__": + main() \ No newline at end of file