GetSecurityGroups

This data source provides a list of Security Groups in an Alibaba Cloud account according to the specified filters.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var secGroupsDs = Output.Create(AliCloud.Ecs.GetSecurityGroups.InvokeAsync(new AliCloud.Ecs.GetSecurityGroupsArgs
        {
            NameRegex = "^web-",
            OutputFile = "web_access.json",
        }));
        // In conjunction with a VPC
        var primaryVpcDs = new AliCloud.Vpc.Network("primaryVpcDs", new AliCloud.Vpc.NetworkArgs
        {
        });
        var primarySecGroupsDs = primaryVpcDs.Id.Apply(id => AliCloud.Ecs.GetSecurityGroups.InvokeAsync(new AliCloud.Ecs.GetSecurityGroupsArgs
        {
            VpcId = id,
        }));
        this.FirstGroupId = primarySecGroupsDs.Apply(primarySecGroupsDs => primarySecGroupsDs.Groups[0].Id);
    }

    [Output("firstGroupId")]
    public Output<string> FirstGroupId { get; set; }
}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

sec_groups_ds = alicloud.ecs.get_security_groups(name_regex="^web-",
    output_file="web_access.json")
# In conjunction with a VPC
primary_vpc_ds = alicloud.vpc.Network("primaryVpcDs")
primary_sec_groups_ds = primary_vpc_ds.id.apply(lambda id: alicloud.ecs.get_security_groups(vpc_id=id))
pulumi.export("firstGroupId", primary_sec_groups_ds.groups[0]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

// Filter security groups and print the results into a file
const secGroupsDs = pulumi.output(alicloud.ecs.getSecurityGroups({
    nameRegex: "^web-",
    outputFile: "web_access.json",
}, { async: true }));
// In conjunction with a VPC
const primaryVpcDs = new alicloud.vpc.Network("primary_vpc_ds", {});
const primarySecGroupsDs = primaryVpcDs.id.apply(id => alicloud.ecs.getSecurityGroups({
    vpcId: id,
}, { async: true }));

export const firstGroupId = primarySecGroupsDs.groups[0].id;

Using GetSecurityGroups

function getSecurityGroups(args: GetSecurityGroupsArgs, opts?: InvokeOptions): Promise<GetSecurityGroupsResult>
function  get_security_groups(ids=None, name_regex=None, output_file=None, resource_group_id=None, tags=None, vpc_id=None, opts=None)
func GetSecurityGroups(ctx *Context, args *GetSecurityGroupsArgs, opts ...InvokeOption) (*GetSecurityGroupsResult, error)
public static class GetSecurityGroups {
    public static Task<GetSecurityGroupsResult> InvokeAsync(GetSecurityGroupsArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Ids List<string>

A list of Security Group IDs.

NameRegex string

A regex string to filter the resulting security groups by their names.

OutputFile string
ResourceGroupId string

The Id of resource group which the security_group belongs.

Tags Dictionary<string, object>

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
VpcId string

Used to retrieve security groups that belong to the specified VPC ID.

Ids []string

A list of Security Group IDs.

NameRegex string

A regex string to filter the resulting security groups by their names.

OutputFile string
ResourceGroupId string

The Id of resource group which the security_group belongs.

Tags map[string]interface{}

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
VpcId string

Used to retrieve security groups that belong to the specified VPC ID.

ids string[]

A list of Security Group IDs.

nameRegex string

A regex string to filter the resulting security groups by their names.

outputFile string
resourceGroupId string

The Id of resource group which the security_group belongs.

tags {[key: string]: any}

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
vpcId string

Used to retrieve security groups that belong to the specified VPC ID.

ids List[str]

A list of Security Group IDs.

name_regex str

A regex string to filter the resulting security groups by their names.

output_file str
resource_group_id str

The Id of resource group which the security_group belongs.

tags Dict[str, Any]

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
vpc_id str

Used to retrieve security groups that belong to the specified VPC ID.

GetSecurityGroups Result

The following output properties are available:

Groups List<Pulumi.AliCloud.Ecs.Outputs.GetSecurityGroupsGroup>

A list of Security Groups. Each element contains the following attributes:

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.

NameRegex string
OutputFile string
ResourceGroupId string

The Id of resource group which the security_group belongs.

Tags Dictionary<string, object>

A map of tags assigned to the ECS instance.

VpcId string

The ID of the VPC that owns the security group.

Groups []GetSecurityGroupsGroup

A list of Security Groups. Each element contains the following attributes:

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.

NameRegex string
OutputFile string
ResourceGroupId string

The Id of resource group which the security_group belongs.

Tags map[string]interface{}

A map of tags assigned to the ECS instance.

VpcId string

The ID of the VPC that owns the security group.

groups GetSecurityGroupsGroup[]

A list of Security Groups. Each element contains the following attributes:

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.

nameRegex string
outputFile string
resourceGroupId string

The Id of resource group which the security_group belongs.

tags {[key: string]: any}

A map of tags assigned to the ECS instance.

vpcId string

The ID of the VPC that owns the security group.

groups List[GetSecurityGroupsGroup]

A list of Security Groups. Each element contains the following attributes:

id str

The provider-assigned unique ID for this managed resource.

ids List[str]

A list of Security Group IDs.

names List[str]

A list of Security Group names.

name_regex str
output_file str
resource_group_id str

The Id of resource group which the security_group belongs.

tags Dict[str, Any]

A map of tags assigned to the ECS instance.

vpc_id str

The ID of the VPC that owns the security group.

Supporting Types

GetSecurityGroupsGroup

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

CreationTime string

Creation time of the security group.

Description string

The description of the security group.

Id string

The ID of the security group.

InnerAccess bool

Whether to allow inner network access.

Name string

The name of the security group.

ResourceGroupId string

The Id of resource group which the security_group belongs.

SecurityGroupType string

The type of the security group.

VpcId string

Used to retrieve security groups that belong to the specified VPC ID.

Tags Dictionary<string, object>

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
CreationTime string

Creation time of the security group.

Description string

The description of the security group.

Id string

The ID of the security group.

InnerAccess bool

Whether to allow inner network access.

Name string

The name of the security group.

ResourceGroupId string

The Id of resource group which the security_group belongs.

SecurityGroupType string

The type of the security group.

VpcId string

Used to retrieve security groups that belong to the specified VPC ID.

Tags map[string]interface{}

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
creationTime string

Creation time of the security group.

description string

The description of the security group.

id string

The ID of the security group.

innerAccess boolean

Whether to allow inner network access.

name string

The name of the security group.

resourceGroupId string

The Id of resource group which the security_group belongs.

securityGroupType string

The type of the security group.

vpcId string

Used to retrieve security groups that belong to the specified VPC ID.

tags {[key: string]: any}

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}
creation_time str

Creation time of the security group.

description str

The description of the security group.

id str

The ID of the security group.

inner_access bool

Whether to allow inner network access.

name str

The name of the security group.

resource_group_id str

The Id of resource group which the security_group belongs.

security_group_type str

The type of the security group.

vpc_id str

Used to retrieve security groups that belong to the specified VPC ID.

tags Dict[str, Any]

A map of tags assigned to the ECS instances. It must be in the format:

data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" {
tags = {
tagKey1 = "tagValue1",
tagKey2 = "tagValue2"
}
}

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.