Skip to content
Snippets Groups Projects
create_lab.sh 851 B
Newer Older
  • Learn to ignore specific revisions
  • Nathan Rodet's avatar
    Nathan Rodet committed
    #!/bin/bash
    
    echo "|------------------------|"
    echo "| INITIALISATION DU LABO |"
    echo "|------------------------|"
    
    if [ ! -f ".env" ]; then
        echo "Créez un fichier .env de la forme suivante :"
        echo "SCW_ACCESS_KEY="
        echo "SCW_SECRET_KEY="
        echo "TF_VAR_PROJECT_ID="
        echo "TF_VAR_INSTANCES_COUNT=2"
        exit 1
    fi
    
    export $(cat .env | xargs)
    # Move to Terraform directory
    cd ./terraform
    # Initialize a Terraform working directory
    terraform init
    # Generate and show the execution plan
    terraform plan
    # Build the infrastructure
    terraform apply
    # Echo Terraform outputs
    terraform output
    # Move to default directory
    cd ..
    
    echo "|--------------|"
    echo "| LABO DÉMARRÉ |"
    echo "|--------------|"
    
    echo "Se connecter sur les IPs, avec le port 80 pour webtop, et 8080 pour code-server."
    echo "Le mot de passe des instances est yfB4W23G."