Terraform - GCP - Excercise
Directory Structure
Create a git repository and intialize a directory structure suitable for following resource layout.

Create resources in following scenario using Terraform
- There are two projects
JupiterandMars(You are free to choose any name as long as it follows GCP best practices. Jupiter and Mars are just for reference).MarsProject is only needed in Challenge section. - You should plan to have a
qaand aprodenvironments (<env>in diagram). Assume that the resources are mostly identical. - Create the Virtual Private Cloud (VPC) Network and Subnets.
- Create a bastion server under Jupiter project, on
websubnet. Use default OS for the VM. - Create another VM under
Jupiterproject on app subnet namedrocket-app. This VM should NOT have a pulic IP. - Create appropriate firewall rules so that user can access
rocket-appfrom Bastion server using SSH. The port 80 ofrocket-appshould be accessible too. - Assume
rocket-appVM needs internet access. Since we didn't give it a public IP, next option is to allow access via Cloud NAT. Configure cloud NAT for your netwrok. - When you are working in a team environment, managing and collaborating on code is a problem. Git solves this for us. With Terraform, the state also becomes a problem. Remote state solves this problem. Configure remote state for your project.
Challenge:
- Configure it so that resources from each project can use the same network resources 1.
- Create a Google Kubernetes Engine (GKE) cluster in Mars Project. Use
appsubnet as the primary subnet for cluster.
Info
1This can not be done without Organization level permissions. To set up an organization you need either Gsuite or Cloud Identity. Premium tier costs $6/month. Cloud identity has a free tierhttps://cloud.google.com/identity/docs/set-up-cloud-identity-admin#sign-up-for-cloud-identity-free. Use that to set up an organization. You would also need your own domain name.