Skip to content

TaitoUnited/terraform-google-compute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google compute

Example usage:

provider "google" {
  project          = "my-infrastructure"
  region           = "europe-west1"
  zone             = "europe-west1-b"
}

resource "google_project_service" "compute" {
  service          = "compute.googleapis.com"
}

module "compute" {
  source           = "TaitoUnited/compute/google"
  version          = "1.0.0"

  project_id       = "my-project"
  network          = "my-project-net"
  virtual_machines = yamldecode(file("${path.root}/../infra.yaml"))["virtualMachines"]
}

Example YAML:

virtualMachines:
  - name: my-server
    zone: europe-west1-b
    subnetwork: subnet-europe-west1
    externalIp: false
    machineType: e2-medium
    diskSizeGb: 100

  - name: my-server2
    zone: europe-west1-b
    subnetwork: subnet-europe-west1
    sshAuthorizedNetworks: ["35.235.240.0/20"]
    publicAuthorizedNetworks: ["0.0.0.0/32"]
    publicTcpPorts: ["80", "443"]
    machineType: e2-medium
    image: debian-cloud/debian-12
    diskSizeGb: 100
    gpuType: nvidia-tesla-t4
    gpuCount: 1

YAML attributes:

  • See variables.tf for all the supported YAML attributes.
  • See compute_instance for attribute descriptions.

Combine with the following modules to get a complete infrastructure defined by YAML:

TIP: Similar modules are also available for AWS, Azure, and DigitalOcean. All modules are used by infrastructure templates of Taito CLI. See also Google Cloud project resources, Full Stack Helm Chart, and full-stack-template.

Contributions are welcome!