Skip to content

Latest commit

 

History

History
94 lines (74 loc) · 5.48 KB

README.md

File metadata and controls

94 lines (74 loc) · 5.48 KB

GCP Nomad Clients

This is a simple Terraform module to create Nomad clients for your CircleCI server application on Google Cloud Platform.

Usage

A basic example is as simple as this:

provider "google-beta" {
  project = "my-project"
  region  = "us-east1"
  zone    = "us-east1-a"
}

module "nomad" {
  # We strongly recommend pinning the version using ref=<<release tag>> as is done here
  source = "git::https://github.com/CircleCI-Public/server-terraform.git//nomad-gcp?ref=3.2.0"

  zone            = "us-east1-a"
  region          = "us-east1"
  network         = "default"
  server_endpoint = "nomad.example.com:4647"
}

output "module" {
  value = module.nomad
}

There are more examples in the examples directory.

Requirements

Name Version
google ~> 3.0

Providers

Name Version
google ~> 3.0

Modules

Name Source Version
tls ./../shared/modules/tls

Resources

Name
google_compute_autoscaler
google_compute_firewall
google_compute_image
google_compute_instance_group_manager
google_compute_instance_template
google_compute_target_pool

Inputs

Name Description Type Default Required
assign_public_ip Assign public IP bool true no
autoscaling_mode Autoscaler mode. Can be
- "ON": Autoscaler will scale up and down to reach cpu target and react to cron schedules
- "OFF": Autoscaler will never scale up or down
- "ONLY_UP": Autoscaler will only scale up (default)
Warning: jobs may be interrupted on scale down. Only select "ON" if
interruptions are acceptible for your use case.
string "ONLY_UP" no
autoscaling_schedules Autoscaler scaling schedules. Accepts the same arguments are documented
upstream here: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_autoscaler#scaling_schedules
list(object({
name = string
min_required_replicas = number
schedule = string
time_zone = string
duration_sec = number
disabled = bool
description = string
}))
[] no
blocked_cidrs List of CIDR blocks to block access to from inside nomad jobs list(string) [] no
disk_size_gb Root disk size in GB number 300 no
disk_type Root disk type. Can be 'pd-standard', 'pd-ssd', 'pd-balanced' or 'local-ssd' string "pd-ssd" no
machine_type Instance type for nomad clients. The machine type must be large enough to fit the resource classes required. Choosing smaller instance types is an opportunity for cost savings. string "n2d-standard-8" no
max_replicas Max number of nomad clients when scaled up number 4 no
min_replicas Minimum number of nomad clients when scaled down number 1 no
name VM instance name for nomad client string "nomad" no
network Network to deploy nomad clients into. If you are using a shared vpc, provide the network endpoint rather than the name string "default" no
subnetwork Subnetwork to deploy nomad clients into. This is required if using custom subnets or a shared vpc. If you are using a shared vpc, provide the subnetwork endpoint rather than the name string "" for custom subnets and shared vpcs
nomad_auto_scaler If true, terraform will generate a service account to be used by nomad-autoscaler which will manage scaling of your nomad cluster. The service account key will be output to the file nomad-as-key.json, generated in your current working directory bool false no
preemptible Whether or not to use preemptible nodes bool false no
region GCP region to deploy nomad clients into (e.g us-east1) string n/a yes
retry_with_ssh_allowed_cidr_blocks List of source IP CIDR blocks that can use the 'retry with SSH' feature of CircleCI jobs list(string)
[
"0.0.0.0/0"
]
no
server_endpoint Hostname:port of nomad control plane string n/a yes
target_cpu_utilization Target CPU utilization to trigger autoscaling number 0.5 no
unsafe_disable_mtls Disables mTLS between nomad client and servers. Compromises the authenticity and confidentiality of client-server communication. Should not be set to true in any production setting bool false no
zone GCP compute zone to deploy nomad clients into (e.g us-east1-a) string n/a yes

Outputs

Name Description
nomad_server_cert n/a
nomad_server_key n/a
nomad_tls_ca n/a