Skip to content

antmicro/github-actions-runner-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform module for GitHub Actions custom runner

Copyright (c) 2020-2023 Antmicro

The aim of this project is to simplify the deployment of Antmicro's GitHub Actions runner and to describe the virtual resources according to IaC principles.

Usage

In order to deploy the infrastructure, make sure that the service account has the following roles assigned:

  • Compute Admin for creating and managing resources within the Compute Engine.
  • Security Admin for managing IAM policies.
  • Service Account Creator for managing the service account linked with the coordinator instance.
  • Service Account User for assigning the aforementioned service account to the coordinator instance.
  • Service Usage Admin for enabling the necessary APIs.
  • (optional) Storage Admin for managing GCS buckets for data archiving purposes e.g. storing job logs.

Note that there is no explicit module-level parameter for passing the project name. If you don't want Terraform to use the default value, declare a provider, set the project argument and pass the provider as a meta-argument to the module declaration.

Long-term usage considerations

Changing certain parameters after the module has been applied may result in the necessity to recreate one or more resources. This section is an attempt to document these scenarios.

Enabling or disabling IPv6 support

Changing the gcp_vpc_ipv6 variable will always result in recreation of all subnetworks. That's because it is not possible to edit the stack type (IPv4 only or dual stack) of the subnetwork after it has been created. Therefore, in order to change this particular parameter of a subnetwork, it is necessary to first remove it and create it again.

For this operation to succeed, the following preconditions must be true:

  • no worker instance may be running
  • the coordinator instance must be stopped
  • the network associated with the coordinator instance must be changed to something else (e.g. default)

Requirements

Name Version
terraform >= 0.13
google ~> 4.42.1
google-beta ~> 4.42.1

Providers

Name Version
google ~> 4.42.1

Modules

No modules.

Resources

Name Type
google_compute_address.gha-coordinator-static-ip resource
google_compute_attached_disk.gha-coordinator-logdisk-attached resource
google_compute_attached_disk.gha-coordinator-persistentdisk-attached resource
google_compute_attached_disk.gha-coordinator-sifimagedisk-attached resource
google_compute_disk.gha-coordinator-bootdisk resource
google_compute_disk.gha-coordinator-logdisk resource
google_compute_disk.gha-coordinator-persistentdisk resource
google_compute_disk.gha-coordinator-sifimagedisk resource
google_compute_firewall.gha-firewall-allow-c-to-r resource
google_compute_firewall.gha-firewall-allow-incoming-ssh resource
google_compute_firewall.gha-firewall-allow-unbound resource
google_compute_firewall.gha-firewall-drop-incoming-r-to-c resource
google_compute_instance.gha-coordinator resource
google_compute_network.gha-network resource
google_compute_router.gha-router resource
google_compute_router_nat.gha-nat resource
google_compute_subnetwork.gha-subnet resource
google_project_iam_member.gha-coordinator-sa-role resource
google_project_iam_member.gha-coordinator-sa-role-sa-user resource
google_project_iam_member.gha-coordinator-sa-role-sm-accessor resource
google_project_iam_member.gha-coordinator-sa-role-sm-viewer resource
google_project_service.compute-engine-api resource
google_project_service.iam-api resource
google_project_service.storage-api resource
google_service_account.gha-coordinator-sa resource
google_storage_bucket.gha-log-bucket resource
google_storage_bucket_iam_member.gha-coordinator-sa-role-bucket-creator resource
google_project.project data source

Inputs

Name Description Type Default Required
gcp_arm64_worker_image_name Name of the image used for worker instances (ARM64) string "" no
gcp_auxiliary_zones A list of zones where workers can be spawned in case of home zone resource exhaustion (beta) list(any) [] no
gcp_boot_image_bucket_name Name of the bucket used for uploading and storing boot images string "" no
gcp_build_results_viewer_public_url Address of build-results-viewer front-end string "" no
gcp_build_results_viewer_url Address and port of build-results-viewer backend string "" no
gcp_coordinator_boot_image_update Name of the image to use for updating coordinator boot disk string "" no
gcp_coordinator_disk_image Name of the image to use for coordinator boot disk - cannot be changed string "projects/debian-cloud/global/images/debian-10-buster-v20210512" no
gcp_coordinator_disk_name_prefix Defaults to instance name if not specified. string null no
gcp_coordinator_disk_name_suffix String to append after instance name (useful for managing legacy deployments) string "---boot-disk" no
gcp_coordinator_disk_size Runner coordinator boot disk size in gigabytes number 10 no
gcp_coordinator_disk_type Runner coordinator boot disk type string "pd-standard" no
gcp_coordinator_log_disk_present Specify if a sepearate disk for logs should be created and managed bool false no
gcp_coordinator_log_disk_size Runner coordinator log disk size in gigabytes number 10 no
gcp_coordinator_machine_type Runner coordinator machine type string "n2-standard-4" no
gcp_coordinator_name Runner coordinator instance name string "gha-runner-coordinator" no
gcp_coordinator_persistent_disk_present Specify if a sepearate disk for persistent data should be created and managed (beta) bool false no
gcp_coordinator_persistent_disk_size Runner coordinator persistent disk size in gigabytes (beta) number 50 no
gcp_coordinator_reserve_static_internal_ip Reserve a static IP for coordinator within gcp_subnet bool false no
gcp_coordinator_scale Number of runners that coordinator should enable (beta) number "0" no
gcp_coordinator_sif_image_disk_present Specify if a sepearate disk for image should be attached (beta) bool false no
gcp_coordinator_sif_image_name Name of the image containing sif image of the coordinator (beta) string "" no
gcp_log_bucket_name Name of the bucket used for storing log files string null no
gcp_sa_access_scope API access scope for coordinator service account string "https://www.googleapis.com/auth/compute" no
gcp_service_account Name component of the service account for coordinator string "gha-runner-coordinator-sa" no
gcp_subnet Name for VPC network and subnetwork string "gha-runner-net" no
gcp_vpc_ipv6 Enable external IPv6 access for worker machines bool false no
gcp_vpc_newbits The newbits parameter passed to cidrsubnet number 8 no
gcp_vpc_no_firewall Do not create firewall rules in the dedicated VPC network bool false no
gcp_vpc_prefix Total CIDR range (the prefix parameter passed to cidrsubnet) string "10.0.0.0/8" no
gcp_worker_image_name Name of the image used for worker instances string "" no
gcp_zone Zone where the coordinator instance, VPC resources and workers will be created string "us-west1-a" no

Outputs

Name Description
coordinator_sa The email address of the service account assigned to the coordinator machine
coordinator_static_ip Static IP address of the coordinator machine (null if ephemeral)
coordinator_vpc_self_link Self-link to the VPC network of the deployment

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •