Terraform - GCP - Excercise
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
Mars(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
<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 named
rocket-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 of
rocket-appshould be accessible too.
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.
- 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.