From 7abaa1944d9971ce7562b99e14afa5076a57d3c1 Mon Sep 17 00:00:00 2001 From: Alec Warner Date: Thu, 27 Dec 2018 10:55:21 -0500 Subject: Start of terraform config. Main and Rysnc template. Signed-off-by: Alec Warner --- src/infra.gentoo.org/main.tf | 8 ++++++ src/infra.gentoo.org/rsync.tf | 63 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 src/infra.gentoo.org/main.tf create mode 100644 src/infra.gentoo.org/rsync.tf diff --git a/src/infra.gentoo.org/main.tf b/src/infra.gentoo.org/main.tf new file mode 100644 index 0000000..65b542c --- /dev/null +++ b/src/infra.gentoo.org/main.tf @@ -0,0 +1,8 @@ +provider "google" { + # credentials are default + project = "gentoo-infra-dev" + region = "us-central1" + zone = "us-central1a" +} + + diff --git a/src/infra.gentoo.org/rsync.tf b/src/infra.gentoo.org/rsync.tf new file mode 100644 index 0000000..77ef342 --- /dev/null +++ b/src/infra.gentoo.org/rsync.tf @@ -0,0 +1,63 @@ +//resource "google_compute_region_instance_group_manager" "rsync-node-mig" { +// name = "rsync-node-mig" + + //base_instance_name = "rsync-node" +// instance_template = "${google_compute_instance_template.rsync-node-template.self_link}" + // Terraform will not restart the VMs on deploy. +// update_strategy = "NONE" +// zone = "us-central1-a" + +// target_pools = ["${google_compute_target_pool.appserver.self_link}"] +// target_size = 1 +//} + +resource "google_compute_instance_template" "rsync-node-template" { + name = "rsync-node-template" + description = "This template is used to create rsync node instances." + + tags = [] + + labels = { + container-vm = "cos-stable-71-11151-60-0" + environment = "prod" + } + + instance_description = "rsync node" + machine_type = "n1-standard-1" + can_ip_forward = false + + scheduling { + automatic_restart = true + on_host_maintenance = "MIGRATE" + } + + disk { + source_image = "projects/cos-cloud/global/images/cos-stable-71-11151-60-0" + auto_delete = true + boot = true + } + + network_interface { + network = "default" + access_config { + nat_ip = "35.211.168.167" + network_tier = "STANDARD" + } + } + + metadata { + google-logging-enabled = "true" + gce-container-declaration = "spec:\n containers:\n - name: rsync-2\n image: us.gcr.io/gentoo-infra-dev/rsync-node\n stdin: false\n tty: false\n restartPolicy: Always\n\n# This container declaration format is not public API and may change without notice. Please\n# use gcloud command-line tool or Google Cloud Console to run Containers on Google Compute Engine." + } + + service_account { + scopes = [ + "https://www.googleapis.com/auth/devstorage.read_only", + "https://www.googleapis.com/auth/logging.write", + "https://www.googleapis.com/auth/monitoring.write", + "https://www.googleapis.com/auth/servicecontrol", + "https://www.googleapis.com/auth/service.management.readonly", + "https://www.googleapis.com/auth/trace.append" + ] + } +} -- cgit v1.2.3-65-gdbad