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


Use this data source to get the ID of an available HuaweiCloud security group.

## Example Usage
using System.Collections.Generic;
using Pulumi;
using Huaweicloud = Pulumi.Huaweicloud;

return await Deployment.RunAsync(() => 
{
    var secgroup = Huaweicloud.Vpc.GetSecgroup.Invoke(new()
    {
        Name = "tf_test_secgroup",
    });

});
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"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := Vpc.GetSecgroup(ctx, &vpc.GetSecgroupArgs{
            Name: pulumi.StringRef("tf_test_secgroup"),
        }, 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.GetSecgroupArgs;
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 secgroup = VpcFunctions.getSecgroup(GetSecgroupArgs.builder()
            .name("tf_test_secgroup")
            .build());

    }
}
import pulumi
import pulumi_huaweicloud as huaweicloud

secgroup = huaweicloud.Vpc.get_secgroup(name="tf_test_secgroup")
import * as pulumi from "@pulumi/pulumi";
import * as huaweicloud from "@pulumi/huaweicloud";

const secgroup = pulumi.output(huaweicloud.Vpc.getSecgroup({
    name: "tf_test_secgroup",
}));
variables:
  secgroup:
    Fn::Invoke:
      Function: huaweicloud:Vpc:getSecgroup
      Arguments:
        name: tf_test_secgroup

Using getSecgroup {#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 getSecgroup(args: GetSecgroupArgs, opts?: InvokeOptions): Promise<GetSecgroupResult>
function getSecgroupOutput(args: GetSecgroupOutputArgs, opts?: InvokeOptions): Output<GetSecgroupResult>
def get_secgroup(enterprise_project_id: Optional[str] = None,
                 name: Optional[str] = None,
                 region: Optional[str] = None,
                 secgroup_id: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetSecgroupResult
def get_secgroup_output(enterprise_project_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 region: Optional[pulumi.Input[str]] = None,
                 secgroup_id: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetSecgroupResult]
func GetSecgroup(ctx *Context, args *GetSecgroupArgs, opts ...InvokeOption) (*GetSecgroupResult, error)
func GetSecgroupOutput(ctx *Context, args *GetSecgroupOutputArgs, opts ...InvokeOption) GetSecgroupResultOutput

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

public static class GetSecgroup 
{
    public static Task<GetSecgroupResult> InvokeAsync(GetSecgroupArgs args, InvokeOptions? opts = null)
    public static Output<GetSecgroupResult> Invoke(GetSecgroupInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSecgroupResult> getSecgroup(GetSecgroupArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: huaweicloud:Vpc/getSecgroup:getSecgroup
  Arguments:
    # Arguments dictionary

The following arguments are supported:

EnterpriseProjectId string
Name string

Specifies the name of the security group.

Region string

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

SecgroupId string

Specifiest he ID of the security group.

EnterpriseProjectId string
Name string

Specifies the name of the security group.

Region string

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

SecgroupId string

Specifiest he ID of the security group.

enterpriseProjectId String
name String

Specifies the name of the security group.

region String

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

secgroupId String

Specifiest he ID of the security group.

enterpriseProjectId string
name string

Specifies the name of the security group.

region string

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

secgroupId string

Specifiest he ID of the security group.

enterprise_project_id str
name str

Specifies the name of the security group.

region str

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

secgroup_id str

Specifiest he ID of the security group.

enterpriseProjectId String
name String

Specifies the name of the security group.

region String

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

secgroupId String

Specifiest he ID of the security group.

getSecgroup Result {#result}

The following output properties are available:

CreatedAt string

The creation time, in UTC format.

Description string

The supplementary information about the security group rule.

Id string

The provider-assigned unique ID for this managed resource.

Name string
Region string
Rules List<GetSecgroupRule>

The array of security group rules associating with the security group. The rule object is documented below.

UpdatedAt string

The last update time, in UTC format.

EnterpriseProjectId string
SecgroupId string
CreatedAt string

The creation time, in UTC format.

Description string

The supplementary information about the security group rule.

Id string

The provider-assigned unique ID for this managed resource.

Name string
Region string
Rules []GetSecgroupRuleType

The array of security group rules associating with the security group. The rule object is documented below.

UpdatedAt string

The last update time, in UTC format.

EnterpriseProjectId string
SecgroupId string
createdAt String

The creation time, in UTC format.

description String

The supplementary information about the security group rule.

id String

The provider-assigned unique ID for this managed resource.

name String
region String
rules List<GetSecgroupRule>

The array of security group rules associating with the security group. The rule object is documented below.

updatedAt String

The last update time, in UTC format.

enterpriseProjectId String
secgroupId String
createdAt string

The creation time, in UTC format.

description string

The supplementary information about the security group rule.

id string

The provider-assigned unique ID for this managed resource.

name string
region string
rules GetSecgroupRule[]

The array of security group rules associating with the security group. The rule object is documented below.

updatedAt string

The last update time, in UTC format.

enterpriseProjectId string
secgroupId string
created_at str

The creation time, in UTC format.

description str

The supplementary information about the security group rule.

id str

The provider-assigned unique ID for this managed resource.

name str
region str
rules GetSecgroupRule]

The array of security group rules associating with the security group. The rule object is documented below.

updated_at str

The last update time, in UTC format.

enterprise_project_id str
secgroup_id str
createdAt String

The creation time, in UTC format.

description String

The supplementary information about the security group rule.

id String

The provider-assigned unique ID for this managed resource.

name String
region String
rules List<Property Map>

The array of security group rules associating with the security group. The rule object is documented below.

updatedAt String

The last update time, in UTC format.

enterpriseProjectId String
secgroupId String

Supporting Types

GetSecgroupRule

Action string

The effective policy.

Description string

The supplementary information about the security group rule.

Direction string

The direction of the rule. The value can be egress or ingress.

Ethertype string

The IP protocol version. The value can be IPv4 or IPv6.

Id string

The security group rule ID.

PortRangeMax int
PortRangeMin int
Ports string

The port value range.

Priority int

The priority number.

Protocol string

The protocol type.

RemoteAddressGroupId string

The ID of the remote address group.

RemoteGroupId string

The ID of the peer security group.

RemoteIpPrefix string

The remote IP address. The value can be in the CIDR format or IP addresses.

Action string

The effective policy.

Description string

The supplementary information about the security group rule.

Direction string

The direction of the rule. The value can be egress or ingress.

Ethertype string

The IP protocol version. The value can be IPv4 or IPv6.

Id string

The security group rule ID.

PortRangeMax int
PortRangeMin int
Ports string

The port value range.

Priority int

The priority number.

Protocol string

The protocol type.

RemoteAddressGroupId string

The ID of the remote address group.

RemoteGroupId string

The ID of the peer security group.

RemoteIpPrefix string

The remote IP address. The value can be in the CIDR format or IP addresses.

action String

The effective policy.

description String

The supplementary information about the security group rule.

direction String

The direction of the rule. The value can be egress or ingress.

ethertype String

The IP protocol version. The value can be IPv4 or IPv6.

id String

The security group rule ID.

portRangeMax Integer
portRangeMin Integer
ports String

The port value range.

priority Integer

The priority number.

protocol String

The protocol type.

remoteAddressGroupId String

The ID of the remote address group.

remoteGroupId String

The ID of the peer security group.

remoteIpPrefix String

The remote IP address. The value can be in the CIDR format or IP addresses.

action string

The effective policy.

description string

The supplementary information about the security group rule.

direction string

The direction of the rule. The value can be egress or ingress.

ethertype string

The IP protocol version. The value can be IPv4 or IPv6.

id string

The security group rule ID.

portRangeMax number
portRangeMin number
ports string

The port value range.

priority number

The priority number.

protocol string

The protocol type.

remoteAddressGroupId string

The ID of the remote address group.

remoteGroupId string

The ID of the peer security group.

remoteIpPrefix string

The remote IP address. The value can be in the CIDR format or IP addresses.

action str

The effective policy.

description str

The supplementary information about the security group rule.

direction str

The direction of the rule. The value can be egress or ingress.

ethertype str

The IP protocol version. The value can be IPv4 or IPv6.

id str

The security group rule ID.

port_range_max int
port_range_min int
ports str

The port value range.

priority int

The priority number.

protocol str

The protocol type.

remote_address_group_id str

The ID of the remote address group.

remote_group_id str

The ID of the peer security group.

remote_ip_prefix str

The remote IP address. The value can be in the CIDR format or IP addresses.

action String

The effective policy.

description String

The supplementary information about the security group rule.

direction String

The direction of the rule. The value can be egress or ingress.

ethertype String

The IP protocol version. The value can be IPv4 or IPv6.

id String

The security group rule ID.

portRangeMax Number
portRangeMin Number
ports String

The port value range.

priority Number

The priority number.

protocol String

The protocol type.

remoteAddressGroupId String

The ID of the remote address group.

remoteGroupId String

The ID of the peer security group.

remoteIpPrefix String

The remote IP address. The value can be in the CIDR format or IP addresses.

Package Details

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

This Pulumi package is based on the huaweicloud Terraform Provider.