openstack.compute.InterfaceAttach
Explore with Pulumi AI
Attaches a Network Interface (a Port) to an Instance using the OpenStack Compute (Nova) v2 API.
Example Usage
Basic Attachment
using System.Collections.Generic;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var network1 = new OpenStack.Networking.Network("network1", new()
{
AdminStateUp = true,
});
var instance1 = new OpenStack.Compute.Instance("instance1", new()
{
SecurityGroups = new[]
{
"default",
},
});
var ai1 = new OpenStack.Compute.InterfaceAttach("ai1", new()
{
InstanceId = instance1.Id,
NetworkId = openstack_networking_port_v2.Network_1.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/compute"
"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/networking"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := networking.NewNetwork(ctx, "network1", &networking.NetworkArgs{
AdminStateUp: pulumi.Bool(true),
})
if err != nil {
return err
}
instance1, err := compute.NewInstance(ctx, "instance1", &compute.InstanceArgs{
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
})
if err != nil {
return err
}
_, err = compute.NewInterfaceAttach(ctx, "ai1", &compute.InterfaceAttachArgs{
InstanceId: instance1.ID(),
NetworkId: pulumi.Any(openstack_networking_port_v2.Network_1.Id),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.Network;
import com.pulumi.openstack.networking.NetworkArgs;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.InterfaceAttach;
import com.pulumi.openstack.compute.InterfaceAttachArgs;
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 network1 = new Network("network1", NetworkArgs.builder()
.adminStateUp("true")
.build());
var instance1 = new Instance("instance1", InstanceArgs.builder()
.securityGroups("default")
.build());
var ai1 = new InterfaceAttach("ai1", InterfaceAttachArgs.builder()
.instanceId(instance1.id())
.networkId(openstack_networking_port_v2.network_1().id())
.build());
}
}
import pulumi
import pulumi_openstack as openstack
network1 = openstack.networking.Network("network1", admin_state_up=True)
instance1 = openstack.compute.Instance("instance1", security_groups=["default"])
ai1 = openstack.compute.InterfaceAttach("ai1",
instance_id=instance1.id,
network_id=openstack_networking_port_v2["network_1"]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const network1 = new openstack.networking.Network("network1", {adminStateUp: true});
const instance1 = new openstack.compute.Instance("instance1", {securityGroups: ["default"]});
const ai1 = new openstack.compute.InterfaceAttach("ai1", {
instanceId: instance1.id,
networkId: openstack_networking_port_v2.network_1.id,
});
resources:
network1:
type: openstack:networking:Network
properties:
adminStateUp: 'true'
instance1:
type: openstack:compute:Instance
properties:
securityGroups:
- default
ai1:
type: openstack:compute:InterfaceAttach
properties:
instanceId: ${instance1.id}
networkId: ${openstack_networking_port_v2.network_1.id}
Attachment Specifying a Fixed IP
using System.Collections.Generic;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var network1 = new OpenStack.Networking.Network("network1", new()
{
AdminStateUp = true,
});
var instance1 = new OpenStack.Compute.Instance("instance1", new()
{
SecurityGroups = new[]
{
"default",
},
});
var ai1 = new OpenStack.Compute.InterfaceAttach("ai1", new()
{
FixedIp = "10.0.10.10",
InstanceId = instance1.Id,
NetworkId = openstack_networking_port_v2.Network_1.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/compute"
"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/networking"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := networking.NewNetwork(ctx, "network1", &networking.NetworkArgs{
AdminStateUp: pulumi.Bool(true),
})
if err != nil {
return err
}
instance1, err := compute.NewInstance(ctx, "instance1", &compute.InstanceArgs{
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
})
if err != nil {
return err
}
_, err = compute.NewInterfaceAttach(ctx, "ai1", &compute.InterfaceAttachArgs{
FixedIp: pulumi.String("10.0.10.10"),
InstanceId: instance1.ID(),
NetworkId: pulumi.Any(openstack_networking_port_v2.Network_1.Id),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.Network;
import com.pulumi.openstack.networking.NetworkArgs;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.InterfaceAttach;
import com.pulumi.openstack.compute.InterfaceAttachArgs;
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 network1 = new Network("network1", NetworkArgs.builder()
.adminStateUp("true")
.build());
var instance1 = new Instance("instance1", InstanceArgs.builder()
.securityGroups("default")
.build());
var ai1 = new InterfaceAttach("ai1", InterfaceAttachArgs.builder()
.fixedIp("10.0.10.10")
.instanceId(instance1.id())
.networkId(openstack_networking_port_v2.network_1().id())
.build());
}
}
import pulumi
import pulumi_openstack as openstack
network1 = openstack.networking.Network("network1", admin_state_up=True)
instance1 = openstack.compute.Instance("instance1", security_groups=["default"])
ai1 = openstack.compute.InterfaceAttach("ai1",
fixed_ip="10.0.10.10",
instance_id=instance1.id,
network_id=openstack_networking_port_v2["network_1"]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const network1 = new openstack.networking.Network("network1", {adminStateUp: true});
const instance1 = new openstack.compute.Instance("instance1", {securityGroups: ["default"]});
const ai1 = new openstack.compute.InterfaceAttach("ai1", {
fixedIp: "10.0.10.10",
instanceId: instance1.id,
networkId: openstack_networking_port_v2.network_1.id,
});
resources:
network1:
type: openstack:networking:Network
properties:
adminStateUp: 'true'
instance1:
type: openstack:compute:Instance
properties:
securityGroups:
- default
ai1:
type: openstack:compute:InterfaceAttach
properties:
fixedIp: 10.0.10.10
instanceId: ${instance1.id}
networkId: ${openstack_networking_port_v2.network_1.id}
Attachment Using an Existing Port
using System.Collections.Generic;
using Pulumi;
using OpenStack = Pulumi.OpenStack;
return await Deployment.RunAsync(() =>
{
var network1 = new OpenStack.Networking.Network("network1", new()
{
AdminStateUp = true,
});
var port1 = new OpenStack.Networking.Port("port1", new()
{
AdminStateUp = true,
NetworkId = network1.Id,
});
var instance1 = new OpenStack.Compute.Instance("instance1", new()
{
SecurityGroups = new[]
{
"default",
},
});
var ai1 = new OpenStack.Compute.InterfaceAttach("ai1", new()
{
InstanceId = instance1.Id,
PortId = port1.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/compute"
"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/networking"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
network1, err := networking.NewNetwork(ctx, "network1", &networking.NetworkArgs{
AdminStateUp: pulumi.Bool(true),
})
if err != nil {
return err
}
port1, err := networking.NewPort(ctx, "port1", &networking.PortArgs{
AdminStateUp: pulumi.Bool(true),
NetworkId: network1.ID(),
})
if err != nil {
return err
}
instance1, err := compute.NewInstance(ctx, "instance1", &compute.InstanceArgs{
SecurityGroups: pulumi.StringArray{
pulumi.String("default"),
},
})
if err != nil {
return err
}
_, err = compute.NewInterfaceAttach(ctx, "ai1", &compute.InterfaceAttachArgs{
InstanceId: instance1.ID(),
PortId: port1.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.Network;
import com.pulumi.openstack.networking.NetworkArgs;
import com.pulumi.openstack.networking.Port;
import com.pulumi.openstack.networking.PortArgs;
import com.pulumi.openstack.compute.Instance;
import com.pulumi.openstack.compute.InstanceArgs;
import com.pulumi.openstack.compute.InterfaceAttach;
import com.pulumi.openstack.compute.InterfaceAttachArgs;
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 network1 = new Network("network1", NetworkArgs.builder()
.adminStateUp("true")
.build());
var port1 = new Port("port1", PortArgs.builder()
.adminStateUp("true")
.networkId(network1.id())
.build());
var instance1 = new Instance("instance1", InstanceArgs.builder()
.securityGroups("default")
.build());
var ai1 = new InterfaceAttach("ai1", InterfaceAttachArgs.builder()
.instanceId(instance1.id())
.portId(port1.id())
.build());
}
}
import pulumi
import pulumi_openstack as openstack
network1 = openstack.networking.Network("network1", admin_state_up=True)
port1 = openstack.networking.Port("port1",
admin_state_up=True,
network_id=network1.id)
instance1 = openstack.compute.Instance("instance1", security_groups=["default"])
ai1 = openstack.compute.InterfaceAttach("ai1",
instance_id=instance1.id,
port_id=port1.id)
import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";
const network1 = new openstack.networking.Network("network1", {adminStateUp: true});
const port1 = new openstack.networking.Port("port1", {
adminStateUp: true,
networkId: network1.id,
});
const instance1 = new openstack.compute.Instance("instance1", {securityGroups: ["default"]});
const ai1 = new openstack.compute.InterfaceAttach("ai1", {
instanceId: instance1.id,
portId: port1.id,
});
resources:
network1:
type: openstack:networking:Network
properties:
adminStateUp: 'true'
port1:
type: openstack:networking:Port
properties:
adminStateUp: 'true'
networkId: ${network1.id}
instance1:
type: openstack:compute:Instance
properties:
securityGroups:
- default
ai1:
type: openstack:compute:InterfaceAttach
properties:
instanceId: ${instance1.id}
portId: ${port1.id}
Create InterfaceAttach Resource
new InterfaceAttach(name: string, args: InterfaceAttachArgs, opts?: CustomResourceOptions);
@overload
def InterfaceAttach(resource_name: str,
opts: Optional[ResourceOptions] = 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)
@overload
def InterfaceAttach(resource_name: str,
args: InterfaceAttachArgs,
opts: Optional[ResourceOptions] = None)
func NewInterfaceAttach(ctx *Context, name string, args InterfaceAttachArgs, opts ...ResourceOption) (*InterfaceAttach, error)
public InterfaceAttach(string name, InterfaceAttachArgs args, CustomResourceOptions? opts = null)
public InterfaceAttach(String name, InterfaceAttachArgs args)
public InterfaceAttach(String name, InterfaceAttachArgs args, CustomResourceOptions options)
type: openstack:compute:InterfaceAttach
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args InterfaceAttachArgs
- 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 InterfaceAttachArgs
- 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 InterfaceAttachArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args InterfaceAttachArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args InterfaceAttachArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
InterfaceAttach Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The InterfaceAttach resource accepts the following input properties:
- Instance
Id string The ID of the Instance to attach the Port or Network to.
- Fixed
Ip string An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy a network_id. The IP address must lie in a range on the supplied network.
- Network
Id 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.- Port
Id 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.
- Instance
Id string The ID of the Instance to attach the Port or Network to.
- Fixed
Ip string An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy a network_id. The IP address must lie in a range on the supplied network.
- Network
Id 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.- Port
Id 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.
- instance
Id String The ID of the Instance to attach the Port or Network to.
- fixed
Ip String An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy a network_id. The IP address must lie in a range on the supplied network.
- network
Id 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.- port
Id 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.
- instance
Id string The ID of the Instance to attach the Port or Network to.
- fixed
Ip string An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy a network_id. The IP address must lie in a range on the supplied network.
- network
Id 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.- port
Id 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.
- instance_
id str The ID of the Instance to attach the Port or Network to.
- fixed_
ip str An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy 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.
- instance
Id String The ID of the Instance to attach the Port or Network to.
- fixed
Ip String An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy a network_id. The IP address must lie in a range on the supplied network.
- network
Id 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.- port
Id 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.
Outputs
All input properties are implicitly available as output properties. Additionally, the InterfaceAttach 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 InterfaceAttach Resource
Get an existing InterfaceAttach 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?: InterfaceAttachState, opts?: CustomResourceOptions): InterfaceAttach
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = 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) -> InterfaceAttach
func GetInterfaceAttach(ctx *Context, name string, id IDInput, state *InterfaceAttachState, opts ...ResourceOption) (*InterfaceAttach, error)
public static InterfaceAttach Get(string name, Input<string> id, InterfaceAttachState? state, CustomResourceOptions? opts = null)
public static InterfaceAttach get(String name, Output<String> id, InterfaceAttachState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Fixed
Ip string An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy a network_id. The IP address must lie in a range on the supplied network.
- Instance
Id string The ID of the Instance to attach the Port or Network to.
- Network
Id 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.- Port
Id 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.
- Fixed
Ip string An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy a network_id. The IP address must lie in a range on the supplied network.
- Instance
Id string The ID of the Instance to attach the Port or Network to.
- Network
Id 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.- Port
Id 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.
- fixed
Ip String An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy a network_id. The IP address must lie in a range on the supplied network.
- instance
Id String The ID of the Instance to attach the Port or Network to.
- network
Id 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.- port
Id 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.
- fixed
Ip string An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy a network_id. The IP address must lie in a range on the supplied network.
- instance
Id string The ID of the Instance to attach the Port or Network to.
- network
Id 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.- port
Id 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.
- fixed_
ip str An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy 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.
- fixed
Ip String An IP address to assosciate with the port. NOTE: This option cannot be used with port_id. You must specifiy a network_id. The IP address must lie in a range on the supplied network.
- instance
Id String The ID of the Instance to attach the Port or Network to.
- network
Id 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.- port
Id 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.
Import
Interface Attachments can be imported using the Instance ID and Port ID separated by a slash, e.g.
$ pulumi import openstack:compute/interfaceAttach:InterfaceAttach ai_1 89c60255-9bd6-460c-822a-e2b959ede9d2/45670584-225f-46c3-b33e-6707b589b666
Package Details
- Repository
- OpenStack pulumi/pulumi-openstack
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
openstack
Terraform Provider.