Google Compute Engine Instance Group Named Port

This page shows how to write Terraform for Compute Engine Instance Group Named Port and write them securely.

google_compute_instance_group_named_port (Terraform)

The Instance Group Named Port in Compute Engine can be configured in Terraform with the resource name google_compute_instance_group_named_port. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

github-iconEscoto/GKE-Ghost-Deployment
resource "google_compute_instance_group_named_port" "named_port_0" {
  group = google_container_cluster.gke_cluster.instance_group_urls[0]
  name  = "http"
  port  = 30000
}

github-iconMehmetIron/infra-bootcamp
resource "google_compute_instance_group_named_port" "http_port" {
  group = google_compute_instance_group_manager.jack_manager.name
  zone = data.google_compute_zones.available.names.0

  name = "http"
  port = 80
github-iconhusnusensoy/infra-bootcamp
resource "google_compute_instance_group_named_port" "http_port" {
  group = google_compute_instance_group_manager.jack_manager.name
  zone = data.google_compute_zones.available.names.0

  name = "http"
  port = 80
github-iconneuralnetes/monorepo
resource "google_compute_instance_group_named_port" "http" {
  for_each = data.google_compute_instance_group.instance_groups
  group    = each.value.self_link
  zone     = each.value.zone
  name     = "http"
  port     = 80
github-iconniveklabs/google
resource "google_compute_instance_group_named_port" "this" {
  group   = var.group
  name    = var.name
  port    = var.port
  project = var.project
  zone    = var.zone

Parameters

  • group required - string
    • The name of the instance group.

  • id optionalcomputed - string
  • name required - string
    • The name for this named port. The name must be 1-63 characters long, and comply with RFC1035.

  • port required - number
    • The port number, which can be a value between 1 and 65535.

  • project optionalcomputed - string
  • zone optionalcomputed - string
    • The zone of the instance group.

Explanation in Terraform Registry

Mange the named ports setting for a managed instance group without managing the group as whole. This resource is primarily intended for use with GKE-generated groups that shouldn't otherwise be managed by other tools. To get more information about InstanceGroupNamedPort, see:

Frequently asked questions

What is Google Compute Engine Instance Group Named Port?

Google Compute Engine Instance Group Named Port is a resource for Compute Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Compute Engine Instance Group Named Port?

For Terraform, the Escoto/GKE-Ghost-Deployment, MehmetIron/infra-bootcamp and husnusensoy/infra-bootcamp source code examples are useful. See the Terraform Example section for further details.

security-icon

Scan your IaC problem in 3 minutes for free

You can keep your IaC security for free. No credit card required.