As usual - create your own TF repo.
In this HW you need to implement Terraform module, that should deploy GCE instance and several related resources.
In addition to that you need to call that module in root TF module, and pass some outputs, like subnet self link, from VPC module to your GCE instance module
GCE instance module should create next resources
-
google_compute_instance
- should be configurable with next variables
- name
- machine_type
- zone
- image
- network
- subnet
- startup_script
- should be configurable with next variables
-
google_compute_address with internal address in subnet, that you create in VPC module https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_address#example-usage---address-with-subnetwork
- should be configurable with next variables
- name
- subnetwork
- address_type - should be internal by default
- address
- region
- should be configurable with next variables
-
google_compute_disk
- should be configurable with next variables https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_disk#example-usage---disk-basic
- name
- size
- type - should be HDD by default(pd-balanced)
- zone
- should be configurable with next variables https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_disk#example-usage---disk-basic
-
google_compute_attached_disk
- should be configurable with next variables https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_attached_disk#example-usage
- disk
- instance
- should be configurable with next variables https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_attached_disk#example-usage
Then connect two modules together in root TF module to create VPC with nat and GCE instance in that VPC and subnet
main.tf
- module VPC
- module GCE instance