diff options
author | William Carroll <wpcarro@gmail.com> | 2021-12-28T01·56-0400 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2021-12-28T02·03+0000 |
commit | 3a85d8cededded1afb6d947f073f9ba0ebd1fb9e (patch) | |
tree | 15f045dc608c1e341fd73ca66fe3dfa1a17e29bb /users/wpcarro/terraform/gcp.tf | |
parent | c05c6920ee4d15d5d32e1294319b68091bb7af3b (diff) |
feat(wpcarro/terraform): Encode diogenes as terraform configuration r/3485
Some reference commands for my future self (blog post forthcoming?): ```shell $ nix-shell -p google-cloud-sdk terraform $ gcloud auth application-default login # stateful $ terraform init $ terraform apply ``` What's left for feature parity? - Encode 100GB external disk as resource - Encode firewall as resource - Ensure marcus can SSH to instance Stretch goals: - Spin-up fully NixOS-configured instances Change-Id: If156a5b0a2a0f8bfdf2548a4b5f592a77409fcb5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/4724 Reviewed-by: wpcarro <wpcarro@gmail.com> Autosubmit: wpcarro <wpcarro@gmail.com> Tested-by: BuildkiteCI
Diffstat (limited to 'users/wpcarro/terraform/gcp.tf')
-rw-r--r-- | users/wpcarro/terraform/gcp.tf | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/users/wpcarro/terraform/gcp.tf b/users/wpcarro/terraform/gcp.tf new file mode 100644 index 000000000000..f287e90e919d --- /dev/null +++ b/users/wpcarro/terraform/gcp.tf @@ -0,0 +1,47 @@ +provider "google" { + project = "wpcarros-infrastructure" + region = "us-central1" + zone = "us-central1-a" +} + +data "google_compute_default_service_account" "default" {} + +resource "google_compute_instance" "default" { + name = "diogenes-2" + machine_type = "e2-standard-2" + zone = "us-central1-a" + hostname = "diogenes.wpcarro.dev" + + tags = [ + "http-server", + "https-server", + "mosh-server", + "quassel-core", + ] + + boot_disk { + device_name = "boot" + + initialize_params { + size = 10 + image = "nixos-20-03" + } + } + + network_interface { + network = "default" + subnetwork = "default" + + access_config { + public_ptr_domain_name = "wpcarro.dev" + } + } + + metadata = { + enable-oslogin = "TRUE" + } + + service_account { + scopes = ["cloud-platform"] + } +} \ No newline at end of file |