1. Packages
  2. Opentelekomcloud Provider
  3. API Docs
  4. NetworkingPortSecgroupAssociateV2
opentelekomcloud 1.36.37 published on Thursday, Apr 24, 2025 by opentelekomcloud

opentelekomcloud.NetworkingPortSecgroupAssociateV2

Explore with Pulumi AI

opentelekomcloud logo
opentelekomcloud 1.36.37 published on Thursday, Apr 24, 2025 by opentelekomcloud

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as opentelekomcloud from "@pulumi/opentelekomcloud";
    
    const systemPort = opentelekomcloud.getNetworkingPortV2({
        fixedIp: "10.0.0.10",
    });
    const secgroup = opentelekomcloud.getNetworkingSecgroupV2({
        name: "secgroup",
    });
    const port1 = new opentelekomcloud.NetworkingPortSecgroupAssociateV2("port1", {
        portId: systemPort.then(systemPort => systemPort.id),
        securityGroupIds: [secgroup.then(secgroup => secgroup.id)],
    });
    
    import pulumi
    import pulumi_opentelekomcloud as opentelekomcloud
    
    system_port = opentelekomcloud.get_networking_port_v2(fixed_ip="10.0.0.10")
    secgroup = opentelekomcloud.get_networking_secgroup_v2(name="secgroup")
    port1 = opentelekomcloud.NetworkingPortSecgroupAssociateV2("port1",
        port_id=system_port.id,
        security_group_ids=[secgroup.id])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/opentelekomcloud/opentelekomcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		systemPort, err := opentelekomcloud.LookupNetworkingPortV2(ctx, &opentelekomcloud.LookupNetworkingPortV2Args{
    			FixedIp: pulumi.StringRef("10.0.0.10"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		secgroup, err := opentelekomcloud.LookupNetworkingSecgroupV2(ctx, &opentelekomcloud.LookupNetworkingSecgroupV2Args{
    			Name: pulumi.StringRef("secgroup"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = opentelekomcloud.NewNetworkingPortSecgroupAssociateV2(ctx, "port1", &opentelekomcloud.NetworkingPortSecgroupAssociateV2Args{
    			PortId: pulumi.String(systemPort.Id),
    			SecurityGroupIds: pulumi.StringArray{
    				pulumi.String(secgroup.Id),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Opentelekomcloud = Pulumi.Opentelekomcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var systemPort = Opentelekomcloud.GetNetworkingPortV2.Invoke(new()
        {
            FixedIp = "10.0.0.10",
        });
    
        var secgroup = Opentelekomcloud.GetNetworkingSecgroupV2.Invoke(new()
        {
            Name = "secgroup",
        });
    
        var port1 = new Opentelekomcloud.NetworkingPortSecgroupAssociateV2("port1", new()
        {
            PortId = systemPort.Apply(getNetworkingPortV2Result => getNetworkingPortV2Result.Id),
            SecurityGroupIds = new[]
            {
                secgroup.Apply(getNetworkingSecgroupV2Result => getNetworkingSecgroupV2Result.Id),
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.opentelekomcloud.OpentelekomcloudFunctions;
    import com.pulumi.opentelekomcloud.inputs.GetNetworkingPortV2Args;
    import com.pulumi.opentelekomcloud.inputs.GetNetworkingSecgroupV2Args;
    import com.pulumi.opentelekomcloud.NetworkingPortSecgroupAssociateV2;
    import com.pulumi.opentelekomcloud.NetworkingPortSecgroupAssociateV2Args;
    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 systemPort = OpentelekomcloudFunctions.getNetworkingPortV2(GetNetworkingPortV2Args.builder()
                .fixedIp("10.0.0.10")
                .build());
    
            final var secgroup = OpentelekomcloudFunctions.getNetworkingSecgroupV2(GetNetworkingSecgroupV2Args.builder()
                .name("secgroup")
                .build());
    
            var port1 = new NetworkingPortSecgroupAssociateV2("port1", NetworkingPortSecgroupAssociateV2Args.builder()
                .portId(systemPort.applyValue(getNetworkingPortV2Result -> getNetworkingPortV2Result.id()))
                .securityGroupIds(secgroup.applyValue(getNetworkingSecgroupV2Result -> getNetworkingSecgroupV2Result.id()))
                .build());
    
        }
    }
    
    resources:
      port1:
        type: opentelekomcloud:NetworkingPortSecgroupAssociateV2
        properties:
          portId: ${systemPort.id}
          securityGroupIds:
            - ${secgroup.id}
    variables:
      systemPort:
        fn::invoke:
          function: opentelekomcloud:getNetworkingPortV2
          arguments:
            fixedIp: 10.0.0.10
      secgroup:
        fn::invoke:
          function: opentelekomcloud:getNetworkingSecgroupV2
          arguments:
            name: secgroup
    

    Create NetworkingPortSecgroupAssociateV2 Resource

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

    Constructor syntax

    new NetworkingPortSecgroupAssociateV2(name: string, args: NetworkingPortSecgroupAssociateV2Args, opts?: CustomResourceOptions);
    @overload
    def NetworkingPortSecgroupAssociateV2(resource_name: str,
                                          args: NetworkingPortSecgroupAssociateV2Args,
                                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def NetworkingPortSecgroupAssociateV2(resource_name: str,
                                          opts: Optional[ResourceOptions] = None,
                                          port_id: Optional[str] = None,
                                          security_group_ids: Optional[Sequence[str]] = None,
                                          force: Optional[bool] = None,
                                          networking_port_secgroup_associate_v2_id: Optional[str] = None,
                                          region: Optional[str] = None)
    func NewNetworkingPortSecgroupAssociateV2(ctx *Context, name string, args NetworkingPortSecgroupAssociateV2Args, opts ...ResourceOption) (*NetworkingPortSecgroupAssociateV2, error)
    public NetworkingPortSecgroupAssociateV2(string name, NetworkingPortSecgroupAssociateV2Args args, CustomResourceOptions? opts = null)
    public NetworkingPortSecgroupAssociateV2(String name, NetworkingPortSecgroupAssociateV2Args args)
    public NetworkingPortSecgroupAssociateV2(String name, NetworkingPortSecgroupAssociateV2Args args, CustomResourceOptions options)
    
    type: opentelekomcloud:NetworkingPortSecgroupAssociateV2
    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 NetworkingPortSecgroupAssociateV2Args
    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 NetworkingPortSecgroupAssociateV2Args
    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 NetworkingPortSecgroupAssociateV2Args
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NetworkingPortSecgroupAssociateV2Args
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NetworkingPortSecgroupAssociateV2Args
    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 networkingPortSecgroupAssociateV2Resource = new Opentelekomcloud.NetworkingPortSecgroupAssociateV2("networkingPortSecgroupAssociateV2Resource", new()
    {
        PortId = "string",
        SecurityGroupIds = new[]
        {
            "string",
        },
        Force = false,
        NetworkingPortSecgroupAssociateV2Id = "string",
        Region = "string",
    });
    
    example, err := opentelekomcloud.NewNetworkingPortSecgroupAssociateV2(ctx, "networkingPortSecgroupAssociateV2Resource", &opentelekomcloud.NetworkingPortSecgroupAssociateV2Args{
    	PortId: pulumi.String("string"),
    	SecurityGroupIds: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Force:                               pulumi.Bool(false),
    	NetworkingPortSecgroupAssociateV2Id: pulumi.String("string"),
    	Region:                              pulumi.String("string"),
    })
    
    var networkingPortSecgroupAssociateV2Resource = new NetworkingPortSecgroupAssociateV2("networkingPortSecgroupAssociateV2Resource", NetworkingPortSecgroupAssociateV2Args.builder()
        .portId("string")
        .securityGroupIds("string")
        .force(false)
        .networkingPortSecgroupAssociateV2Id("string")
        .region("string")
        .build());
    
    networking_port_secgroup_associate_v2_resource = opentelekomcloud.NetworkingPortSecgroupAssociateV2("networkingPortSecgroupAssociateV2Resource",
        port_id="string",
        security_group_ids=["string"],
        force=False,
        networking_port_secgroup_associate_v2_id="string",
        region="string")
    
    const networkingPortSecgroupAssociateV2Resource = new opentelekomcloud.NetworkingPortSecgroupAssociateV2("networkingPortSecgroupAssociateV2Resource", {
        portId: "string",
        securityGroupIds: ["string"],
        force: false,
        networkingPortSecgroupAssociateV2Id: "string",
        region: "string",
    });
    
    type: opentelekomcloud:NetworkingPortSecgroupAssociateV2
    properties:
        force: false
        networkingPortSecgroupAssociateV2Id: string
        portId: string
        region: string
        securityGroupIds:
            - string
    

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

    PortId string
    An UUID of the port to apply security groups to.
    SecurityGroupIds List<string>
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    Force bool
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    NetworkingPortSecgroupAssociateV2Id string
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    PortId string
    An UUID of the port to apply security groups to.
    SecurityGroupIds []string
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    Force bool
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    NetworkingPortSecgroupAssociateV2Id string
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    portId String
    An UUID of the port to apply security groups to.
    securityGroupIds List<String>
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    force Boolean
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    networkingPortSecgroupAssociateV2Id String
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    portId string
    An UUID of the port to apply security groups to.
    securityGroupIds string[]
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    force boolean
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    networkingPortSecgroupAssociateV2Id string
    region string
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    port_id str
    An UUID of the port to apply security groups to.
    security_group_ids Sequence[str]
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    force bool
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    networking_port_secgroup_associate_v2_id str
    region str
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    portId String
    An UUID of the port to apply security groups to.
    securityGroupIds List<String>
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    force Boolean
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    networkingPortSecgroupAssociateV2Id String
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.

    Outputs

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

    AllSecurityGroupIds List<string>
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    Id string
    The provider-assigned unique ID for this managed resource.
    AllSecurityGroupIds []string
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    Id string
    The provider-assigned unique ID for this managed resource.
    allSecurityGroupIds List<String>
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    id String
    The provider-assigned unique ID for this managed resource.
    allSecurityGroupIds string[]
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    id string
    The provider-assigned unique ID for this managed resource.
    all_security_group_ids Sequence[str]
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    id str
    The provider-assigned unique ID for this managed resource.
    allSecurityGroupIds List<String>
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing NetworkingPortSecgroupAssociateV2 Resource

    Get an existing NetworkingPortSecgroupAssociateV2 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?: NetworkingPortSecgroupAssociateV2State, opts?: CustomResourceOptions): NetworkingPortSecgroupAssociateV2
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            all_security_group_ids: Optional[Sequence[str]] = None,
            force: Optional[bool] = None,
            networking_port_secgroup_associate_v2_id: Optional[str] = None,
            port_id: Optional[str] = None,
            region: Optional[str] = None,
            security_group_ids: Optional[Sequence[str]] = None) -> NetworkingPortSecgroupAssociateV2
    func GetNetworkingPortSecgroupAssociateV2(ctx *Context, name string, id IDInput, state *NetworkingPortSecgroupAssociateV2State, opts ...ResourceOption) (*NetworkingPortSecgroupAssociateV2, error)
    public static NetworkingPortSecgroupAssociateV2 Get(string name, Input<string> id, NetworkingPortSecgroupAssociateV2State? state, CustomResourceOptions? opts = null)
    public static NetworkingPortSecgroupAssociateV2 get(String name, Output<String> id, NetworkingPortSecgroupAssociateV2State state, CustomResourceOptions options)
    resources:  _:    type: opentelekomcloud:NetworkingPortSecgroupAssociateV2    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:
    AllSecurityGroupIds List<string>
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    Force bool
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    NetworkingPortSecgroupAssociateV2Id string
    PortId string
    An UUID of the port to apply security groups to.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    SecurityGroupIds List<string>
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    AllSecurityGroupIds []string
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    Force bool
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    NetworkingPortSecgroupAssociateV2Id string
    PortId string
    An UUID of the port to apply security groups to.
    Region string
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    SecurityGroupIds []string
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    allSecurityGroupIds List<String>
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    force Boolean
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    networkingPortSecgroupAssociateV2Id String
    portId String
    An UUID of the port to apply security groups to.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    securityGroupIds List<String>
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    allSecurityGroupIds string[]
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    force boolean
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    networkingPortSecgroupAssociateV2Id string
    portId string
    An UUID of the port to apply security groups to.
    region string
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    securityGroupIds string[]
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    all_security_group_ids Sequence[str]
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    force bool
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    networking_port_secgroup_associate_v2_id str
    port_id str
    An UUID of the port to apply security groups to.
    region str
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    security_group_ids Sequence[str]
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).
    allSecurityGroupIds List<String>
    The collection of Security Group IDs on the port which have been explicitly and implicitly added.
    force Boolean
    Whether to replace or append the list of security groups, specified in the security_group_ids. Defaults to false.
    networkingPortSecgroupAssociateV2Id String
    portId String
    An UUID of the port to apply security groups to.
    region String
    The region in which to obtain the V2 networking client. A networking client is needed to manage a port. If omitted, the region argument of the provider is used. Changing this creates a new resource.
    securityGroupIds List<String>
    A list of security group IDs to apply to the port. The security groups must be specified by ID and not name (as opposed to how they are configured with the Compute Instance).

    Import

    Port security group association can be imported using the id of the port, e.g.

    $ pulumi import opentelekomcloud:index/networkingPortSecgroupAssociateV2:NetworkingPortSecgroupAssociateV2 port_1 eae26a3e-1c33-4cc1-9c31-5ght78rdf12
    

    lifecycle {

    ignore_changes = [
    
      force,
    
      security_group_ids,
    
    ]
    

    }

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

    Package Details

    Repository
    opentelekomcloud opentelekomcloud/terraform-provider-opentelekomcloud
    License
    Notes
    This Pulumi package is based on the opentelekomcloud Terraform Provider.
    opentelekomcloud logo
    opentelekomcloud 1.36.37 published on Thursday, Apr 24, 2025 by opentelekomcloud