1. Packages
  2. Packages
  3. Ucloud Provider
  4. API Docs
  5. getSecGroups
Viewing docs for ucloud 1.39.5
published on Thursday, May 14, 2026 by ucloud
Viewing docs for ucloud 1.39.5
published on Thursday, May 14, 2026 by ucloud

    This data source provides a list of Security Group resources.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ucloud from "@pulumi/ucloud";
    
    const example = ucloud.getSecGroups({
        vpcId: "uvnet-xxxxx",
    });
    export const first = example.then(example => example.secGroups?.[0]?.id);
    
    import pulumi
    import pulumi_ucloud as ucloud
    
    example = ucloud.get_sec_groups(vpc_id="uvnet-xxxxx")
    pulumi.export("first", example.sec_groups[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ucloud.GetSecGroups(ctx, &ucloud.GetSecGroupsArgs{
    			VpcId: pulumi.StringRef("uvnet-xxxxx"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("first", example.SecGroups[0].Id)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ucloud = Pulumi.Ucloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ucloud.GetSecGroups.Invoke(new()
        {
            VpcId = "uvnet-xxxxx",
        });
    
        return new Dictionary<string, object?>
        {
            ["first"] = example.Apply(getSecGroupsResult => getSecGroupsResult.SecGroups[0]?.Id),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ucloud.UcloudFunctions;
    import com.pulumi.ucloud.inputs.GetSecGroupsArgs;
    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 example = UcloudFunctions.getSecGroups(GetSecGroupsArgs.builder()
                .vpcId("uvnet-xxxxx")
                .build());
    
            ctx.export("first", example.secGroups()[0].id());
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ucloud:getSecGroups
          arguments:
            vpcId: uvnet-xxxxx
    outputs:
      first: ${example.secGroups[0].id}
    
    Example coming soon!
    

    Using getSecGroups

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSecGroups(args: GetSecGroupsArgs, opts?: InvokeOptions): Promise<GetSecGroupsResult>
    function getSecGroupsOutput(args: GetSecGroupsOutputArgs, opts?: InvokeOptions): Output<GetSecGroupsResult>
    def get_sec_groups(id: Optional[str] = None,
                       ids: Optional[Sequence[str]] = None,
                       name_regex: Optional[str] = None,
                       output_file: Optional[str] = None,
                       vpc_id: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetSecGroupsResult
    def get_sec_groups_output(id: pulumi.Input[Optional[str]] = None,
                       ids: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                       name_regex: pulumi.Input[Optional[str]] = None,
                       output_file: pulumi.Input[Optional[str]] = None,
                       vpc_id: pulumi.Input[Optional[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetSecGroupsResult]
    func GetSecGroups(ctx *Context, args *GetSecGroupsArgs, opts ...InvokeOption) (*GetSecGroupsResult, error)
    func GetSecGroupsOutput(ctx *Context, args *GetSecGroupsOutputArgs, opts ...InvokeOption) GetSecGroupsResultOutput

    > Note: This function is named GetSecGroups in the Go SDK.

    public static class GetSecGroups 
    {
        public static Task<GetSecGroupsResult> InvokeAsync(GetSecGroupsArgs args, InvokeOptions? opts = null)
        public static Output<GetSecGroupsResult> Invoke(GetSecGroupsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSecGroupsResult> getSecGroups(GetSecGroupsArgs args, InvokeOptions options)
    public static Output<GetSecGroupsResult> getSecGroups(GetSecGroupsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ucloud:index/getSecGroups:getSecGroups
      arguments:
        # arguments dictionary
    data "ucloud_getsecgroups" "name" {
        # arguments
    }

    The following arguments are supported:

    Id string
    The ID of the security group.
    Ids List<string>
    A list of security group IDs to filter.
    NameRegex string
    A regex string to filter results by security group name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    VpcId string
    The ID of VPC to filter security groups.
    Id string
    The ID of the security group.
    Ids []string
    A list of security group IDs to filter.
    NameRegex string
    A regex string to filter results by security group name.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    VpcId string
    The ID of VPC to filter security groups.
    id string
    The ID of the security group.
    ids list(string)
    A list of security group IDs to filter.
    name_regex string
    A regex string to filter results by security group name.
    output_file string
    File name where to save data source results (after running pulumi preview).
    vpc_id string
    The ID of VPC to filter security groups.
    id String
    The ID of the security group.
    ids List<String>
    A list of security group IDs to filter.
    nameRegex String
    A regex string to filter results by security group name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    vpcId String
    The ID of VPC to filter security groups.
    id string
    The ID of the security group.
    ids string[]
    A list of security group IDs to filter.
    nameRegex string
    A regex string to filter results by security group name.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    vpcId string
    The ID of VPC to filter security groups.
    id str
    The ID of the security group.
    ids Sequence[str]
    A list of security group IDs to filter.
    name_regex str
    A regex string to filter results by security group name.
    output_file str
    File name where to save data source results (after running pulumi preview).
    vpc_id str
    The ID of VPC to filter security groups.
    id String
    The ID of the security group.
    ids List<String>
    A list of security group IDs to filter.
    nameRegex String
    A regex string to filter results by security group name.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    vpcId String
    The ID of VPC to filter security groups.

    getSecGroups Result

    The following output properties are available:

    Id string
    The ID of the security group.
    Ids List<string>
    A list of security group IDs.
    SecGroups List<GetSecGroupsSecGroup>
    It is a nested type which documented below.
    TotalCount double
    Total number of security groups that satisfy the condition.
    NameRegex string
    OutputFile string
    VpcId string
    The ID of VPC linked to the security group.
    Id string
    The ID of the security group.
    Ids []string
    A list of security group IDs.
    SecGroups []GetSecGroupsSecGroup
    It is a nested type which documented below.
    TotalCount float64
    Total number of security groups that satisfy the condition.
    NameRegex string
    OutputFile string
    VpcId string
    The ID of VPC linked to the security group.
    id string
    The ID of the security group.
    ids list(string)
    A list of security group IDs.
    sec_groups list(object)
    It is a nested type which documented below.
    total_count number
    Total number of security groups that satisfy the condition.
    name_regex string
    output_file string
    vpc_id string
    The ID of VPC linked to the security group.
    id String
    The ID of the security group.
    ids List<String>
    A list of security group IDs.
    secGroups List<GetSecGroupsSecGroup>
    It is a nested type which documented below.
    totalCount Double
    Total number of security groups that satisfy the condition.
    nameRegex String
    outputFile String
    vpcId String
    The ID of VPC linked to the security group.
    id string
    The ID of the security group.
    ids string[]
    A list of security group IDs.
    secGroups GetSecGroupsSecGroup[]
    It is a nested type which documented below.
    totalCount number
    Total number of security groups that satisfy the condition.
    nameRegex string
    outputFile string
    vpcId string
    The ID of VPC linked to the security group.
    id str
    The ID of the security group.
    ids Sequence[str]
    A list of security group IDs.
    sec_groups Sequence[GetSecGroupsSecGroup]
    It is a nested type which documented below.
    total_count float
    Total number of security groups that satisfy the condition.
    name_regex str
    output_file str
    vpc_id str
    The ID of VPC linked to the security group.
    id String
    The ID of the security group.
    ids List<String>
    A list of security group IDs.
    secGroups List<Property Map>
    It is a nested type which documented below.
    totalCount Number
    Total number of security groups that satisfy the condition.
    nameRegex String
    outputFile String
    vpcId String
    The ID of VPC linked to the security group.

    Supporting Types

    GetSecGroupsSecGroup

    CreateTime string
    The time of creation, formatted in RFC3339 time string.
    Id string
    The ID of the security group.
    Name string
    The name of the security group.
    Remark string
    The remarks of the rule.
    Rules List<GetSecGroupsSecGroupRule>
    A list of security group rules. Each element contains the following attributes:
    Tag string
    A tag assigned to the security group.
    Type string
    The type of the security group.
    VpcId string
    The ID of VPC to filter security groups.
    CreateTime string
    The time of creation, formatted in RFC3339 time string.
    Id string
    The ID of the security group.
    Name string
    The name of the security group.
    Remark string
    The remarks of the rule.
    Rules []GetSecGroupsSecGroupRule
    A list of security group rules. Each element contains the following attributes:
    Tag string
    A tag assigned to the security group.
    Type string
    The type of the security group.
    VpcId string
    The ID of VPC to filter security groups.
    create_time string
    The time of creation, formatted in RFC3339 time string.
    id string
    The ID of the security group.
    name string
    The name of the security group.
    remark string
    The remarks of the rule.
    rules list(object)
    A list of security group rules. Each element contains the following attributes:
    tag string
    A tag assigned to the security group.
    type string
    The type of the security group.
    vpc_id string
    The ID of VPC to filter security groups.
    createTime String
    The time of creation, formatted in RFC3339 time string.
    id String
    The ID of the security group.
    name String
    The name of the security group.
    remark String
    The remarks of the rule.
    rules List<GetSecGroupsSecGroupRule>
    A list of security group rules. Each element contains the following attributes:
    tag String
    A tag assigned to the security group.
    type String
    The type of the security group.
    vpcId String
    The ID of VPC to filter security groups.
    createTime string
    The time of creation, formatted in RFC3339 time string.
    id string
    The ID of the security group.
    name string
    The name of the security group.
    remark string
    The remarks of the rule.
    rules GetSecGroupsSecGroupRule[]
    A list of security group rules. Each element contains the following attributes:
    tag string
    A tag assigned to the security group.
    type string
    The type of the security group.
    vpcId string
    The ID of VPC to filter security groups.
    create_time str
    The time of creation, formatted in RFC3339 time string.
    id str
    The ID of the security group.
    name str
    The name of the security group.
    remark str
    The remarks of the rule.
    rules Sequence[GetSecGroupsSecGroupRule]
    A list of security group rules. Each element contains the following attributes:
    tag str
    A tag assigned to the security group.
    type str
    The type of the security group.
    vpc_id str
    The ID of VPC to filter security groups.
    createTime String
    The time of creation, formatted in RFC3339 time string.
    id String
    The ID of the security group.
    name String
    The name of the security group.
    remark String
    The remarks of the rule.
    rules List<Property Map>
    A list of security group rules. Each element contains the following attributes:
    tag String
    A tag assigned to the security group.
    type String
    The type of the security group.
    vpcId String
    The ID of VPC to filter security groups.

    GetSecGroupsSecGroupRule

    Direction string
    The direction of the rule.
    DstPort string
    The destination port.
    IpRange string
    The IP address range.
    Priority double
    The priority of the rule.
    ProtocolType string
    The protocol type.
    Remark string
    The remarks of the rule.
    RuleAction string
    The action of the rule.
    RuleId string
    The ID of the rule.
    Direction string
    The direction of the rule.
    DstPort string
    The destination port.
    IpRange string
    The IP address range.
    Priority float64
    The priority of the rule.
    ProtocolType string
    The protocol type.
    Remark string
    The remarks of the rule.
    RuleAction string
    The action of the rule.
    RuleId string
    The ID of the rule.
    direction string
    The direction of the rule.
    dst_port string
    The destination port.
    ip_range string
    The IP address range.
    priority number
    The priority of the rule.
    protocol_type string
    The protocol type.
    remark string
    The remarks of the rule.
    rule_action string
    The action of the rule.
    rule_id string
    The ID of the rule.
    direction String
    The direction of the rule.
    dstPort String
    The destination port.
    ipRange String
    The IP address range.
    priority Double
    The priority of the rule.
    protocolType String
    The protocol type.
    remark String
    The remarks of the rule.
    ruleAction String
    The action of the rule.
    ruleId String
    The ID of the rule.
    direction string
    The direction of the rule.
    dstPort string
    The destination port.
    ipRange string
    The IP address range.
    priority number
    The priority of the rule.
    protocolType string
    The protocol type.
    remark string
    The remarks of the rule.
    ruleAction string
    The action of the rule.
    ruleId string
    The ID of the rule.
    direction str
    The direction of the rule.
    dst_port str
    The destination port.
    ip_range str
    The IP address range.
    priority float
    The priority of the rule.
    protocol_type str
    The protocol type.
    remark str
    The remarks of the rule.
    rule_action str
    The action of the rule.
    rule_id str
    The ID of the rule.
    direction String
    The direction of the rule.
    dstPort String
    The destination port.
    ipRange String
    The IP address range.
    priority Number
    The priority of the rule.
    protocolType String
    The protocol type.
    remark String
    The remarks of the rule.
    ruleAction String
    The action of the rule.
    ruleId String
    The ID of the rule.

    Package Details

    Repository
    ucloud ucloud/terraform-provider-ucloud
    License
    Notes
    This Pulumi package is based on the ucloud Terraform Provider.
    Viewing docs for ucloud 1.39.5
    published on Thursday, May 14, 2026 by ucloud
      Try Pulumi Cloud free. Your team will thank you.