Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/europ/gcp-simple-web-server

Deploy simple web server provided by nginx in debian 10 to google cloud platform using terraform.
https://github.com/europ/gcp-simple-web-server

debian debian10 gcp google-cloud-platform nginx terraform web-server

Last synced: 15 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# Google Cloud Platform - Simple Web Server

Deploy simple web server provided by [nginx](https://www.nginx.com/) in [debian 10](https://www.debian.org/index.html) to [google cloud platform](https://cloud.google.com/) using [terraform](https://www.terraform.io/).

##### Deployed Infrastructure

![infrastructure.png](.other/yEd/infrastructure.png)

##### Dependency Graph

![graph.svg](.other/graph.svg)

### Setup

1. prerequisites installation

1. [Google Cloud Platform](https://console.cloud.google.com/)
* create a project
1. install [Google Cloud SDK](https://cloud.google.com/sdk/docs/install)
* authenticate yourself
1. install [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli)

1. environment configuration

```bash
cat < ~/.gcp
export GCP_PROJECT_ID=
export GCP_ACCOUNT_FILE=~/.config/gcloud/legacy_credentials//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
```

1. clone this repository and `cd` into it

1. create SSH key pair

```bash
ssh-keygen -t rsa -b 4096 -C "terraform" -f ./ssh/key
```

1. configure terraform variables (set your custom values)

```bash
# create variable file
cp .terraform.tfvars.example terraform.tfvars

# set custom variable values
vi terraform.tfvars
```

1. deployment

```bash
# download module(s)
terraform init

# deploy
terraform apply
```