ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud
ucloud.getSecurityGroups
Explore with Pulumi AI
This data source provides a list of Security Group resources according to their Security Group ID, name and resource id.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ucloud from "@pulumi/ucloud";
const example = ucloud.getSecurityGroups({});
export const first = example.then(example => example.securityGroups?.[0]?.id);
import pulumi
import pulumi_ucloud as ucloud
example = ucloud.get_security_groups()
pulumi.export("first", example.security_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.GetSecurityGroups(ctx, &ucloud.GetSecurityGroupsArgs{}, nil)
if err != nil {
return err
}
ctx.Export("first", example.SecurityGroups[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ucloud = Pulumi.Ucloud;
return await Deployment.RunAsync(() =>
{
var example = Ucloud.GetSecurityGroups.Invoke();
return new Dictionary<string, object?>
{
["first"] = example.Apply(getSecurityGroupsResult => getSecurityGroupsResult.SecurityGroups[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.GetSecurityGroupsArgs;
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.getSecurityGroups();
ctx.export("first", example.applyValue(getSecurityGroupsResult -> getSecurityGroupsResult.securityGroups()[0].id()));
}
}
variables:
example:
fn::invoke:
function: ucloud:getSecurityGroups
arguments: {}
outputs:
first: ${example.securityGroups[0].id}
Using getSecurityGroups
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 getSecurityGroups(args: GetSecurityGroupsArgs, opts?: InvokeOptions): Promise<GetSecurityGroupsResult>
function getSecurityGroupsOutput(args: GetSecurityGroupsOutputArgs, opts?: InvokeOptions): Output<GetSecurityGroupsResult>
def get_security_groups(id: Optional[str] = None,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
type: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSecurityGroupsResult
def get_security_groups_output(id: Optional[pulumi.Input[str]] = None,
ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
name_regex: Optional[pulumi.Input[str]] = None,
output_file: Optional[pulumi.Input[str]] = None,
type: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSecurityGroupsResult]
func GetSecurityGroups(ctx *Context, args *GetSecurityGroupsArgs, opts ...InvokeOption) (*GetSecurityGroupsResult, error)
func GetSecurityGroupsOutput(ctx *Context, args *GetSecurityGroupsOutputArgs, opts ...InvokeOption) GetSecurityGroupsResultOutput
> Note: This function is named GetSecurityGroups
in the Go SDK.
public static class GetSecurityGroups
{
public static Task<GetSecurityGroupsResult> InvokeAsync(GetSecurityGroupsArgs args, InvokeOptions? opts = null)
public static Output<GetSecurityGroupsResult> Invoke(GetSecurityGroupsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetSecurityGroupsResult> getSecurityGroups(GetSecurityGroupsArgs args, InvokeOptions options)
public static Output<GetSecurityGroupsResult> getSecurityGroups(GetSecurityGroupsArgs args, InvokeOptions options)
fn::invoke:
function: ucloud:index/getSecurityGroups:getSecurityGroups
arguments:
# arguments dictionary
The following arguments are supported:
- Id string
- The ID of Security Group.
- Ids List<string>
- A list of Security Group IDs, all the Security Group resources belong to this region will be retrieved if the ID is
[]
. - Name
Regex string - A regex string to filter resulting Security Group resources by name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Type string
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
- Id string
- The ID of Security Group.
- Ids []string
- A list of Security Group IDs, all the Security Group resources belong to this region will be retrieved if the ID is
[]
. - Name
Regex string - A regex string to filter resulting Security Group resources by name.
- Output
File string - File name where to save data source results (after running
pulumi preview
). - Type string
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
- id String
- The ID of Security Group.
- ids List<String>
- A list of Security Group IDs, all the Security Group resources belong to this region will be retrieved if the ID is
[]
. - name
Regex String - A regex string to filter resulting Security Group resources by name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - type String
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
- id string
- The ID of Security Group.
- ids string[]
- A list of Security Group IDs, all the Security Group resources belong to this region will be retrieved if the ID is
[]
. - name
Regex string - A regex string to filter resulting Security Group resources by name.
- output
File string - File name where to save data source results (after running
pulumi preview
). - type string
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
- id str
- The ID of Security Group.
- ids Sequence[str]
- A list of Security Group IDs, all the Security Group resources belong to this region will be retrieved if the ID is
[]
. - name_
regex str - A regex string to filter resulting Security Group resources by name.
- output_
file str - File name where to save data source results (after running
pulumi preview
). - type str
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
- id String
- The ID of Security Group.
- ids List<String>
- A list of Security Group IDs, all the Security Group resources belong to this region will be retrieved if the ID is
[]
. - name
Regex String - A regex string to filter resulting Security Group resources by name.
- output
File String - File name where to save data source results (after running
pulumi preview
). - type String
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
getSecurityGroups Result
The following output properties are available:
- Id string
- The ID of Security Group.
- Ids List<string>
- Security
Groups List<GetSecurity Groups Security Group> - It is a nested type which documented below.
- Total
Count double - Total number of Security Group resources that satisfy the condition.
- Name
Regex string - Output
File string - Type string
- The type of Security Group.
- Id string
- The ID of Security Group.
- Ids []string
- Security
Groups []GetSecurity Groups Security Group - It is a nested type which documented below.
- Total
Count float64 - Total number of Security Group resources that satisfy the condition.
- Name
Regex string - Output
File string - Type string
- The type of Security Group.
- id String
- The ID of Security Group.
- ids List<String>
- security
Groups List<GetSecurity Groups Security Group> - It is a nested type which documented below.
- total
Count Double - Total number of Security Group resources that satisfy the condition.
- name
Regex String - output
File String - type String
- The type of Security Group.
- id string
- The ID of Security Group.
- ids string[]
- security
Groups GetSecurity Groups Security Group[] - It is a nested type which documented below.
- total
Count number - Total number of Security Group resources that satisfy the condition.
- name
Regex string - output
File string - type string
- The type of Security Group.
- id str
- The ID of Security Group.
- ids Sequence[str]
- security_
groups Sequence[GetSecurity Groups Security Group] - It is a nested type which documented below.
- total_
count float - Total number of Security Group resources that satisfy the condition.
- name_
regex str - output_
file str - type str
- The type of Security Group.
- id String
- The ID of Security Group.
- ids List<String>
- security
Groups List<Property Map> - It is a nested type which documented below.
- total
Count Number - Total number of Security Group resources that satisfy the condition.
- name
Regex String - output
File String - type String
- The type of Security Group.
Supporting Types
GetSecurityGroupsSecurityGroup
- Create
Time string - The time of creation for the security group, formatted in RFC3339 time string.
- Id string
- The ID of Security Group.
- Name string
- The name of Security Group.
- Remark string
- The remarks of the security group.
- Rules
List<Get
Security Groups Security Group Rule> - It is a nested type which documented below.
- Tag string
- A tag assigned to the security group.
- Type string
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
- Create
Time string - The time of creation for the security group, formatted in RFC3339 time string.
- Id string
- The ID of Security Group.
- Name string
- The name of Security Group.
- Remark string
- The remarks of the security group.
- Rules
[]Get
Security Groups Security Group Rule - It is a nested type which documented below.
- Tag string
- A tag assigned to the security group.
- Type string
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
- create
Time String - The time of creation for the security group, formatted in RFC3339 time string.
- id String
- The ID of Security Group.
- name String
- The name of Security Group.
- remark String
- The remarks of the security group.
- rules
List<Get
Security Groups Security Group Rule> - It is a nested type which documented below.
- tag String
- A tag assigned to the security group.
- type String
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
- create
Time string - The time of creation for the security group, formatted in RFC3339 time string.
- id string
- The ID of Security Group.
- name string
- The name of Security Group.
- remark string
- The remarks of the security group.
- rules
Get
Security Groups Security Group Rule[] - It is a nested type which documented below.
- tag string
- A tag assigned to the security group.
- type string
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
- create_
time str - The time of creation for the security group, formatted in RFC3339 time string.
- id str
- The ID of Security Group.
- name str
- The name of Security Group.
- remark str
- The remarks of the security group.
- rules
Sequence[Get
Security Groups Security Group Rule] - It is a nested type which documented below.
- tag str
- A tag assigned to the security group.
- type str
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
- create
Time String - The time of creation for the security group, formatted in RFC3339 time string.
- id String
- The ID of Security Group.
- name String
- The name of Security Group.
- remark String
- The remarks of the security group.
- rules List<Property Map>
- It is a nested type which documented below.
- tag String
- A tag assigned to the security group.
- type String
- The type of Security Group. Possible values are:
recommend_web
as the default Web security group that UCloud recommend to users, default opened port include 80, 443, 22, 3389,recommend_non_web
as the default non Web security group that UCloud recommend to users, default opened port include 22, 3389,user_defined
as the security groups defined by users. You may refer to security group.
GetSecurityGroupsSecurityGroupRule
- Cidr
Block string - The cidr block of source.
- Policy string
- Authorization policy. Can be either
accept
ordrop
. - Port
Range string - The range of port numbers, range: 1-65535. (eg:
port
orport1-port2
). - Priority string
- Rule priority. Can be
high
,medium
,low
. - Protocol string
- The protocol. Can be
tcp
,udp
,icmp
,gre
.
- Cidr
Block string - The cidr block of source.
- Policy string
- Authorization policy. Can be either
accept
ordrop
. - Port
Range string - The range of port numbers, range: 1-65535. (eg:
port
orport1-port2
). - Priority string
- Rule priority. Can be
high
,medium
,low
. - Protocol string
- The protocol. Can be
tcp
,udp
,icmp
,gre
.
- cidr
Block String - The cidr block of source.
- policy String
- Authorization policy. Can be either
accept
ordrop
. - port
Range String - The range of port numbers, range: 1-65535. (eg:
port
orport1-port2
). - priority String
- Rule priority. Can be
high
,medium
,low
. - protocol String
- The protocol. Can be
tcp
,udp
,icmp
,gre
.
- cidr
Block string - The cidr block of source.
- policy string
- Authorization policy. Can be either
accept
ordrop
. - port
Range string - The range of port numbers, range: 1-65535. (eg:
port
orport1-port2
). - priority string
- Rule priority. Can be
high
,medium
,low
. - protocol string
- The protocol. Can be
tcp
,udp
,icmp
,gre
.
- cidr_
block str - The cidr block of source.
- policy str
- Authorization policy. Can be either
accept
ordrop
. - port_
range str - The range of port numbers, range: 1-65535. (eg:
port
orport1-port2
). - priority str
- Rule priority. Can be
high
,medium
,low
. - protocol str
- The protocol. Can be
tcp
,udp
,icmp
,gre
.
- cidr
Block String - The cidr block of source.
- policy String
- Authorization policy. Can be either
accept
ordrop
. - port
Range String - The range of port numbers, range: 1-65535. (eg:
port
orport1-port2
). - priority String
- Rule priority. Can be
high
,medium
,low
. - protocol String
- The protocol. Can be
tcp
,udp
,icmp
,gre
.
Package Details
- Repository
- ucloud ucloud/terraform-provider-ucloud
- License
- Notes
- This Pulumi package is based on the
ucloud
Terraform Provider.