1. Packages
  2. Vkcs Provider
  3. API Docs
  4. ComputeInterfaceAttach
vkcs 0.9.3 published on Tuesday, Apr 15, 2025 by vk-cs

vkcs.ComputeInterfaceAttach

Explore with Pulumi AI

vkcs logo
vkcs 0.9.3 published on Tuesday, Apr 15, 2025 by vk-cs

    Attaches a Network Interface (a Port) to an Instance using the VKCS Compute API.

    Example Usage

    Attachment Using an Existing Port

    import * as pulumi from "@pulumi/pulumi";
    import * as vkcs from "@pulumi/vkcs";
    
    const etcd = new vkcs.ComputeInterfaceAttach("etcd", {
        instanceId: vkcs_compute_instance.basic.id,
        portId: vkcs_networking_port.persistent_etcd.id,
    });
    
    import pulumi
    import pulumi_vkcs as vkcs
    
    etcd = vkcs.ComputeInterfaceAttach("etcd",
        instance_id=vkcs_compute_instance["basic"]["id"],
        port_id=vkcs_networking_port["persistent_etcd"]["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/vkcs/vkcs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vkcs.NewComputeInterfaceAttach(ctx, "etcd", &vkcs.ComputeInterfaceAttachArgs{
    			InstanceId: pulumi.Any(vkcs_compute_instance.Basic.Id),
    			PortId:     pulumi.Any(vkcs_networking_port.Persistent_etcd.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vkcs = Pulumi.Vkcs;
    
    return await Deployment.RunAsync(() => 
    {
        var etcd = new Vkcs.ComputeInterfaceAttach("etcd", new()
        {
            InstanceId = vkcs_compute_instance.Basic.Id,
            PortId = vkcs_networking_port.Persistent_etcd.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vkcs.ComputeInterfaceAttach;
    import com.pulumi.vkcs.ComputeInterfaceAttachArgs;
    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 etcd = new ComputeInterfaceAttach("etcd", ComputeInterfaceAttachArgs.builder()
                .instanceId(vkcs_compute_instance.basic().id())
                .portId(vkcs_networking_port.persistent_etcd().id())
                .build());
    
        }
    }
    
    resources:
      etcd:
        type: vkcs:ComputeInterfaceAttach
        properties:
          instanceId: ${vkcs_compute_instance.basic.id}
          portId: ${vkcs_networking_port.persistent_etcd.id}
    

    Attachment Using a Network ID

    import * as pulumi from "@pulumi/pulumi";
    import * as vkcs from "@pulumi/vkcs";
    
    const db = new vkcs.ComputeInterfaceAttach("db", {
        instanceId: vkcs_compute_instance.basic.id,
        networkId: vkcs_networking_network.db.id,
    });
    
    import pulumi
    import pulumi_vkcs as vkcs
    
    db = vkcs.ComputeInterfaceAttach("db",
        instance_id=vkcs_compute_instance["basic"]["id"],
        network_id=vkcs_networking_network["db"]["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/vkcs/vkcs"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := vkcs.NewComputeInterfaceAttach(ctx, "db", &vkcs.ComputeInterfaceAttachArgs{
    			InstanceId: pulumi.Any(vkcs_compute_instance.Basic.Id),
    			NetworkId:  pulumi.Any(vkcs_networking_network.Db.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vkcs = Pulumi.Vkcs;
    
    return await Deployment.RunAsync(() => 
    {
        var db = new Vkcs.ComputeInterfaceAttach("db", new()
        {
            InstanceId = vkcs_compute_instance.Basic.Id,
            NetworkId = vkcs_networking_network.Db.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vkcs.ComputeInterfaceAttach;
    import com.pulumi.vkcs.ComputeInterfaceAttachArgs;
    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 db = new ComputeInterfaceAttach("db", ComputeInterfaceAttachArgs.builder()
                .instanceId(vkcs_compute_instance.basic().id())
                .networkId(vkcs_networking_network.db().id())
                .build());
    
        }
    }
    
    resources:
      db:
        type: vkcs:ComputeInterfaceAttach
        properties:
          instanceId: ${vkcs_compute_instance.basic.id}
          networkId: ${vkcs_networking_network.db.id}
    

    Attaching multiple interfaces will not guarantee that interfaces are attached in a deterministic manner. The interfaces will be attached in a seemingly random order. If you want to ensure that interfaces are attached in a given order, create explicit dependencies between the interfaces , such as in virtual machines/vkcs_compute_volume_attach

    Create ComputeInterfaceAttach Resource

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

    Constructor syntax

    new ComputeInterfaceAttach(name: string, args: ComputeInterfaceAttachArgs, opts?: CustomResourceOptions);
    @overload
    def ComputeInterfaceAttach(resource_name: str,
                               args: ComputeInterfaceAttachArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def ComputeInterfaceAttach(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               instance_id: Optional[str] = None,
                               compute_interface_attach_id: Optional[str] = None,
                               fixed_ip: Optional[str] = None,
                               network_id: Optional[str] = None,
                               port_id: Optional[str] = None,
                               region: Optional[str] = None,
                               timeouts: Optional[ComputeInterfaceAttachTimeoutsArgs] = None)
    func NewComputeInterfaceAttach(ctx *Context, name string, args ComputeInterfaceAttachArgs, opts ...ResourceOption) (*ComputeInterfaceAttach, error)
    public ComputeInterfaceAttach(string name, ComputeInterfaceAttachArgs args, CustomResourceOptions? opts = null)
    public ComputeInterfaceAttach(String name, ComputeInterfaceAttachArgs args)
    public ComputeInterfaceAttach(String name, ComputeInterfaceAttachArgs args, CustomResourceOptions options)
    
    type: vkcs:ComputeInterfaceAttach
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ComputeInterfaceAttachArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ComputeInterfaceAttachArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ComputeInterfaceAttachArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ComputeInterfaceAttachArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ComputeInterfaceAttachArgs
    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 computeInterfaceAttachResource = new Vkcs.ComputeInterfaceAttach("computeInterfaceAttachResource", new()
    {
        InstanceId = "string",
        ComputeInterfaceAttachId = "string",
        FixedIp = "string",
        NetworkId = "string",
        PortId = "string",
        Region = "string",
        Timeouts = new Vkcs.Inputs.ComputeInterfaceAttachTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
        },
    });
    
    example, err := vkcs.NewComputeInterfaceAttach(ctx, "computeInterfaceAttachResource", &vkcs.ComputeInterfaceAttachArgs{
    InstanceId: pulumi.String("string"),
    ComputeInterfaceAttachId: pulumi.String("string"),
    FixedIp: pulumi.String("string"),
    NetworkId: pulumi.String("string"),
    PortId: pulumi.String("string"),
    Region: pulumi.String("string"),
    Timeouts: &.ComputeInterfaceAttachTimeoutsArgs{
    Create: pulumi.String("string"),
    Delete: pulumi.String("string"),
    },
    })
    
    var computeInterfaceAttachResource = new ComputeInterfaceAttach("computeInterfaceAttachResource", ComputeInterfaceAttachArgs.builder()
        .instanceId("string")
        .computeInterfaceAttachId("string")
        .fixedIp("string")
        .networkId("string")
        .portId("string")
        .region("string")
        .timeouts(ComputeInterfaceAttachTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .build())
        .build());
    
    compute_interface_attach_resource = vkcs.ComputeInterfaceAttach("computeInterfaceAttachResource",
        instance_id="string",
        compute_interface_attach_id="string",
        fixed_ip="string",
        network_id="string",
        port_id="string",
        region="string",
        timeouts={
            "create": "string",
            "delete": "string",
        })
    
    const computeInterfaceAttachResource = new vkcs.ComputeInterfaceAttach("computeInterfaceAttachResource", {
        instanceId: "string",
        computeInterfaceAttachId: "string",
        fixedIp: "string",
        networkId: "string",
        portId: "string",
        region: "string",
        timeouts: {
            create: "string",
            "delete": "string",
        },
    });
    
    type: vkcs:ComputeInterfaceAttach
    properties:
        computeInterfaceAttachId: string
        fixedIp: string
        instanceId: string
        networkId: string
        portId: string
        region: string
        timeouts:
            create: string
            delete: string
    

    ComputeInterfaceAttach 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 ComputeInterfaceAttach resource accepts the following input properties:

    InstanceId string
    The ID of the Instance to attach the Port or Network to.
    ComputeInterfaceAttachId string
    FixedIp string
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    NetworkId string
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    PortId string
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    Region string
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    Timeouts ComputeInterfaceAttachTimeouts
    InstanceId string
    The ID of the Instance to attach the Port or Network to.
    ComputeInterfaceAttachId string
    FixedIp string
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    NetworkId string
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    PortId string
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    Region string
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    Timeouts ComputeInterfaceAttachTimeoutsArgs
    instanceId String
    The ID of the Instance to attach the Port or Network to.
    computeInterfaceAttachId String
    fixedIp String
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    networkId String
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    portId String
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    region String
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    timeouts ComputeInterfaceAttachTimeouts
    instanceId string
    The ID of the Instance to attach the Port or Network to.
    computeInterfaceAttachId string
    fixedIp string
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    networkId string
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    portId string
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    region string
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    timeouts ComputeInterfaceAttachTimeouts
    instance_id str
    The ID of the Instance to attach the Port or Network to.
    compute_interface_attach_id str
    fixed_ip str
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    network_id str
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    port_id str
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    region str
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    timeouts ComputeInterfaceAttachTimeoutsArgs
    instanceId String
    The ID of the Instance to attach the Port or Network to.
    computeInterfaceAttachId String
    fixedIp String
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    networkId String
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    portId String
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    region String
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    timeouts Property Map

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ComputeInterfaceAttach Resource

    Get an existing ComputeInterfaceAttach 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?: ComputeInterfaceAttachState, opts?: CustomResourceOptions): ComputeInterfaceAttach
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            compute_interface_attach_id: Optional[str] = None,
            fixed_ip: Optional[str] = None,
            instance_id: Optional[str] = None,
            network_id: Optional[str] = None,
            port_id: Optional[str] = None,
            region: Optional[str] = None,
            timeouts: Optional[ComputeInterfaceAttachTimeoutsArgs] = None) -> ComputeInterfaceAttach
    func GetComputeInterfaceAttach(ctx *Context, name string, id IDInput, state *ComputeInterfaceAttachState, opts ...ResourceOption) (*ComputeInterfaceAttach, error)
    public static ComputeInterfaceAttach Get(string name, Input<string> id, ComputeInterfaceAttachState? state, CustomResourceOptions? opts = null)
    public static ComputeInterfaceAttach get(String name, Output<String> id, ComputeInterfaceAttachState state, CustomResourceOptions options)
    resources:  _:    type: vkcs:ComputeInterfaceAttach    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    ComputeInterfaceAttachId string
    FixedIp string
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    InstanceId string
    The ID of the Instance to attach the Port or Network to.
    NetworkId string
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    PortId string
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    Region string
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    Timeouts ComputeInterfaceAttachTimeouts
    ComputeInterfaceAttachId string
    FixedIp string
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    InstanceId string
    The ID of the Instance to attach the Port or Network to.
    NetworkId string
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    PortId string
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    Region string
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    Timeouts ComputeInterfaceAttachTimeoutsArgs
    computeInterfaceAttachId String
    fixedIp String
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    instanceId String
    The ID of the Instance to attach the Port or Network to.
    networkId String
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    portId String
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    region String
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    timeouts ComputeInterfaceAttachTimeouts
    computeInterfaceAttachId string
    fixedIp string
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    instanceId string
    The ID of the Instance to attach the Port or Network to.
    networkId string
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    portId string
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    region string
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    timeouts ComputeInterfaceAttachTimeouts
    compute_interface_attach_id str
    fixed_ip str
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    instance_id str
    The ID of the Instance to attach the Port or Network to.
    network_id str
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    port_id str
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    region str
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    timeouts ComputeInterfaceAttachTimeoutsArgs
    computeInterfaceAttachId String
    fixedIp String
    An IP address to assosciate with the port. note This option cannot be used with port_id. You must specify a network_id. The IP address must lie in a range on the supplied network.
    instanceId String
    The ID of the Instance to attach the Port or Network to.
    networkId String
    The ID of the Network to attach to an Instance. A port will be created automatically. note This option and port_id are mutually exclusive.
    portId String
    The ID of the Port to attach to an Instance. note This option and network_id are mutually exclusive.
    region String
    The region in which to create the interface attachment. If omitted, the region argument of the provider is used. Changing this creates a new attachment.
    timeouts Property Map

    Supporting Types

    ComputeInterfaceAttachTimeouts, ComputeInterfaceAttachTimeoutsArgs

    Create string
    Delete string
    Create string
    Delete string
    create String
    delete String
    create string
    delete string
    create str
    delete str
    create String
    delete String

    Import

    Interface Attachments can be imported using the Instance ID and Port ID separated by a slash, e.g.

    $ pulumi import vkcs:index/computeInterfaceAttach:ComputeInterfaceAttach ai_1 89c60255-9bd6-460c-822a-e2b959ede9d2/45670584-225f-46c3-b33e-6707b589b666
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    vkcs vk-cs/terraform-provider-vkcs
    License
    Notes
    This Pulumi package is based on the vkcs Terraform Provider.
    vkcs logo
    vkcs 0.9.3 published on Tuesday, Apr 15, 2025 by vk-cs