Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: optimize the output of the sh script #44

Merged
merged 1 commit into from
May 20, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ TerraformGoat is built using Dockerfile, so you need to install the Docker envir
```shell
git clone https://github.com/HuoCorp/TerraformGoat.git --depth 1
cd TerraformGoat
docker build -t terraformgoat:v0.0.3 .
docker build . -t terraformgoat:v0.0.3
```

![img](./images/1652250379.png)
![img](./images/1653031694.png)

After docker build is complete, start and enter the container

Expand All @@ -72,7 +72,7 @@ docker exec -it terraformgoat /bin/bash

When entering the container, you need to select the cloud service to run

![img](./images/1652250438.png)
![img](./images/1653035756.png)

After selecting the cloud service you want to use, the relevant dependencies will be installed. After the relevant dependencies are installed, you can use TerraformGoat.

Expand Down
6 changes: 3 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ TerraformGoat 使用 Dockerfile 构建,因此需要先安装 Docker 环境,D
```shell
git clone https://github.com/HuoCorp/TerraformGoat.git --depth 1
cd TerraformGoat
docker build -t terraformgoat:v0.0.3 .
docker build . -t terraformgoat:v0.0.3
```

![img](./images/1652250379.png)
![img](./images/1653031694.png)

docker build 完成后,启动并进入容器

Expand All @@ -71,7 +71,7 @@ docker exec -it terraformgoat /bin/bash

在进入容器时需要选择要使用到的云服务

![img](./images/1652250438.png)
![img](./images/1653035756.png)

选择你要用的云服务后会安装相关依赖,等相关依赖安装完后,就可以使用 TerraformGoat 了

Expand Down
Binary file removed images/1652250379.png
Binary file not shown.
Binary file removed images/1652250438.png
Binary file not shown.
Binary file added images/1653031694.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/1653035756.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 34 additions & 21 deletions install_cloud_cli.sh
Original file line number Diff line number Diff line change
@@ -1,66 +1,79 @@
#!/bin/bash
mkdir tmp
mkdir -p tmp
cd tmp
echo -e "\e[34m
Welcome to TerraformGoat"
read -p "
0. skip
1. Tencent Cloud
2. Alibaba Cloud
3. Huawei Cloud
4. Amazon Web Services
5. Google Cloud Platform
6. Microsoft Azure
echo -e "\e[32m"
cat << "EOF"
_____ __ ___ _
/__ \___ _ __ _ __ __ _ / _| ___ _ __ _ __ ___ / _ \___ __ _| |_
/ /\/ _ \ '__| '__/ _` | |_ / _ \| '__| '_ ` _ \ / /_\/ _ \ / _` | __|
/ / | __/ | | | | (_| | _| (_) | | | | | | | / /_\\ (_) | (_| | |_
\/ \___|_| |_| \__,_|_| \___/|_| |_| |_| |_\____/\___/ \__,_|\__|
EOF
echo -e "
Welcome To TerraformGoat v0.0.3

Repository URL: https://github.com/HuoCorp/TerraformGoat.git

Choose the cloud service you will use: " cloudcli
------------------------------------------------------------------------\033[0m"

read -p "
0. Skip
1. Tencent Cloud
2. Alibaba Cloud
3. Huawei Cloud
4. Amazon Web Services
5. Google Cloud Platform
6. Microsoft Azure

Select the cloud service provider you will use: " cloudcli
echo ""
if [ $cloudcli -eq 0 ];then
# Skip
echo -e "\e[33m
If you need to install the cloud service command line tool, please run the [bash /install_cloud_cli.sh] command.
"
If you want to install command line tools from other cloud service provider, you can run the \"bash /install_cloud_cli.sh\" command at any time.
\033[0m"
elif [ $cloudcli -eq 1 ];then
# Tencent Cloud Cli
# apt install -qy python3-pip
# pip install tccli -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
echo -e "\e[32m
Dependency installation is complete."
Dependency installation is complete.\033[0m"
elif [ $cloudcli -eq 2 ];then
# Alibaba Cloud Cli
apt-get install -qy wget
wget "https://aliyuncli.alicdn.com/aliyun-cli-linux-3.0.32-amd64.tgz"
tar xzvf aliyun-cli-linux-3.0.32-amd64.tgz
cp aliyun /usr/local/bin
echo -e "\e[32m
Dependency installation is complete."
Dependency installation is complete.\033[0m"
elif [ $cloudcli -eq 3 ];then
# Huawei Cloud Cli
curl -sSL https://hwcloudcli.obs.cn-north-1.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y
echo -e "\e[32m
Dependency installation is complete."
Dependency installation is complete.\033[0m"
elif [ $cloudcli -eq 4 ];then
# Amazon Web Services Cli
apt-get install -qy unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
echo -e "\e[32m
Dependency installation is complete."
Dependency installation is complete.\033[0m"
elif [ $cloudcli -eq 5 ];then
# Google Cloud Platform Cli
curl -O "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-377.0.0-linux-x86_64.tar.gz"
tar -xf google-cloud-sdk-377.0.0-linux-x86_64.tar.gz
N y /root/.bashrc | ./google-cloud-sdk/install.sh
echo -e "\e[32m
Dependency installation is complete, Enter 0 to skip."
Dependency installation is complete, Enter 0 to skip.\033[0m"
source ~/.bashrc
elif [ $cloudcli -eq 6 ];then
# Microsoft Azure Cli
curl -sL https://aka.ms/InstallAzureCLIDeb | bash
echo -e "\e[32m
Dependency installation is complete."
Dependency installation is complete.\033[0m"
else
echo -e "\e[31m
Input error, please check and run the install_cloud_cli.sh script again."
The input value is invalid, please check and run the \"bash /install_cloud_cli.sh\" command again.\033[0m"
fi
cd ..