forked from MyPureCloud/terraform-provider-genesyscloud
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
126c71f
commit c6568e2
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |