1. Packages
  2. Ibm Provider
  3. API Docs
  4. NetworkInterfaceSgAttachment
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

ibm.NetworkInterfaceSgAttachment

Explore with Pulumi AI

ibm logo
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

    Create, delete, and update to attach security group to a network interface. For more information, about security group and an network interface, see integrating an IBM Cloud Application Load Balancer for VPC with security groups.

    Note

    For more information, see the IBM Cloud Classic Infrastructure (SoftLayer) API docs.

    Example Usage

    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.IbmFunctions;
    import com.pulumi.ibm.inputs.GetSecurityGroupArgs;
    import com.pulumi.ibm.ComputeVmInstance;
    import com.pulumi.ibm.NetworkInterfaceSgAttachment;
    import com.pulumi.ibm.NetworkInterfaceSgAttachmentArgs;
    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) {
            final var allowssh = IbmFunctions.getSecurityGroup(GetSecurityGroupArgs.builder()
                .name("allow_ssh")
                .build());
    
            var vsi = new ComputeVmInstance("vsi");
    
            var sg1 = new NetworkInterfaceSgAttachment("sg1", NetworkInterfaceSgAttachmentArgs.builder()
                .securityGroupId(allowssh.applyValue(getSecurityGroupResult -> getSecurityGroupResult.id()))
                .networkInterfaceId(vsi.publicInterfaceId())
                .timeouts(NetworkInterfaceSgAttachmentTimeoutsArgs.builder()
                    .create("15m")
                    .build())
                .build());
    
        }
    }
    
    resources:
      vsi:
        type: ibm:ComputeVmInstance
      sg1:
        type: ibm:NetworkInterfaceSgAttachment
        properties:
          securityGroupId: ${allowssh.id}
          networkInterfaceId: ${vsi.publicInterfaceId}
          # User can increase timeouts
          timeouts:
            - create: 15m
    variables:
      allowssh:
        fn::invoke:
          function: ibm:getSecurityGroup
          arguments:
            name: allow_ssh
    

    Argument reference

    Review the argument references that you can specify for your resource.

    • security_group_id - (Required, Forces new resource, Integer) The ID of the security group.
    • network_interface_id - (Required, Forces new resource, Integer) The ID of the network interface to which the security group must be applied.
    • soft_reboot- (Optional, Forces new resource, Bool) Default true. If set to true and a reboot is required to apply the security group attachment for the virtual server instance, then a soft reboot is performed. If set to false, no reboot is performed.

    Note

    A reboot is always required the first time a security group is applied to a network interface of a virtual server instance that was never rebooted before.

    Create NetworkInterfaceSgAttachment Resource

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

    Constructor syntax

    new NetworkInterfaceSgAttachment(name: string, args: NetworkInterfaceSgAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def NetworkInterfaceSgAttachment(resource_name: str,
                                     args: NetworkInterfaceSgAttachmentArgs,
                                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def NetworkInterfaceSgAttachment(resource_name: str,
                                     opts: Optional[ResourceOptions] = None,
                                     network_interface_id: Optional[float] = None,
                                     security_group_id: Optional[float] = None,
                                     network_interface_sg_attachment_id: Optional[str] = None,
                                     soft_reboot: Optional[bool] = None,
                                     timeouts: Optional[NetworkInterfaceSgAttachmentTimeoutsArgs] = None)
    func NewNetworkInterfaceSgAttachment(ctx *Context, name string, args NetworkInterfaceSgAttachmentArgs, opts ...ResourceOption) (*NetworkInterfaceSgAttachment, error)
    public NetworkInterfaceSgAttachment(string name, NetworkInterfaceSgAttachmentArgs args, CustomResourceOptions? opts = null)
    public NetworkInterfaceSgAttachment(String name, NetworkInterfaceSgAttachmentArgs args)
    public NetworkInterfaceSgAttachment(String name, NetworkInterfaceSgAttachmentArgs args, CustomResourceOptions options)
    
    type: ibm:NetworkInterfaceSgAttachment
    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 NetworkInterfaceSgAttachmentArgs
    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 NetworkInterfaceSgAttachmentArgs
    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 NetworkInterfaceSgAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NetworkInterfaceSgAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NetworkInterfaceSgAttachmentArgs
    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 networkInterfaceSgAttachmentResource = new Ibm.NetworkInterfaceSgAttachment("networkInterfaceSgAttachmentResource", new()
    {
        NetworkInterfaceId = 0,
        SecurityGroupId = 0,
        NetworkInterfaceSgAttachmentId = "string",
        SoftReboot = false,
        Timeouts = new Ibm.Inputs.NetworkInterfaceSgAttachmentTimeoutsArgs
        {
            Create = "string",
        },
    });
    
    example, err := ibm.NewNetworkInterfaceSgAttachment(ctx, "networkInterfaceSgAttachmentResource", &ibm.NetworkInterfaceSgAttachmentArgs{
    	NetworkInterfaceId:             pulumi.Float64(0),
    	SecurityGroupId:                pulumi.Float64(0),
    	NetworkInterfaceSgAttachmentId: pulumi.String("string"),
    	SoftReboot:                     pulumi.Bool(false),
    	Timeouts: &ibm.NetworkInterfaceSgAttachmentTimeoutsArgs{
    		Create: pulumi.String("string"),
    	},
    })
    
    var networkInterfaceSgAttachmentResource = new NetworkInterfaceSgAttachment("networkInterfaceSgAttachmentResource", NetworkInterfaceSgAttachmentArgs.builder()
        .networkInterfaceId(0)
        .securityGroupId(0)
        .networkInterfaceSgAttachmentId("string")
        .softReboot(false)
        .timeouts(NetworkInterfaceSgAttachmentTimeoutsArgs.builder()
            .create("string")
            .build())
        .build());
    
    network_interface_sg_attachment_resource = ibm.NetworkInterfaceSgAttachment("networkInterfaceSgAttachmentResource",
        network_interface_id=0,
        security_group_id=0,
        network_interface_sg_attachment_id="string",
        soft_reboot=False,
        timeouts={
            "create": "string",
        })
    
    const networkInterfaceSgAttachmentResource = new ibm.NetworkInterfaceSgAttachment("networkInterfaceSgAttachmentResource", {
        networkInterfaceId: 0,
        securityGroupId: 0,
        networkInterfaceSgAttachmentId: "string",
        softReboot: false,
        timeouts: {
            create: "string",
        },
    });
    
    type: ibm:NetworkInterfaceSgAttachment
    properties:
        networkInterfaceId: 0
        networkInterfaceSgAttachmentId: string
        securityGroupId: 0
        softReboot: false
        timeouts:
            create: string
    

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

    NetworkInterfaceId double
    Network interface ID
    SecurityGroupId double
    Security group ID
    NetworkInterfaceSgAttachmentId string
    SoftReboot bool
    Boolean value set to true, if soft reboot needs to be done.
    Timeouts NetworkInterfaceSgAttachmentTimeouts
    NetworkInterfaceId float64
    Network interface ID
    SecurityGroupId float64
    Security group ID
    NetworkInterfaceSgAttachmentId string
    SoftReboot bool
    Boolean value set to true, if soft reboot needs to be done.
    Timeouts NetworkInterfaceSgAttachmentTimeoutsArgs
    networkInterfaceId Double
    Network interface ID
    securityGroupId Double
    Security group ID
    networkInterfaceSgAttachmentId String
    softReboot Boolean
    Boolean value set to true, if soft reboot needs to be done.
    timeouts NetworkInterfaceSgAttachmentTimeouts
    networkInterfaceId number
    Network interface ID
    securityGroupId number
    Security group ID
    networkInterfaceSgAttachmentId string
    softReboot boolean
    Boolean value set to true, if soft reboot needs to be done.
    timeouts NetworkInterfaceSgAttachmentTimeouts
    network_interface_id float
    Network interface ID
    security_group_id float
    Security group ID
    network_interface_sg_attachment_id str
    soft_reboot bool
    Boolean value set to true, if soft reboot needs to be done.
    timeouts NetworkInterfaceSgAttachmentTimeoutsArgs
    networkInterfaceId Number
    Network interface ID
    securityGroupId Number
    Security group ID
    networkInterfaceSgAttachmentId String
    softReboot Boolean
    Boolean value set to true, if soft reboot needs to be done.
    timeouts Property Map

    Outputs

    All input properties are implicitly available as output properties. Additionally, the NetworkInterfaceSgAttachment 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 NetworkInterfaceSgAttachment Resource

    Get an existing NetworkInterfaceSgAttachment 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?: NetworkInterfaceSgAttachmentState, opts?: CustomResourceOptions): NetworkInterfaceSgAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            network_interface_id: Optional[float] = None,
            network_interface_sg_attachment_id: Optional[str] = None,
            security_group_id: Optional[float] = None,
            soft_reboot: Optional[bool] = None,
            timeouts: Optional[NetworkInterfaceSgAttachmentTimeoutsArgs] = None) -> NetworkInterfaceSgAttachment
    func GetNetworkInterfaceSgAttachment(ctx *Context, name string, id IDInput, state *NetworkInterfaceSgAttachmentState, opts ...ResourceOption) (*NetworkInterfaceSgAttachment, error)
    public static NetworkInterfaceSgAttachment Get(string name, Input<string> id, NetworkInterfaceSgAttachmentState? state, CustomResourceOptions? opts = null)
    public static NetworkInterfaceSgAttachment get(String name, Output<String> id, NetworkInterfaceSgAttachmentState state, CustomResourceOptions options)
    resources:  _:    type: ibm:NetworkInterfaceSgAttachment    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:
    NetworkInterfaceId double
    Network interface ID
    NetworkInterfaceSgAttachmentId string
    SecurityGroupId double
    Security group ID
    SoftReboot bool
    Boolean value set to true, if soft reboot needs to be done.
    Timeouts NetworkInterfaceSgAttachmentTimeouts
    NetworkInterfaceId float64
    Network interface ID
    NetworkInterfaceSgAttachmentId string
    SecurityGroupId float64
    Security group ID
    SoftReboot bool
    Boolean value set to true, if soft reboot needs to be done.
    Timeouts NetworkInterfaceSgAttachmentTimeoutsArgs
    networkInterfaceId Double
    Network interface ID
    networkInterfaceSgAttachmentId String
    securityGroupId Double
    Security group ID
    softReboot Boolean
    Boolean value set to true, if soft reboot needs to be done.
    timeouts NetworkInterfaceSgAttachmentTimeouts
    networkInterfaceId number
    Network interface ID
    networkInterfaceSgAttachmentId string
    securityGroupId number
    Security group ID
    softReboot boolean
    Boolean value set to true, if soft reboot needs to be done.
    timeouts NetworkInterfaceSgAttachmentTimeouts
    network_interface_id float
    Network interface ID
    network_interface_sg_attachment_id str
    security_group_id float
    Security group ID
    soft_reboot bool
    Boolean value set to true, if soft reboot needs to be done.
    timeouts NetworkInterfaceSgAttachmentTimeoutsArgs
    networkInterfaceId Number
    Network interface ID
    networkInterfaceSgAttachmentId String
    securityGroupId Number
    Security group ID
    softReboot Boolean
    Boolean value set to true, if soft reboot needs to be done.
    timeouts Property Map

    Supporting Types

    NetworkInterfaceSgAttachmentTimeouts, NetworkInterfaceSgAttachmentTimeoutsArgs

    Create string
    Create string
    create String
    create string
    create str
    create String

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm logo
    ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud