This repository contains code to provision a simple 3-tier sample application to GCP app engine using Terraform as the provisioning engine. The application consists of a node.js client frontend, an express API, and a MySQL database. Once provisioned, the client should display successful connections to the api and database.
- Edit
stack.tf
. There are 3 value placeholders beginning withEXAMPLE
. Replace the 'EXAMPLE' values with ones appropriate for your environment. Also instack.tf
, set your desired region in theprovider
stanza (we've left a default ofus-east1
) - Edit
vars.tf
. For each variable, add a value by assigning a default (eg:default = some_value
) - Edit the node js api code at
./node/api/app.yaml
. Replace PROJECT, REGION, and STACK_NAME with your project, region, and stack_name. - Edit the node js api code at
./node/api/routes/testDB.js
. Locat thevar connection
declaration, and edit thesocketPath
as done in the last step. - In the same file, edit the database connection parameters (database, user, and password)
- Add the password to google secret manager, with the name provided in your
vars.tf
The application is now ready to be deployed with terraform.