alicloud.ecs.getSecurityGroups
Explore with Pulumi AI
This data source provides a list of Security Groups in an Alibaba Cloud account according to the specified filters.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
// Filter security groups and print the results into a file
const secGroupsDs = alicloud.ecs.getSecurityGroups({
    nameRegex: "^web-",
    outputFile: "web_access.json",
});
// In conjunction with a VPC
const primaryVpcDs = new alicloud.vpc.Network("primary_vpc_ds", {});
const primarySecGroupsDs = alicloud.ecs.getSecurityGroupsOutput({
    vpcId: primaryVpcDs.id,
});
export const firstGroupId = primarySecGroupsDs.apply(primarySecGroupsDs => primarySecGroupsDs.groups?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
# Filter security groups and print the results into a file
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("primary_vpc_ds")
primary_sec_groups_ds = alicloud.ecs.get_security_groups_output(vpc_id=primary_vpc_ds.id)
pulumi.export("firstGroupId", primary_sec_groups_ds.groups[0].id)
package main
import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Filter security groups and print the results into a file
		_, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{
			NameRegex:  pulumi.StringRef("^web-"),
			OutputFile: pulumi.StringRef("web_access.json"),
		}, nil)
		if err != nil {
			return err
		}
		// In conjunction with a VPC
		primaryVpcDs, err := vpc.NewNetwork(ctx, "primary_vpc_ds", nil)
		if err != nil {
			return err
		}
		primarySecGroupsDs := ecs.GetSecurityGroupsOutput(ctx, ecs.GetSecurityGroupsOutputArgs{
			VpcId: primaryVpcDs.ID(),
		}, nil)
		ctx.Export("firstGroupId", primarySecGroupsDs.ApplyT(func(primarySecGroupsDs ecs.GetSecurityGroupsResult) (*string, error) {
			return &primarySecGroupsDs.Groups[0].Id, nil
		}).(pulumi.StringPtrOutput))
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() => 
{
    // Filter security groups and print the results into a file
    var secGroupsDs = AliCloud.Ecs.GetSecurityGroups.Invoke(new()
    {
        NameRegex = "^web-",
        OutputFile = "web_access.json",
    });
    // In conjunction with a VPC
    var primaryVpcDs = new AliCloud.Vpc.Network("primary_vpc_ds");
    var primarySecGroupsDs = AliCloud.Ecs.GetSecurityGroups.Invoke(new()
    {
        VpcId = primaryVpcDs.Id,
    });
    return new Dictionary<string, object?>
    {
        ["firstGroupId"] = primarySecGroupsDs.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.ecs.EcsFunctions;
import com.pulumi.alicloud.ecs.inputs.GetSecurityGroupsArgs;
import com.pulumi.alicloud.vpc.Network;
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) {
        // Filter security groups and print the results into a file
        final var secGroupsDs = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder()
            .nameRegex("^web-")
            .outputFile("web_access.json")
            .build());
        // In conjunction with a VPC
        var primaryVpcDs = new Network("primaryVpcDs");
        final var primarySecGroupsDs = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder()
            .vpcId(primaryVpcDs.id())
            .build());
        ctx.export("firstGroupId", primarySecGroupsDs.applyValue(getSecurityGroupsResult -> getSecurityGroupsResult).applyValue(primarySecGroupsDs -> primarySecGroupsDs.applyValue(getSecurityGroupsResult -> getSecurityGroupsResult.groups()[0].id())));
    }
}
resources:
  # In conjunction with a VPC
  primaryVpcDs:
    type: alicloud:vpc:Network
    name: primary_vpc_ds
variables:
  # Filter security groups and print the results into a file
  secGroupsDs:
    fn::invoke:
      Function: alicloud:ecs:getSecurityGroups
      Arguments:
        nameRegex: ^web-
        outputFile: web_access.json
  primarySecGroupsDs:
    fn::invoke:
      Function: alicloud:ecs:getSecurityGroups
      Arguments:
        vpcId: ${primaryVpcDs.id}
outputs:
  firstGroupId: ${primarySecGroupsDs.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?: InvokeOptions): 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,
                        page_number: Optional[int] = None,
                        page_size: Optional[int] = None,
                        resource_group_id: Optional[str] = None,
                        tags: Optional[Mapping[str, Any]] = None,
                        vpc_id: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetSecurityGroupsResult
def get_security_groups_output(enable_details: Optional[pulumi.Input[bool]] = None,
                        ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                        name_regex: Optional[pulumi.Input[str]] = None,
                        output_file: Optional[pulumi.Input[str]] = None,
                        page_number: Optional[pulumi.Input[int]] = None,
                        page_size: Optional[pulumi.Input[int]] = None,
                        resource_group_id: Optional[pulumi.Input[str]] = None,
                        tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
                        vpc_id: 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)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:ecs/getSecurityGroups:getSecurityGroups
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Enable
Details bool - Ids List<string>
 - A list of Security Group IDs.
 - Name
Regex string - A regex string to filter the resulting security groups by their names.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Page
Number int - Page
Size int - Resource
Group stringId  - The Id of resource group which the security_group belongs.
 - Dictionary<string, object>
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 title="Optional"> <span id="vpcid_csharp">Vpc
Id string- Used to retrieve security groups that belong to the specified VPC ID.
 
- Enable
Details bool - Ids []string
 - A list of Security Group IDs.
 - Name
Regex string - A regex string to filter the resulting security groups by their names.
 - Output
File string - File name where to save data source results (after running 
pulumi preview). - Page
Number int - Page
Size int - Resource
Group stringId  - The Id of resource group which the security_group belongs.
 - map[string]interface{}
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 title="Optional"> <span id="vpcid_go">Vpc
Id string- Used to retrieve security groups that belong to the specified VPC ID.
 
- enable
Details Boolean - ids List<String>
 - A list of Security Group IDs.
 - name
Regex String - A regex string to filter the resulting security groups by their names.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - page
Number Integer - page
Size Integer - resource
Group StringId  - The Id of resource group which the security_group belongs.
 - Map<String,Object>
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 title="Optional"> <span id="vpcid_java">vpc
Id String- Used to retrieve security groups that belong to the specified VPC ID.
 
- enable
Details boolean - ids string[]
 - A list of Security Group IDs.
 - name
Regex string - A regex string to filter the resulting security groups by their names.
 - output
File string - File name where to save data source results (after running 
pulumi preview). - page
Number number - page
Size number - resource
Group stringId  - The Id of resource group which the security_group belongs.
 - {[key: string]: any}
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 title="Optional"> <span id="vpcid_nodejs">vpc
Id string- Used to retrieve security groups that belong to the specified VPC ID.
 
- enable_
details bool - ids Sequence[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 - File name where to save data source results (after running 
pulumi preview). - page_
number int - page_
size int - resource_
group_ strid  - The Id of resource group which the security_group belongs.
 - Mapping[str, Any]
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 title="Optional"> <span id="vpc_id_python">vpc_
id str- Used to retrieve security groups that belong to the specified VPC ID.
 
- enable
Details Boolean - ids List<String>
 - A list of Security Group IDs.
 - name
Regex String - A regex string to filter the resulting security groups by their names.
 - output
File String - File name where to save data source results (after running 
pulumi preview). - page
Number Number - page
Size Number - resource
Group StringId  - The Id of resource group which the security_group belongs.
 - Map<Any>
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 title="Optional"> <span id="vpcid_yaml">vpc
Id String- Used to retrieve security groups that belong to the specified VPC ID.
 
getSecurityGroups Result
The following output properties are available:
- Groups
List<Pulumi.
Ali Cloud. Ecs. Outputs. Get Security Groups Group>  - 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.
 - Total
Count int - Enable
Details bool - Name
Regex string - Output
File string - Page
Number int - Page
Size int - Resource
Group stringId  - The Id of resource group which the security_group belongs.
 - Dictionary<string, object>
 - A map of tags assigned to the ECS instance.
 - Vpc
Id string - The ID of the VPC that owns the security group.
 
- Groups
[]Get
Security Groups Group  - 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.
 - Total
Count int - Enable
Details bool - Name
Regex string - Output
File string - Page
Number int - Page
Size int - Resource
Group stringId  - The Id of resource group which the security_group belongs.
 - map[string]interface{}
 - A map of tags assigned to the ECS instance.
 - Vpc
Id string - The ID of the VPC that owns the security group.
 
- groups
List<Get
Security Groups Group>  - 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.
 - total
Count Integer - enable
Details Boolean - name
Regex String - output
File String - page
Number Integer - page
Size Integer - resource
Group StringId  - The Id of resource group which the security_group belongs.
 - Map<String,Object>
 - A map of tags assigned to the ECS instance.
 - vpc
Id String - The ID of the VPC that owns the security group.
 
- groups
Get
Security Groups Group[]  - 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.
 - total
Count number - enable
Details boolean - name
Regex string - output
File string - page
Number number - page
Size number - resource
Group stringId  - The Id of resource group which the security_group belongs.
 - {[key: string]: any}
 - A map of tags assigned to the ECS instance.
 - vpc
Id string - The ID of the VPC that owns the security group.
 
- groups
Sequence[Get
Security Groups Group]  - A list of Security Groups. Each element contains the following attributes:
 - 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.
 - total_
count int - enable_
details bool - name_
regex str - output_
file str - page_
number int - page_
size int - resource_
group_ strid  - The Id of resource group which the security_group belongs.
 - Mapping[str, Any]
 - A map of tags assigned to the ECS instance.
 - vpc_
id str - The ID of the VPC that owns the security group.
 
- groups List<Property Map>
 - 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.
 - total
Count Number - enable
Details Boolean - name
Regex String - output
File String - page
Number Number - page
Size Number - resource
Group StringId  - The Id of resource group which the security_group belongs.
 - Map<Any>
 - A map of tags assigned to the ECS instance.
 - vpc
Id String - The ID of the VPC that owns the security group.
 
Supporting Types
GetSecurityGroupsGroup   
- Creation
Time string - Creation time of the security group.
 - Description string
 - The description of the security group.
 - Id string
 - The ID of the security group.
 - Inner
Access bool - Whether to allow inner network access.
 - Name string
 - The name of the security group.
 - Resource
Group stringId  - The Id of resource group which the security_group belongs.
 - Security
Group stringType  - The type of the security group.
 - Vpc
Id string - Used to retrieve security groups that belong to the specified VPC ID.
 - Dictionary<string, object>
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 
- Creation
Time string - Creation time of the security group.
 - Description string
 - The description of the security group.
 - Id string
 - The ID of the security group.
 - Inner
Access bool - Whether to allow inner network access.
 - Name string
 - The name of the security group.
 - Resource
Group stringId  - The Id of resource group which the security_group belongs.
 - Security
Group stringType  - The type of the security group.
 - Vpc
Id string - Used to retrieve security groups that belong to the specified VPC ID.
 - map[string]interface{}
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 
- creation
Time String - Creation time of the security group.
 - description String
 - The description of the security group.
 - id String
 - The ID of the security group.
 - inner
Access Boolean - Whether to allow inner network access.
 - name String
 - The name of the security group.
 - resource
Group StringId  - The Id of resource group which the security_group belongs.
 - security
Group StringType  - The type of the security group.
 - vpc
Id String - Used to retrieve security groups that belong to the specified VPC ID.
 - Map<String,Object>
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 
- creation
Time string - Creation time of the security group.
 - description string
 - The description of the security group.
 - id string
 - The ID of the security group.
 - inner
Access boolean - Whether to allow inner network access.
 - name string
 - The name of the security group.
 - resource
Group stringId  - The Id of resource group which the security_group belongs.
 - security
Group stringType  - The type of the security group.
 - vpc
Id string - Used to retrieve security groups that belong to the specified VPC ID.
 - {[key: string]: any}
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: 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_ strid  - The Id of resource group which the security_group belongs.
 - security_
group_ strtype  - The type of the security group.
 - vpc_
id str - Used to retrieve security groups that belong to the specified VPC ID.
 - Mapping[str, Any]
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 
- creation
Time String - Creation time of the security group.
 - description String
 - The description of the security group.
 - id String
 - The ID of the security group.
 - inner
Access Boolean - Whether to allow inner network access.
 - name String
 - The name of the security group.
 - resource
Group StringId  - The Id of resource group which the security_group belongs.
 - security
Group StringType  - The type of the security group.
 - vpc
Id String - Used to retrieve security groups that belong to the specified VPC ID.
 - Map<Any>
 - A map of tags assigned to the ECS instances. It must be in the format:
import * as pulumi from "@pulumi/pulumi"; import * as alicloud from "@pulumi/alicloud";const taggedSecurityGroups = alicloud.ecs.getSecurityGroups({ tags: { tagKey1: "tagValue1", tagKey2: "tagValue2", }, });
import pulumi import pulumi_alicloud as alicloud tagged_security_groups = alicloud.ecs.get_security_groups(tags={ "tagKey1": "tagValue1", "tagKey2": "tagValue2", })using System.Collections.Generic; using System.Linq; using Pulumi; using AliCloud = Pulumi.AliCloud; return await Deployment.RunAsync(() => { var taggedSecurityGroups = AliCloud.Ecs.GetSecurityGroups.Invoke(new() { Tags = { { "tagKey1", "tagValue1" }, { "tagKey2", "tagValue2" }, }, }); });package main import ( "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" ) func main() { pulumi.Run(func(ctx *pulumi.Context) error { _, err := ecs.GetSecurityGroups(ctx, &ecs.GetSecurityGroupsArgs{ Tags: map[string]interface{}{ "tagKey1": "tagValue1", "tagKey2": "tagValue2", }, }, 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.alicloud.ecs.EcsFunctions; import com.pulumi.alicloud.ecs.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 taggedSecurityGroups = EcsFunctions.getSecurityGroups(GetSecurityGroupsArgs.builder() .tags(Map.ofEntries( Map.entry("tagKey1", "tagValue1"), Map.entry("tagKey2", "tagValue2") )) .build()); } }variables: taggedSecurityGroups: fn::invoke: Function: alicloud:ecs:getSecurityGroups Arguments: tags: tagKey1: tagValue1 tagKey2: tagValue2 
Package Details
- Repository
 - Alibaba Cloud pulumi/pulumi-alicloud
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
alicloudTerraform Provider.