Class InterfaceAttach


  • public class InterfaceAttach
    extends com.pulumi.resources.CustomResource
    Attaches a Network Interface (a Port) to an Instance using the OpenStack Compute (Nova) v2 API. ## Example Usage ### Basic Attachment ```java 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()); } } ``` ### Attachment Specifying a Fixed IP ```java 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()) .fixedIp("10.0.10.10") .build()); } } ``` ### Attachment Using an Existing Port ```java 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() .networkId(network1.id()) .adminStateUp("true") .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 Interface Attachments can be imported using the Instance ID and Port ID separated by a slash, e.g. ```sh $ pulumi import openstack:compute/interfaceAttach:InterfaceAttach ai_1 89c60255-9bd6-460c-822a-e2b959ede9d2/45670584-225f-46c3-b33e-6707b589b666 ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> fixedIp()  
      static InterfaceAttach get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, InterfaceAttachState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> instanceId()  
      com.pulumi.core.Output<java.lang.String> networkId()  
      com.pulumi.core.Output<java.lang.String> portId()  
      com.pulumi.core.Output<java.lang.String> region()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InterfaceAttach

        public InterfaceAttach​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • InterfaceAttach

        public InterfaceAttach​(java.lang.String name,
                               InterfaceAttachArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • InterfaceAttach

        public InterfaceAttach​(java.lang.String name,
                               InterfaceAttachArgs args,
                               @Nullable
                               com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • fixedIp

        public com.pulumi.core.Output<java.lang.String> fixedIp()
        Returns:
        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.
      • instanceId

        public com.pulumi.core.Output<java.lang.String> instanceId()
        Returns:
        The ID of the Instance to attach the Port or Network to.
      • networkId

        public com.pulumi.core.Output<java.lang.String> networkId()
        Returns:
        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

        public com.pulumi.core.Output<java.lang.String> portId()
        Returns:
        The ID of the Port to attach to an Instance. _NOTE_: This option and `network_id` are mutually exclusive.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        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.
      • get

        public static InterfaceAttach get​(java.lang.String name,
                                          com.pulumi.core.Output<java.lang.String> id,
                                          @Nullable
                                          InterfaceAttachState state,
                                          @Nullable
                                          com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.