https://github.com/dzmitry-lahoda/hcl-nix-for-web3/ - see how I build vm image, and feed image to TF, generate TF json via terranix, and apply (it also has Google examle)
flake.nix in root and this https://github.com/dzmitry-lahoda/hcl-nix-for-web3/blob/master/terranix/05.nix
also
terranix/terranix#7
terranix/terranix#45
https://discuss.hashicorp.com/t/configure-both-local-development-and-production-environments-with-terraform/25061/6?u=dzmitry-lahoda
https://github.com/arcnmx/tf-nix
sorry for chunked comments, hope you will be able to wire from reference
==============
Why Terraform?
It is a well documented versatile cloud configuration tool for 5+ of clouds and 100+ of S/I/F/P-aaSs. It consumes a JSON file describing desired cloud configuration. Its internal workings are identical to what NixOps is doing.
Terraform is a cloud lingua franca well known and liked by developers, architects, SRE and ops.
Terraranix is a thin layer to generate JSON from Nix and run validation routines.
Terraform with its state and configuration patterns for cloud is 1 to 1 what Nixos modules did to local machines. Cloud is just a machine from a Terraform point of view.
Why Nix?
Nix is the biggest and fastest growing software artifact, configuration and package management ecosystem built on Blockchain/Git like foundations.
Cloud VM (nixos-generators), local Nixos(VM or bare metal), local Linux(home-manager) and local containers share the same configuration language and patterns. That allows the machine once specified by developers to be tuned to any environment it runs.
Nix ecosystem is idempotent, immutable, reproducible, deterministics, rollbackable and traceable out of the box. Which is desired property by developers, architects, SRE and ops.
How to Nix?
Nix flake to be provided which configures Google Cloud basic, Terranix and VM image. SRE, CI and developers will provide their own env arguments and TF variables to layer.
It will take several lines to run our staging environment or play with an ad hoc manual environment for testing.