title: "getSecgroups" title_tag: "huaweicloud.Vpc.getSecgroups" meta_desc: "Documentation for the huaweicloud.Vpc.getSecgroups function with examples, input properties, output properties, and supporting types." layout: api no_edit_this_page: true


Use this data source to get the list of the available HuaweiCloud security groups.

## Example Usage

Filter the list of security groups by a description keyword

using System.Collections.Generic;
using Pulumi;
using Huaweicloud = Pulumi.Huaweicloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var keyWord = config.RequireObject<dynamic>("keyWord");
    var test = Huaweicloud.Vpc.GetSecgroups.Invoke(new()
    {
        Description = keyWord,
    });

});
package main

import (
    "github.com/huaweicloud/pulumi-huaweicloud/sdk/go/huaweicloud/Vpc"
    "github.com/pulumi/pulumi-huaweicloud/sdk/go/huaweicloud/Vpc"
    "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        cfg := config.New(ctx, "")
        keyWord := cfg.RequireObject("keyWord")
        _, err := Vpc.GetSecgroups(ctx, &vpc.GetSecgroupsArgs{
            Description: pulumi.StringRef(keyWord),
        }, nil)
        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.huaweicloud.Vpc.VpcFunctions;
import com.pulumi.huaweicloud.Vpc.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 config = ctx.config();
        final var keyWord = config.get("keyWord");
        final var test = VpcFunctions.getSecgroups(GetSecgroupsArgs.builder()
            .description(keyWord)
            .build());

    }
}
import pulumi
import pulumi_huaweicloud as huaweicloud

config = pulumi.Config()
key_word = config.require_object("keyWord")
test = huaweicloud.Vpc.get_secgroups(description=key_word)
import * as pulumi from "@pulumi/pulumi";
import * as huaweicloud from "@pulumi/huaweicloud";

const config = new pulumi.Config();
const keyWord = config.requireObject("keyWord");
const test = huaweicloud.Vpc.getSecgroups({
    description: keyWord,
});
configuration:
  keyWord:
    type: dynamic
variables:
  test:
    Fn::Invoke:
      Function: huaweicloud:Vpc:getSecgroups
      Arguments:
        description: ${keyWord}

Using getSecgroups {#using}

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_secgroups(description: Optional[str] = None,
                  enterprise_project_id: Optional[str] = None,
                  name: Optional[str] = None,
                  region: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetSecgroupsResult
def get_secgroups_output(description: Optional[pulumi.Input[str]] = None,
                  enterprise_project_id: Optional[pulumi.Input[str]] = None,
                  name: Optional[pulumi.Input[str]] = None,
                  region: Optional[pulumi.Input[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)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: huaweicloud:Vpc/getSecgroups:getSecgroups
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Description string

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

EnterpriseProjectId string

Specifies the enterprise project ID of the security group.

Name string

Specifies the name of the security group.

Region string

Specifies the region in which to obtain the security group list. If omitted, the provider-level region will be used.

Description string

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

EnterpriseProjectId string

Specifies the enterprise project ID of the security group.

Name string

Specifies the name of the security group.

Region string

Specifies the region in which to obtain the security group list. If omitted, the provider-level region will be used.

description String

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

enterpriseProjectId String

Specifies the enterprise project ID of the security group.

name String

Specifies the name of the security group.

region String

Specifies the region in which to obtain the security group list. If omitted, the provider-level region will be used.

description string

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

enterpriseProjectId string

Specifies the enterprise project ID of the security group.

name string

Specifies the name of the security group.

region string

Specifies the region in which to obtain the security group list. If omitted, the provider-level region will be used.

description str

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

enterprise_project_id str

Specifies the enterprise project ID of the security group.

name str

Specifies the name of the security group.

region str

Specifies the region in which to obtain the security group list. If omitted, the provider-level region will be used.

description String

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

enterpriseProjectId String

Specifies the enterprise project ID of the security group.

name String

Specifies the name of the security group.

region String

Specifies the region in which to obtain the security group list. If omitted, the provider-level region will be used.

getSecgroups Result {#result}

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

SecurityGroups List<GetSecgroupsSecurityGroup>

The list of security groups. The object is documented below.

Description string
EnterpriseProjectId string

The enterprise project ID of the security group.

Name string

The name of the security group.

Region string
Id string

The provider-assigned unique ID for this managed resource.

SecurityGroups []GetSecgroupsSecurityGroup

The list of security groups. The object is documented below.

Description string
EnterpriseProjectId string

The enterprise project ID of the security group.

Name string

The name of the security group.

Region string
id String

The provider-assigned unique ID for this managed resource.

securityGroups List<GetSecgroupsSecurityGroup>

The list of security groups. The object is documented below.

description String
enterpriseProjectId String

The enterprise project ID of the security group.

name String

The name of the security group.

region String
id string

The provider-assigned unique ID for this managed resource.

securityGroups GetSecgroupsSecurityGroup[]

The list of security groups. The object is documented below.

description string
enterpriseProjectId string

The enterprise project ID of the security group.

name string

The name of the security group.

region string
id str

The provider-assigned unique ID for this managed resource.

security_groups GetSecgroupsSecurityGroup]

The list of security groups. The object is documented below.

description str
enterprise_project_id str

The enterprise project ID of the security group.

name str

The name of the security group.

region str
id String

The provider-assigned unique ID for this managed resource.

securityGroups List<Property Map>

The list of security groups. The object is documented below.

description String
enterpriseProjectId String

The enterprise project ID of the security group.

name String

The name of the security group.

region String

Supporting Types

GetSecgroupsSecurityGroup

CreatedAt string

The creation time, in UTC format.

Description string

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

EnterpriseProjectId string

Specifies the enterprise project ID of the security group.

Id string

The security group ID.

Name string

Specifies the name of the security group.

UpdatedAt string

The last update time, in UTC format.

CreatedAt string

The creation time, in UTC format.

Description string

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

EnterpriseProjectId string

Specifies the enterprise project ID of the security group.

Id string

The security group ID.

Name string

Specifies the name of the security group.

UpdatedAt string

The last update time, in UTC format.

createdAt String

The creation time, in UTC format.

description String

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

enterpriseProjectId String

Specifies the enterprise project ID of the security group.

id String

The security group ID.

name String

Specifies the name of the security group.

updatedAt String

The last update time, in UTC format.

createdAt string

The creation time, in UTC format.

description string

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

enterpriseProjectId string

Specifies the enterprise project ID of the security group.

id string

The security group ID.

name string

Specifies the name of the security group.

updatedAt string

The last update time, in UTC format.

created_at str

The creation time, in UTC format.

description str

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

enterprise_project_id str

Specifies the enterprise project ID of the security group.

id str

The security group ID.

name str

Specifies the name of the security group.

updated_at str

The last update time, in UTC format.

createdAt String

The creation time, in UTC format.

description String

Specifies the description of the security group. The security groups can be filtered by keywords in the description.

enterpriseProjectId String

Specifies the enterprise project ID of the security group.

id String

The security group ID.

name String

Specifies the name of the security group.

updatedAt String

The last update time, in UTC format.

Package Details

Repository
https://github.com/huaweicloud/pulumi-huaweicloud
License
Apache-2.0
Notes

This Pulumi package is based on the huaweicloud Terraform Provider.