Skip to content

googleComputeInstanceGroupNamedPort

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:

Example Usage - Instance Group Named Port Gke

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleComputeNetworkContainerNetwork =
  new google.computeNetwork.ComputeNetwork(this, "container_network", {
    auto_create_subnetworks: false,
    name: "container-network",
  });
const googleComputeSubnetworkContainerSubnetwork =
  new google.computeSubnetwork.ComputeSubnetwork(this, "container_subnetwork", {
    ip_cidr_range: "10.0.36.0/24",
    name: "container-subnetwork",
    network: googleComputeNetworkContainerNetwork.name,
    region: "us-central1",
  });
const googleContainerClusterMyCluster =
  new google.containerCluster.ContainerCluster(this, "my_cluster", {
    initial_node_count: 1,
    ip_allocation_policy: [
      {
        cluster_ipv4_cidr_block: "/19",
        services_ipv4_cidr_block: "/22",
      },
    ],
    location: "us-central1-a",
    name: "my-cluster",
    network: googleComputeNetworkContainerNetwork.name,
    subnetwork: googleComputeSubnetworkContainerSubnetwork.name,
  });
new google.computeInstanceGroupNamedPort.ComputeInstanceGroupNamedPort(
  this,
  "my_port",
  {
    group: `\${${googleContainerClusterMyCluster.nodePool.fqn}[0].instance_group_urls[0]}`,
    name: "http",
    port: 8080,
    zone: "us-central1-a",
  }
);
new google.computeInstanceGroupNamedPort.ComputeInstanceGroupNamedPort(
  this,
  "my_ports",
  {
    group: `\${${googleContainerClusterMyCluster.nodePool.fqn}[0].instance_group_urls[0]}`,
    name: "https",
    port: 4443,
    zone: "us-central1-a",
  }
);

Argument Reference

The following arguments are supported:

  • name - (Required) The name for this named port. The name must be 1-63 characters long, and comply with RFC1035.

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

  • group - (Required) The name of the instance group.


  • zone - (Optional) The zone of the instance group.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/zones/{{zone}}/instanceGroups/{{group}}/{{port}}/{{name}}

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

InstanceGroupNamedPort can be imported using any of these accepted formats:

$ terraform import google_compute_instance_group_named_port.default projects/{{project}}/zones/{{zone}}/instanceGroups/{{group}}/{{port}}/{{name}}
$ terraform import google_compute_instance_group_named_port.default {{project}}/{{zone}}/{{group}}/{{port}}/{{name}}
$ terraform import google_compute_instance_group_named_port.default {{zone}}/{{group}}/{{port}}/{{name}}
$ terraform import google_compute_instance_group_named_port.default {{group}}/{{port}}/{{name}}

User Project Overrides

This resource supports User Project Overrides.