1. Packages
  2. Vultr
  3. API Docs
  4. InstanceIpv4
Vultr v2.23.1 published on Tuesday, Dec 10, 2024 by dirien

vultr.InstanceIpv4

Explore with Pulumi AI

Provides a Vultr instance IPv4 resource. This can be used to create, read, and modify a IPv4 address. instance is rebooted by default.

Example Usage

Create a new IPv4 address for a instance:

import * as pulumi from "@pulumi/pulumi";
import * as vultr from "@ediri/vultr";

const myInstance = new vultr.Instance("myInstance", {
    enableIpv6: true,
    osId: 167,
    plan: "vc2-1c-1gb",
    region: "ewr",
});
const myInstanceIpv4 = new vultr.InstanceIpv4("myInstanceIpv4", {
    instanceId: myInstance.id,
    reboot: false,
});
Copy
import pulumi
import ediri_vultr as vultr

my_instance = vultr.Instance("myInstance",
    enable_ipv6=True,
    os_id=167,
    plan="vc2-1c-1gb",
    region="ewr")
my_instance_ipv4 = vultr.InstanceIpv4("myInstanceIpv4",
    instance_id=my_instance.id,
    reboot=False)
Copy
package main

import (
	"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		myInstance, err := vultr.NewInstance(ctx, "myInstance", &vultr.InstanceArgs{
			EnableIpv6: pulumi.Bool(true),
			OsId:       pulumi.Int(167),
			Plan:       pulumi.String("vc2-1c-1gb"),
			Region:     pulumi.String("ewr"),
		})
		if err != nil {
			return err
		}
		_, err = vultr.NewInstanceIpv4(ctx, "myInstanceIpv4", &vultr.InstanceIpv4Args{
			InstanceId: myInstance.ID(),
			Reboot:     pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vultr = ediri.Vultr;

return await Deployment.RunAsync(() => 
{
    var myInstance = new Vultr.Instance("myInstance", new()
    {
        EnableIpv6 = true,
        OsId = 167,
        Plan = "vc2-1c-1gb",
        Region = "ewr",
    });

    var myInstanceIpv4 = new Vultr.InstanceIpv4("myInstanceIpv4", new()
    {
        InstanceId = myInstance.Id,
        Reboot = false,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vultr.Instance;
import com.pulumi.vultr.InstanceArgs;
import com.pulumi.vultr.InstanceIpv4;
import com.pulumi.vultr.InstanceIpv4Args;
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 myInstance = new Instance("myInstance", InstanceArgs.builder()
            .enableIpv6(true)
            .osId(167)
            .plan("vc2-1c-1gb")
            .region("ewr")
            .build());

        var myInstanceIpv4 = new InstanceIpv4("myInstanceIpv4", InstanceIpv4Args.builder()
            .instanceId(myInstance.id())
            .reboot(false)
            .build());

    }
}
Copy
resources:
  myInstance:
    type: vultr:Instance
    properties:
      enableIpv6: true
      osId: 167
      plan: vc2-1c-1gb
      region: ewr
  myInstanceIpv4:
    type: vultr:InstanceIpv4
    properties:
      instanceId: ${myInstance.id}
      reboot: false
Copy

Create InstanceIpv4 Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new InstanceIpv4(name: string, args: InstanceIpv4Args, opts?: CustomResourceOptions);
@overload
def InstanceIpv4(resource_name: str,
                 args: InstanceIpv4Args,
                 opts: Optional[ResourceOptions] = None)

@overload
def InstanceIpv4(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 instance_id: Optional[str] = None,
                 reboot: Optional[bool] = None)
func NewInstanceIpv4(ctx *Context, name string, args InstanceIpv4Args, opts ...ResourceOption) (*InstanceIpv4, error)
public InstanceIpv4(string name, InstanceIpv4Args args, CustomResourceOptions? opts = null)
public InstanceIpv4(String name, InstanceIpv4Args args)
public InstanceIpv4(String name, InstanceIpv4Args args, CustomResourceOptions options)
type: vultr:InstanceIpv4
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. InstanceIpv4Args
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. InstanceIpv4Args
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. InstanceIpv4Args
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. InstanceIpv4Args
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. InstanceIpv4Args
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var instanceIpv4Resource = new Vultr.InstanceIpv4("instanceIpv4Resource", new()
{
    InstanceId = "string",
    Reboot = false,
});
Copy
example, err := vultr.NewInstanceIpv4(ctx, "instanceIpv4Resource", &vultr.InstanceIpv4Args{
	InstanceId: pulumi.String("string"),
	Reboot:     pulumi.Bool(false),
})
Copy
var instanceIpv4Resource = new InstanceIpv4("instanceIpv4Resource", InstanceIpv4Args.builder()
    .instanceId("string")
    .reboot(false)
    .build());
Copy
instance_ipv4_resource = vultr.InstanceIpv4("instanceIpv4Resource",
    instance_id="string",
    reboot=False)
Copy
const instanceIpv4Resource = new vultr.InstanceIpv4("instanceIpv4Resource", {
    instanceId: "string",
    reboot: false,
});
Copy
type: vultr:InstanceIpv4
properties:
    instanceId: string
    reboot: false
Copy

InstanceIpv4 Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The InstanceIpv4 resource accepts the following input properties:

InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the instance to be assigned the IPv4 address.
Reboot Changes to this property will trigger replacement. bool
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the instance to be assigned the IPv4 address.
Reboot Changes to this property will trigger replacement. bool
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the instance to be assigned the IPv4 address.
reboot Changes to this property will trigger replacement. Boolean
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
instanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the instance to be assigned the IPv4 address.
reboot Changes to this property will trigger replacement. boolean
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
instance_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the instance to be assigned the IPv4 address.
reboot Changes to this property will trigger replacement. bool
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the instance to be assigned the IPv4 address.
reboot Changes to this property will trigger replacement. Boolean
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.

Outputs

All input properties are implicitly available as output properties. Additionally, the InstanceIpv4 resource produces the following output properties:

Gateway string
The gateway IP address.
Id string
The provider-assigned unique ID for this managed resource.
Ip string
The IPv4 address in canonical format.
Netmask string
The IPv4 netmask in dot-decimal notation.
Reverse string
The reverse DNS information for this IP address.
Gateway string
The gateway IP address.
Id string
The provider-assigned unique ID for this managed resource.
Ip string
The IPv4 address in canonical format.
Netmask string
The IPv4 netmask in dot-decimal notation.
Reverse string
The reverse DNS information for this IP address.
gateway String
The gateway IP address.
id String
The provider-assigned unique ID for this managed resource.
ip String
The IPv4 address in canonical format.
netmask String
The IPv4 netmask in dot-decimal notation.
reverse String
The reverse DNS information for this IP address.
gateway string
The gateway IP address.
id string
The provider-assigned unique ID for this managed resource.
ip string
The IPv4 address in canonical format.
netmask string
The IPv4 netmask in dot-decimal notation.
reverse string
The reverse DNS information for this IP address.
gateway str
The gateway IP address.
id str
The provider-assigned unique ID for this managed resource.
ip str
The IPv4 address in canonical format.
netmask str
The IPv4 netmask in dot-decimal notation.
reverse str
The reverse DNS information for this IP address.
gateway String
The gateway IP address.
id String
The provider-assigned unique ID for this managed resource.
ip String
The IPv4 address in canonical format.
netmask String
The IPv4 netmask in dot-decimal notation.
reverse String
The reverse DNS information for this IP address.

Look up Existing InstanceIpv4 Resource

Get an existing InstanceIpv4 resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: InstanceIpv4State, opts?: CustomResourceOptions): InstanceIpv4
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        gateway: Optional[str] = None,
        instance_id: Optional[str] = None,
        ip: Optional[str] = None,
        netmask: Optional[str] = None,
        reboot: Optional[bool] = None,
        reverse: Optional[str] = None) -> InstanceIpv4
func GetInstanceIpv4(ctx *Context, name string, id IDInput, state *InstanceIpv4State, opts ...ResourceOption) (*InstanceIpv4, error)
public static InstanceIpv4 Get(string name, Input<string> id, InstanceIpv4State? state, CustomResourceOptions? opts = null)
public static InstanceIpv4 get(String name, Output<String> id, InstanceIpv4State state, CustomResourceOptions options)
resources:  _:    type: vultr:InstanceIpv4    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Gateway string
The gateway IP address.
InstanceId Changes to this property will trigger replacement. string
The ID of the instance to be assigned the IPv4 address.
Ip string
The IPv4 address in canonical format.
Netmask string
The IPv4 netmask in dot-decimal notation.
Reboot Changes to this property will trigger replacement. bool
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
Reverse string
The reverse DNS information for this IP address.
Gateway string
The gateway IP address.
InstanceId Changes to this property will trigger replacement. string
The ID of the instance to be assigned the IPv4 address.
Ip string
The IPv4 address in canonical format.
Netmask string
The IPv4 netmask in dot-decimal notation.
Reboot Changes to this property will trigger replacement. bool
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
Reverse string
The reverse DNS information for this IP address.
gateway String
The gateway IP address.
instanceId Changes to this property will trigger replacement. String
The ID of the instance to be assigned the IPv4 address.
ip String
The IPv4 address in canonical format.
netmask String
The IPv4 netmask in dot-decimal notation.
reboot Changes to this property will trigger replacement. Boolean
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
reverse String
The reverse DNS information for this IP address.
gateway string
The gateway IP address.
instanceId Changes to this property will trigger replacement. string
The ID of the instance to be assigned the IPv4 address.
ip string
The IPv4 address in canonical format.
netmask string
The IPv4 netmask in dot-decimal notation.
reboot Changes to this property will trigger replacement. boolean
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
reverse string
The reverse DNS information for this IP address.
gateway str
The gateway IP address.
instance_id Changes to this property will trigger replacement. str
The ID of the instance to be assigned the IPv4 address.
ip str
The IPv4 address in canonical format.
netmask str
The IPv4 netmask in dot-decimal notation.
reboot Changes to this property will trigger replacement. bool
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
reverse str
The reverse DNS information for this IP address.
gateway String
The gateway IP address.
instanceId Changes to this property will trigger replacement. String
The ID of the instance to be assigned the IPv4 address.
ip String
The IPv4 address in canonical format.
netmask String
The IPv4 netmask in dot-decimal notation.
reboot Changes to this property will trigger replacement. Boolean
Default true. Determines whether or not the server is rebooted after adding the IPv4 address.
reverse String
The reverse DNS information for this IP address.

Package Details

Repository
vultr dirien/pulumi-vultr
License
Apache-2.0
Notes
This Pulumi package is based on the vultr Terraform Provider.