Viewing docs for Alibaba Cloud v3.106.0
published on Monday, Aug 24, 2026 by Pulumi
published on Monday, Aug 24, 2026 by Pulumi
Viewing docs for Alibaba Cloud v3.106.0
published on Monday, Aug 24, 2026 by Pulumi
published on Monday, Aug 24, 2026 by Pulumi
This data source provides the ENS Security Groups of the current Alibaba Cloud user.
NOTE: Available since v1.287.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const _default = alicloud.ens.getSecurityGroups({
securityGroupName: "tf-example",
ids: ["sg-xxx"],
});
export const firstGroupId = _default.then(_default => _default.groups?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
default = alicloud.ens.get_security_groups(security_group_name="tf-example",
ids=["sg-xxx"])
pulumi.export("firstGroupId", default.groups[0].id)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ens"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_default, err := ens.GetSecurityGroups(ctx, &ens.GetSecurityGroupsArgs{
SecurityGroupName: pulumi.StringRef("tf-example"),
Ids: []string{
"sg-xxx",
},
}, nil)
if err != nil {
return err
}
ctx.Export("firstGroupId", _default.Groups[0].Id)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var @default = AliCloud.Ens.GetSecurityGroups.Invoke(new()
{
SecurityGroupName = "tf-example",
Ids = new[]
{
"sg-xxx",
},
});
return new Dictionary<string, object?>
{
["firstGroupId"] = @default.Apply(@default => @default.Apply(getSecurityGroupsResult => getSecurityGroupsResult.Groups[0]?.Id)),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ens.EnsFunctions;
import com.pulumi.alicloud.ens.inputs.GetSecurityGroupsArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 default = EnsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder()
.securityGroupName("tf-example")
.ids("sg-xxx")
.build());
ctx.export("firstGroupId", default_.groups()[0].id());
}
}
variables:
default:
fn::invoke:
function: alicloud:ens:getSecurityGroups
arguments:
securityGroupName: tf-example
ids:
- sg-xxx
outputs:
firstGroupId: ${default.groups[0].id}
pulumi {
required_providers {
alicloud = {
source = "pulumi/alicloud"
}
}
}
data "alicloud_ens_getsecuritygroups" "default" {
security_group_name = "tf-example"
ids = ["sg-xxx"]
}
output "firstGroupId" {
value = data.alicloud_ens_getsecuritygroups.default.groups[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?: InvokeOutputOptions): Output<GetSecurityGroupsResult>def get_security_groups(enable_details: Optional[bool] = None,
ids: Optional[Sequence[str]] = None,
name_regex: Optional[str] = None,
output_file: Optional[str] = None,
security_group_id: Optional[str] = None,
security_group_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSecurityGroupsResult
def get_security_groups_output(enable_details: pulumi.Input[Optional[bool]] = None,
ids: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
name_regex: pulumi.Input[Optional[str]] = None,
output_file: pulumi.Input[Optional[str]] = None,
security_group_id: pulumi.Input[Optional[str]] = None,
security_group_name: pulumi.Input[Optional[str]] = None,
opts: Optional[InvokeOutputOptions] = 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 Output<GetSecurityGroupsResult> Invoke(GetSecurityGroupsInvokeArgs args, InvokeOutputOptions opts)
}public static CompletableFuture<GetSecurityGroupsResult> getSecurityGroups(GetSecurityGroupsArgs args, InvokeOptions options)
public static Output<GetSecurityGroupsResult> getSecurityGroups(GetSecurityGroupsArgs args, InvokeOptions options)
public static Output<GetSecurityGroupsResult> getSecurityGroups(GetSecurityGroupsArgs args, InvokeOutputOptions options)
fn::invoke:
function: alicloud:ens/getSecurityGroups:getSecurityGroups
arguments:
# arguments dictionarydata "alicloud_ens_get_security_groups" "name" {
# arguments
}The following arguments are supported:
- Enable
Details bool - Default to
false. Set it totrueto get more details of the security groups. - Ids List<string>
- A list of Security Group IDs.
- 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). - Security
Group stringId - The ID of the Security Group.
- Security
Group stringName - The name of the Security Group.
- Enable
Details bool - Default to
false. Set it totrueto get more details of the security groups. - Ids []string
- A list of Security Group IDs.
- 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). - Security
Group stringId - The ID of the Security Group.
- Security
Group stringName - The name of the Security Group.
- enable_
details bool - Default to
false. Set it totrueto get more details of the security groups. - ids list(string)
- A list of Security Group IDs.
- 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). - security_
group_ stringid - The ID of the Security Group.
- security_
group_ stringname - The name of the Security Group.
- enable
Details Boolean - Default to
false. Set it totrueto get more details of the security groups. - ids List<String>
- A list of Security Group IDs.
- 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). - security
Group StringId - The ID of the Security Group.
- security
Group StringName - The name of the Security Group.
- enable
Details boolean - Default to
false. Set it totrueto get more details of the security groups. - ids string[]
- A list of Security Group IDs.
- 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). - security
Group stringId - The ID of the Security Group.
- security
Group stringName - The name of the Security Group.
- enable_
details bool - Default to
false. Set it totrueto get more details of the security groups. - ids Sequence[str]
- A list of Security Group IDs.
- 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). - security_
group_ strid - The ID of the Security Group.
- security_
group_ strname - The name of the Security Group.
- enable
Details Boolean - Default to
false. Set it totrueto get more details of the security groups. - ids List<String>
- A list of Security Group IDs.
- 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). - security
Group StringId - The ID of the Security Group.
- security
Group StringName - The name of the Security Group.
getSecurityGroups Result
The following output properties are available:
- Groups
List<Pulumi.
Ali Cloud. Ens. Outputs. Get Security Groups Group> - A list of Security Groups.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids List<string>
- A list of Security Group IDs.
- Names List<string>
- A list of Security Group names.
- Enable
Details bool - Name
Regex string - Output
File string - Security
Group stringId - The ID of the Security Group.
- Security
Group stringName - Security group name.
- Groups
[]Get
Security Groups Group - A list of Security Groups.
- Id string
- The provider-assigned unique ID for this managed resource.
- Ids []string
- A list of Security Group IDs.
- Names []string
- A list of Security Group names.
- Enable
Details bool - Name
Regex string - Output
File string - Security
Group stringId - The ID of the Security Group.
- Security
Group stringName - Security group name.
- groups list(object)
- A list of Security Groups.
- id string
- The provider-assigned unique ID for this managed resource.
- ids list(string)
- A list of Security Group IDs.
- names list(string)
- A list of Security Group names.
- enable_
details bool - name_
regex string - output_
file string - security_
group_ stringid - The ID of the Security Group.
- security_
group_ stringname - Security group name.
- groups
List<Get
Security Groups Group> - A list of Security Groups.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Security Group IDs.
- names List<String>
- A list of Security Group names.
- enable
Details Boolean - name
Regex String - output
File String - security
Group StringId - The ID of the Security Group.
- security
Group StringName - Security group name.
- groups
Get
Security Groups Group[] - A list of Security Groups.
- id string
- The provider-assigned unique ID for this managed resource.
- ids string[]
- A list of Security Group IDs.
- names string[]
- A list of Security Group names.
- enable
Details boolean - name
Regex string - output
File string - security
Group stringId - The ID of the Security Group.
- security
Group stringName - Security group name.
- groups
Sequence[Get
Security Groups Group] - A list of Security Groups.
- id str
- The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
- A list of Security Group IDs.
- names Sequence[str]
- A list of Security Group names.
- enable_
details bool - name_
regex str - output_
file str - security_
group_ strid - The ID of the Security Group.
- security_
group_ strname - Security group name.
- groups List<Property Map>
- A list of Security Groups.
- id String
- The provider-assigned unique ID for this managed resource.
- ids List<String>
- A list of Security Group IDs.
- names List<String>
- A list of Security Group names.
- enable
Details Boolean - name
Regex String - output
File String - security
Group StringId - The ID of the Security Group.
- security
Group StringName - Security group name.
Supporting Types
GetSecurityGroupsGroup
- Create
Time string - Creation time of the security group, UTC time.
- Description string
- Rule description information.
- Id string
- The ID of the Security Group.
- Instance
Count int - Number of instances associated with a security group.
- Permissions
List<Pulumi.
Ali Cloud. Ens. Inputs. Get Security Groups Group Permission> - A collection of rules for a security group instance.
- Security
Group stringId - The ID of the Security Group.
- Security
Group stringName - The name of the Security Group.
- Create
Time string - Creation time of the security group, UTC time.
- Description string
- Rule description information.
- Id string
- The ID of the Security Group.
- Instance
Count int - Number of instances associated with a security group.
- Permissions
[]Get
Security Groups Group Permission - A collection of rules for a security group instance.
- Security
Group stringId - The ID of the Security Group.
- Security
Group stringName - The name of the Security Group.
- create_
time string - Creation time of the security group, UTC time.
- description string
- Rule description information.
- id string
- The ID of the Security Group.
- instance_
count number - Number of instances associated with a security group.
- permissions list(object)
- A collection of rules for a security group instance.
- security_
group_ stringid - The ID of the Security Group.
- security_
group_ stringname - The name of the Security Group.
- create
Time String - Creation time of the security group, UTC time.
- description String
- Rule description information.
- id String
- The ID of the Security Group.
- instance
Count Integer - Number of instances associated with a security group.
- permissions
List<Get
Security Groups Group Permission> - A collection of rules for a security group instance.
- security
Group StringId - The ID of the Security Group.
- security
Group StringName - The name of the Security Group.
- create
Time string - Creation time of the security group, UTC time.
- description string
- Rule description information.
- id string
- The ID of the Security Group.
- instance
Count number - Number of instances associated with a security group.
- permissions
Get
Security Groups Group Permission[] - A collection of rules for a security group instance.
- security
Group stringId - The ID of the Security Group.
- security
Group stringName - The name of the Security Group.
- create_
time str - Creation time of the security group, UTC time.
- description str
- Rule description information.
- id str
- The ID of the Security Group.
- instance_
count int - Number of instances associated with a security group.
- permissions
Sequence[Get
Security Groups Group Permission] - A collection of rules for a security group instance.
- security_
group_ strid - The ID of the Security Group.
- security_
group_ strname - The name of the Security Group.
- create
Time String - Creation time of the security group, UTC time.
- description String
- Rule description information.
- id String
- The ID of the Security Group.
- instance
Count Number - Number of instances associated with a security group.
- permissions List<Property Map>
- A collection of rules for a security group instance.
- security
Group StringId - The ID of the Security Group.
- security
Group StringName - The name of the Security Group.
GetSecurityGroupsGroupPermission
- Creation
Time string - Creation time, UTC time.
- Description string
- Rule description information.
- Dest
Cidr stringIp - Destination IP address segment for outbound authorization.
- Direction string
- Authorized direction.
- Ip
Protocol string - IP protocol.
- Ipv6Dest
Cidr stringIp - The target IPv6 address segment.
- Ipv6Source
Cidr stringIp - The source IPv6 address segment.
- Policy string
- Authorization Policy.
- Port
Range string - Source end port range.
- Priority int
- Rule Priority.
- Source
Cidr stringIp - Source IP address segment, used for inbound authorization.
- Source
Port stringRange - The port range of the source security group.
- Creation
Time string - Creation time, UTC time.
- Description string
- Rule description information.
- Dest
Cidr stringIp - Destination IP address segment for outbound authorization.
- Direction string
- Authorized direction.
- Ip
Protocol string - IP protocol.
- Ipv6Dest
Cidr stringIp - The target IPv6 address segment.
- Ipv6Source
Cidr stringIp - The source IPv6 address segment.
- Policy string
- Authorization Policy.
- Port
Range string - Source end port range.
- Priority int
- Rule Priority.
- Source
Cidr stringIp - Source IP address segment, used for inbound authorization.
- Source
Port stringRange - The port range of the source security group.
- creation_
time string - Creation time, UTC time.
- description string
- Rule description information.
- dest_
cidr_ stringip - Destination IP address segment for outbound authorization.
- direction string
- Authorized direction.
- ip_
protocol string - IP protocol.
- ipv6_
dest_ stringcidr_ ip - The target IPv6 address segment.
- ipv6_
source_ stringcidr_ ip - The source IPv6 address segment.
- policy string
- Authorization Policy.
- port_
range string - Source end port range.
- priority number
- Rule Priority.
- source_
cidr_ stringip - Source IP address segment, used for inbound authorization.
- source_
port_ stringrange - The port range of the source security group.
- creation
Time String - Creation time, UTC time.
- description String
- Rule description information.
- dest
Cidr StringIp - Destination IP address segment for outbound authorization.
- direction String
- Authorized direction.
- ip
Protocol String - IP protocol.
- ipv6Dest
Cidr StringIp - The target IPv6 address segment.
- ipv6Source
Cidr StringIp - The source IPv6 address segment.
- policy String
- Authorization Policy.
- port
Range String - Source end port range.
- priority Integer
- Rule Priority.
- source
Cidr StringIp - Source IP address segment, used for inbound authorization.
- source
Port StringRange - The port range of the source security group.
- creation
Time string - Creation time, UTC time.
- description string
- Rule description information.
- dest
Cidr stringIp - Destination IP address segment for outbound authorization.
- direction string
- Authorized direction.
- ip
Protocol string - IP protocol.
- ipv6Dest
Cidr stringIp - The target IPv6 address segment.
- ipv6Source
Cidr stringIp - The source IPv6 address segment.
- policy string
- Authorization Policy.
- port
Range string - Source end port range.
- priority number
- Rule Priority.
- source
Cidr stringIp - Source IP address segment, used for inbound authorization.
- source
Port stringRange - The port range of the source security group.
- creation_
time str - Creation time, UTC time.
- description str
- Rule description information.
- dest_
cidr_ strip - Destination IP address segment for outbound authorization.
- direction str
- Authorized direction.
- ip_
protocol str - IP protocol.
- ipv6_
dest_ strcidr_ ip - The target IPv6 address segment.
- ipv6_
source_ strcidr_ ip - The source IPv6 address segment.
- policy str
- Authorization Policy.
- port_
range str - Source end port range.
- priority int
- Rule Priority.
- source_
cidr_ strip - Source IP address segment, used for inbound authorization.
- source_
port_ strrange - The port range of the source security group.
- creation
Time String - Creation time, UTC time.
- description String
- Rule description information.
- dest
Cidr StringIp - Destination IP address segment for outbound authorization.
- direction String
- Authorized direction.
- ip
Protocol String - IP protocol.
- ipv6Dest
Cidr StringIp - The target IPv6 address segment.
- ipv6Source
Cidr StringIp - The source IPv6 address segment.
- policy String
- Authorization Policy.
- port
Range String - Source end port range.
- priority Number
- Rule Priority.
- source
Cidr StringIp - Source IP address segment, used for inbound authorization.
- source
Port StringRange - The port range of the source security group.
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
alicloudTerraform Provider.
Viewing docs for Alibaba Cloud v3.106.0
published on Monday, Aug 24, 2026 by Pulumi
published on Monday, Aug 24, 2026 by Pulumi