AddressArgs

data class AddressArgs(val address: Output<String>? = null, val addressType: Output<String>? = null, val description: Output<String>? = null, val ipVersion: Output<String>? = null, val ipv6EndpointType: Output<String>? = null, val labels: Output<Map<String, String>>? = null, val name: Output<String>? = null, val network: Output<String>? = null, val networkTier: Output<String>? = null, val prefixLength: Output<Int>? = null, val project: Output<String>? = null, val purpose: Output<String>? = null, val region: Output<String>? = null, val subnetwork: Output<String>? = null) : ConvertibleToJava<AddressArgs>

Represents an Address resource. Each virtual machine instance has an ephemeral internal IP address and, optionally, an external IP address. To communicate between instances on the same network, you can use an instance's internal IP address. To communicate with the Internet and instances outside of the same network, you must specify the instance's external IP address. Internal IP addresses are ephemeral and only belong to an instance for the lifetime of the instance; if the instance is deleted and recreated, the instance is assigned a new internal IP address, either by Compute Engine or by you. External IP addresses can be either ephemeral or static. To get more information about Address, see:

Example Usage

Address Basic

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Address;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var ipAddress = new Address("ipAddress");
}
}

Address With Subnetwork

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.Subnetwork;
import com.pulumi.gcp.compute.SubnetworkArgs;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.AddressArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var defaultNetwork = new Network("defaultNetwork");
var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder()
.ipCidrRange("10.0.0.0/16")
.region("us-central1")
.network(defaultNetwork.id())
.build());
var internalWithSubnetAndAddress = new Address("internalWithSubnetAndAddress", AddressArgs.builder()
.subnetwork(defaultSubnetwork.id())
.addressType("INTERNAL")
.address("10.0.42.42")
.region("us-central1")
.build());
}
}

Address With Gce Endpoint

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.AddressArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var internalWithGceEndpoint = new Address("internalWithGceEndpoint", AddressArgs.builder()
.addressType("INTERNAL")
.purpose("GCE_ENDPOINT")
.build());
}
}

Instance With Ip

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetImageArgs;
import com.pulumi.gcp.compute.Instance;
import com.pulumi.gcp.compute.InstanceArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskInitializeParamsArgs;
import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var static_ = new Address("static");
final var debianImage = ComputeFunctions.getImage(GetImageArgs.builder()
.family("debian-11")
.project("debian-cloud")
.build());
var instanceWithIp = new Instance("instanceWithIp", InstanceArgs.builder()
.machineType("f1-micro")
.zone("us-central1-a")
.bootDisk(InstanceBootDiskArgs.builder()
.initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
.image(debianImage.applyValue(getImageResult -> getImageResult.selfLink()))
.build())
.build())
.networkInterfaces(InstanceNetworkInterfaceArgs.builder()
.network("default")
.accessConfigs(InstanceNetworkInterfaceAccessConfigArgs.builder()
.natIp(static_.address())
.build())
.build())
.build());
}
}

Compute Address Ipsec Interconnect

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.NetworkArgs;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.AddressArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var network = new Network("network", NetworkArgs.builder()
.autoCreateSubnetworks(false)
.build());
var ipsec_interconnect_address = new Address("ipsec-interconnect-address", AddressArgs.builder()
.addressType("INTERNAL")
.purpose("IPSEC_INTERCONNECT")
.address("192.168.1.0")
.prefixLength(29)
.network(network.selfLink())
.build());
}
}

Import

Address can be imported using any of these accepted formats

$ pulumi import gcp:compute/address:Address default projects/{{project}}/regions/{{region}}/addresses/{{name}}
$ pulumi import gcp:compute/address:Address default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:compute/address:Address default {{region}}/{{name}}
$ pulumi import gcp:compute/address:Address default {{name}}

Constructors

Link copied to clipboard
constructor(address: Output<String>? = null, addressType: Output<String>? = null, description: Output<String>? = null, ipVersion: Output<String>? = null, ipv6EndpointType: Output<String>? = null, labels: Output<Map<String, String>>? = null, name: Output<String>? = null, network: Output<String>? = null, networkTier: Output<String>? = null, prefixLength: Output<Int>? = null, project: Output<String>? = null, purpose: Output<String>? = null, region: Output<String>? = null, subnetwork: Output<String>? = null)

Properties

Link copied to clipboard
val address: Output<String>? = null

The static external IP address represented by this resource. The IP address must be inside the specified subnetwork, if any. Set by the API if undefined.

Link copied to clipboard
val addressType: Output<String>? = null

The type of address to reserve. Note: if you set this argument's value as INTERNAL you need to leave the network_tier argument unset in that resource block. Default value is EXTERNAL. Possible values are: INTERNAL, EXTERNAL.

Link copied to clipboard
val description: Output<String>? = null

An optional description of this resource.

Link copied to clipboard
val ipv6EndpointType: Output<String>? = null

The endpoint type of this address, which should be VM or NETLB. This is used for deciding which type of endpoint this address can be used after the external IPv6 address reservation. Possible values are: VM, NETLB.

Link copied to clipboard
val ipVersion: Output<String>? = null

The IP Version that will be used by this address. The default value is IPV4. Possible values are: IPV4, IPV6.

Link copied to clipboard
val labels: Output<Map<String, String>>? = null

Labels to apply to this address. A list of key->value pairs.

Link copied to clipboard
val name: Output<String>? = null

Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

Link copied to clipboard
val network: Output<String>? = null

The URL of the network in which to reserve the address. This field can only be used with INTERNAL type with the VPC_PEERING and IPSEC_INTERCONNECT purposes.

Link copied to clipboard
val networkTier: Output<String>? = null

The networking tier used for configuring this address. If this field is not specified, it is assumed to be PREMIUM. This argument should not be used when configuring Internal addresses, because network tier cannot be set for internal traffic; it's always Premium. Possible values are: PREMIUM, STANDARD.

Link copied to clipboard
val prefixLength: Output<Int>? = null

The prefix length if the resource represents an IP range.

Link copied to clipboard
val project: Output<String>? = null

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val purpose: Output<String>? = null

The purpose of this resource, which can be one of the following values.

Link copied to clipboard
val region: Output<String>? = null

The Region in which the created address should reside. If it is not provided, the provider region is used.

Link copied to clipboard
val subnetwork: Output<String>? = null

The URL of the subnetwork in which to reserve the address. If an IP address is specified, it must be within the subnetwork's IP range. This field can only be used with INTERNAL type with GCE_ENDPOINT/DNS_RESOLVER purposes.

Functions

Link copied to clipboard
open override fun toJava(): AddressArgs