pulumi_wasm_providers_gcp_mini::compute

Module address

source
Expand description

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

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let ipAddress = address::create(
        "ipAddress",
        AddressArgs::builder().name("my-address").build_struct(),
    );
}

§Address With Subnetwork

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let default = network::create(
        "default",
        NetworkArgs::builder().name("my-network").build_struct(),
    );
    let defaultSubnetwork = subnetwork::create(
        "defaultSubnetwork",
        SubnetworkArgs::builder()
            .ip_cidr_range("10.0.0.0/16")
            .name("my-subnet")
            .network("${default.id}")
            .region("us-central1")
            .build_struct(),
    );
    let internalWithSubnetAndAddress = address::create(
        "internalWithSubnetAndAddress",
        AddressArgs::builder()
            .address("10.0.42.42")
            .address_type("INTERNAL")
            .name("my-internal-address")
            .region("us-central1")
            .subnetwork("${defaultSubnetwork.id}")
            .build_struct(),
    );
}

§Address With Gce Endpoint

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let internalWithGceEndpoint = address::create(
        "internalWithGceEndpoint",
        AddressArgs::builder()
            .address_type("INTERNAL")
            .name("my-internal-address-")
            .purpose("GCE_ENDPOINT")
            .build_struct(),
    );
}

§Instance With Ip

resources:
  static:
    type: gcp:compute:Address
    properties:
      name: ipv4-address
  instanceWithIp:
    type: gcp:compute:Instance
    name: instance_with_ip
    properties:
      name: vm-instance
      machineType: f1-micro
      zone: us-central1-a
      bootDisk:
        initializeParams:
          image: ${debianImage.selfLink}
      networkInterfaces:
        - network: default
          accessConfigs:
            - natIp: ${static.address}
variables:
  debianImage:
    fn::invoke:
      function: gcp:compute:getImage
      arguments:
        family: debian-11
        project: debian-cloud

§Compute Address Ipsec Interconnect

resources:
  ipsec-interconnect-address:
    type: gcp:compute:Address
    properties:
      name: test-address
      addressType: INTERNAL
      purpose: IPSEC_INTERCONNECT
      address: 192.168.1.0
      prefixLength: 29
      network: ${network.selfLink}
  network:
    type: gcp:compute:Network
    properties:
      name: test-network
      autoCreateSubnetworks: false

§Import

Address can be imported using any of these accepted formats:

  • projects/{{project}}/regions/{{region}}/addresses/{{name}}

  • {{project}}/{{region}}/{{name}}

  • {{region}}/{{name}}

  • {{name}}

When using the pulumi import command, Address can be imported using one of the formats above. For example:

$ 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}}

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments