-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the script I am using to learn glcoud/terraform commands to create the cluster using the terraform files from Tim.
- Loading branch information
Tony
authored and
GitHub
committed
May 10, 2021
1 parent
e8c3402
commit 5fd6b52
Showing
1 changed file
with
46 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,46 @@ | ||
| #!/bin/sh | ||
| # | ||
| # CLASS-HCP-GCP | ||
| # | ||
| # | ||
| # | ||
|
|
||
| GCLOUDUSER="" | ||
| PROJECT_ID="" | ||
| SAUSER="" | ||
| ZONE="" | ||
| FOLDER_ID="" | ||
|
|
||
| gcloud config set account $GCLOUDUSER | ||
| gcloud projects create $PROJECT_ID --folder=$FOLDER_ID | ||
| sleep 30 | ||
| gcloud config set project $PROJECT_ID | ||
| gcloud services enable compute.googleapis.com iam.googleapis.com kubernetes.googleapis.com file.googleapis.com | ||
| gcloud iam service-accounts create $SAUSER --display-name "Tony Terraform" | ||
| gcloud projects add-iam-policy-binding $PROJECT_ID --member serviceAccount:$SAUSER@$PROJECT_ID.iam.gserviceaccount.com --role='roles/editor' | ||
| gcloud projects add-iam-policy-binding $PROJECT_ID --member serviceAccount:$SAUSER@$PROJECT_ID.iam.gserviceaccount.com --role='roles/iam.securityAdmin' | ||
| gcloud iam service-accounts keys create $SAUSER-credentials.json --iam-account=$SAUSER@$PROJECT_ID.iam.gserviceaccount.com | ||
| echo "$SAUSER-credentials.json" >>.gitignore | ||
| echo "local*" >>.gitignore | ||
| echo " Initialize Terraform" | ||
| make init | ||
| sleep 30 | ||
| echo " Validating Terraform input files " | ||
| make validate | ||
| sleep 30 | ||
| echo " Running Terraform plan" | ||
| make plan | ||
| sleep 30 | ||
| echo " Applying Terraform plan" | ||
| make apply | ||
|
|
||
| # | ||
| # | ||
| # commands to run after the cluster is made. | ||
| # | ||
| # gcloud compute instances list | ||
| # gcloud beta compute ssh --zone "$ZONE" "class-login0" --project "$PROJECT_ID" | ||
| # sinfo | ||
| # srun hostname | ||
| # sinfo | ||
| # make destroy |