Expand description
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:
- API documentation
- How-to Guides
§Example Usage
§Instance Group Named Port Gke
ⓘ
use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
let containerNetwork = network::create(
"containerNetwork",
NetworkArgs::builder()
.auto_create_subnetworks(false)
.name("container-network")
.build_struct(),
);
let containerSubnetwork = subnetwork::create(
"containerSubnetwork",
SubnetworkArgs::builder()
.ip_cidr_range("10.0.36.0/24")
.name("container-subnetwork")
.network("${containerNetwork.name}")
.region("us-central1")
.build_struct(),
);
let myCluster = cluster::create(
"myCluster",
ClusterArgs::builder()
.deletion_protection(true)
.initial_node_count(1)
.ip_allocation_policy(
ClusterIpAllocationPolicy::builder()
.clusterIpv4CidrBlock("/19")
.servicesIpv4CidrBlock("/22")
.build_struct(),
)
.location("us-central1-a")
.name("my-cluster")
.network("${containerNetwork.name}")
.subnetwork("${containerSubnetwork.name}")
.build_struct(),
);
let myPort = instance_group_named_port::create(
"myPort",
InstanceGroupNamedPortArgs::builder()
.group("${myCluster.nodePools[0].instanceGroupUrls[0]}")
.name("http")
.port(8080)
.zone("us-central1-a")
.build_struct(),
);
let myPorts = instance_group_named_port::create(
"myPorts",
InstanceGroupNamedPortArgs::builder()
.group("${myCluster.nodePools[0].instanceGroupUrls[0]}")
.name("https")
.port(4443)
.zone("us-central1-a")
.build_struct(),
);
}
§Import
InstanceGroupNamedPort can be imported using any of these accepted formats:
-
projects/{{project}}/zones/{{zone}}/instanceGroups/{{group}}/{{port}}/{{name}}
-
{{project}}/{{zone}}/{{group}}/{{port}}/{{name}}
-
{{zone}}/{{group}}/{{port}}/{{name}}
-
{{group}}/{{port}}/{{name}}
When using the pulumi import
command, InstanceGroupNamedPort can be imported using one of the formats above. For example:
$ pulumi import gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort default projects/{{project}}/zones/{{zone}}/instanceGroups/{{group}}/{{port}}/{{name}}
$ pulumi import gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort default {{project}}/{{zone}}/{{group}}/{{port}}/{{name}}
$ pulumi import gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort default {{zone}}/{{group}}/{{port}}/{{name}}
$ pulumi import gcp:compute/instanceGroupNamedPort:InstanceGroupNamedPort default {{group}}/{{port}}/{{name}}
Structs§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments