Skip to content

europ/gcp-simple-web-server

Repository files navigation

Google Cloud Platform - Simple Web Server

Deploy simple web server provided by nginx in debian 10 to google cloud platform using terraform.

Deployed Infrastructure

infrastructure.png

Dependency Graph

graph.svg

Setup

  1. prerequisites installation

    1. Google Cloud Platform
      • create a project
    2. install Google Cloud SDK
      • authenticate yourself
    3. install Terraform
  2. environment configuration

    cat <<EOS > ~/.gcp
    export GCP_PROJECT_ID=<your GCP project name>
    export GCP_ACCOUNT_FILE=~/.config/gcloud/legacy_credentials/<your@email.com>/adc.json
    export GCP_ZONE=europe-west3-b
    export GCP_REGION=europe-west3
    
    export TF_VAR_gcp_zone="\$GCP_ZONE"
    export TF_VAR_gcp_credentials="\$GCP_ACCOUNT_FILE"
    export TF_VAR_gcp_project_id="\$GCP_PROJECT_ID"
    export TF_VAR_gcp_region="\$GCP_REGION"
    EOS
    
    # secure the file
    chmod 0600 ~/.gcp
    
    # load the file
    source ~/.gcp
  3. clone this repository and cd into it

  4. create SSH key pair

    ssh-keygen -t rsa -b 4096 -C "terraform" -f ./ssh/key
  5. configure terraform variables (set your custom values)

    # create variable file
    cp .terraform.tfvars.example terraform.tfvars
    
    # set custom variable values
    vi terraform.tfvars
  6. deployment

    # download module(s)
    terraform init
    
    # deploy
    terraform apply

About

Deploy simple web server provided by nginx in debian 10 to google cloud platform using terraform.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages