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.
- Name
Regex string A regex string to filter the resulting security groups by their names.
- Output
File string - 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:
data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" { tags = { tagKey1 = "tagValue1", tagKey2 = "tagValue2" } }- Vpc
Id string Used to retrieve security groups that belong to the specified VPC ID.
- 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 - 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:
data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" { tags = { tagKey1 = "tagValue1", tagKey2 = "tagValue2" } }- Vpc
Id string Used to retrieve security groups that belong to the specified VPC ID.
- 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 - 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:
data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" { tags = { tagKey1 = "tagValue1", tagKey2 = "tagValue2" } }- vpc
Id 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_ strid The Id of resource group which the security_group belongs.
- 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.
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.
- Name
Regex string - Output
File string - 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.
- Name
Regex string - Output
File string - 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
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.
- name
Regex string - output
File string - 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
List[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 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_ strid The Id of resource group which the security_group belongs.
- 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.
- 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:
data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" { 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:
data "alicloud.ecs.getSecurityGroups" "taggedSecurityGroups" { 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:
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_ 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.
- 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
alicloudTerraform Provider.