Skip to content

Module to create infrastructure in GCP for running Harness Gitspaces – includes creation of VPCs, Subnetworks, IAM, Cloud NAT, and supporting services.

License

Notifications You must be signed in to change notification settings

harness/terraform-gcp-harness-gitspaces

Repository files navigation

harness-gitspaces-gcp

Module to create infrastructure in GCP for running Harness Gitspaces – includes creation of VPCs, Subnetworks, IAM, Cloud NAT, and supporting services.

Prerequisite

You must have a GCP project with the following APIs enabled:

  • Cloud Resource Manager APIapi/cloudresourcemanager.googleapis.com
  • Compute Engine APIapi/compute.googleapis.com
  • Certificate Manager APIapi/certificatemanager.googleapis.com
  • Identity and Access Management (IAM) APIapi/iam.googleapis.com
  • Cloud DNS APIapi/dns.googleapis.com
  • Google Cloud Memorystore for Redis API - api/redis.googleapis.com

Gateway:

  • Creation service account for gateway deployment
  • Instance Group
  • Instance Template
  • Update Backend Service for ALB and NLB

Terraform Variables

Terraform Inputs

Variable Name Type Description Required Default / Validation
service_account_key_file string The path to the service account key file. Yes
infra_config_yaml_file string The path to the YAML file containing infrastructure configuration. Yes
manage_dns_zone bool Whether the DNS zone should be managed by the module. Yes
use_gcp_certificate_manager bool Use Google Certificate Manager for SSL certificates. No true
private_key_path string Path to the private key file for SSL certificate. Required if not using Certificate Manager. No ""
certificate_path string Path to the SSL certificate file. Required if not using Certificate Manager. No ""
create_runner_vm bool Whether to create Gitspace runner VM as part of infrastructure provisioning. No false

Terraform Outputs

Output Name Description Value / Reference Notes
vpc_network_id The ID of the VPC network module.infra.vpc_network_id Used to identify the created VPC
vpc_network_name The name of the VPC network module.infra.vpc_network.name Human-readable VPC name
alb_ips The external IPs for the ALB module.infra.alb_ips List of IPs assigned to the ALB
nlb_ips The external IPs for the NLB module.infra.nlb_ips List of IPs assigned to the NLB
instance_yaml YAML-encoded runner instance config yamlencode(local.instance_yaml_content) Encoded YAML structure for VMs
sub_networks List of subnetwork objects module.infra.sub_networks Contains subnet ID, region, etc.

Example:

module "harness_gitspacs_gcp" {
  infra_config_yaml_file      = "infra_config.yaml"
  service_account_key_file    = "service-account-key.json"
  manage_dns_zone             = true
  use_gcp_certificate_manager = true
  certificate_path            = "sample_domain.cert" # Optional if using GCP Certificate Manager
  private_key_path            = "sample_domain.key" # Optional if using GCP Certificate Manager
  create_runner_vm            = true
}

About

Module to create infrastructure in GCP for running Harness Gitspaces – includes creation of VPCs, Subnetworks, IAM, Cloud NAT, and supporting services.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages