AWS Classic
getSecurityGroups
Use this data source to get IDs and VPC membership of Security Groups that are created outside of this provider.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var test = Output.Create(Aws.Ec2.GetSecurityGroups.InvokeAsync(new Aws.Ec2.GetSecurityGroupsArgs
{
Tags =
{
{ "Application", "k8s" },
{ "Environment", "dev" },
},
}));
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.GetSecurityGroups(ctx, &ec2.GetSecurityGroupsArgs{
Tags: map[string]interface{}{
"Application": "k8s",
"Environment": "dev",
},
}, nil)
if err != nil {
return err
}
return nil
})
}
package generated_program;
import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var test = Output.of(Ec2Functions.getSecurityGroups(GetSecurityGroupsArgs.builder()
.tags(Map.ofEntries(
Map.entry("Application", "k8s"),
Map.entry("Environment", "dev")
))
.build()));
}
}
import pulumi
import pulumi_aws as aws
test = aws.ec2.get_security_groups(tags={
"Application": "k8s",
"Environment": "dev",
})
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = pulumi.output(aws.ec2.getSecurityGroups({
tags: {
Application: "k8s",
Environment: "dev",
},
}));
variables:
test:
Fn::Invoke:
Function: aws:ec2:getSecurityGroups
Arguments:
tags:
Application: k8s
Environment: dev
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(filters: Optional[Sequence[GetSecurityGroupsFilter]] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetSecurityGroupsResult
def get_security_groups_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSecurityGroupsFilterArgs]]]] = None,
tags: Optional[pulumi.Input[Mapping[str, 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: aws:ec2/getSecurityGroups:getSecurityGroups
Arguments:
# Arguments dictionary
The following arguments are supported:
- Filters
List<Pulumi.
Aws. Ec2. Inputs. Get Security Groups Filter> One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out [describe-security-groups in the AWS CLI reference][1].
- Dictionary<string, string>
A map of tags, each pair of which must exactly match for desired security groups.
- Filters
[]Get
Security Groups Filter One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out [describe-security-groups in the AWS CLI reference][1].
- map[string]string
A map of tags, each pair of which must exactly match for desired security groups.
- filters
List
Security Groups Filter> One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out [describe-security-groups in the AWS CLI reference][1].
- Map
A map of tags, each pair of which must exactly match for desired security groups.
- filters
Get
Security Groups Filter[] One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out [describe-security-groups in the AWS CLI reference][1].
- {[key: string]: string}
A map of tags, each pair of which must exactly match for desired security groups.
- filters
Sequence[Get
Security Groups Filter] One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out [describe-security-groups in the AWS CLI reference][1].
- Mapping[str, str]
A map of tags, each pair of which must exactly match for desired security groups.
getSecurityGroups Result
The following output properties are available:
- Arns List<string>
ARNs of the matched security groups.
- Id string
The provider-assigned unique ID for this managed resource.
- Ids List<string>
IDs of the matches security groups.
- Dictionary<string, string>
- Vpc
Ids List<string> The VPC IDs of the matched security groups. The data source's tag or filter will span VPCs unless the
vpc-id
filter is also used.- Filters
List<Pulumi.
Aws. Ec2. Outputs. Get Security Groups Filter>
- Arns []string
ARNs of the matched security groups.
- Id string
The provider-assigned unique ID for this managed resource.
- Ids []string
IDs of the matches security groups.
- map[string]string
- Vpc
Ids []string The VPC IDs of the matched security groups. The data source's tag or filter will span VPCs unless the
vpc-id
filter is also used.- Filters
[]Get
Security Groups Filter
- arns
List
ARNs of the matched security groups.
- id String
The provider-assigned unique ID for this managed resource.
- ids
List
IDs of the matches security groups.
- Map
- vpc
Ids List The VPC IDs of the matched security groups. The data source's tag or filter will span VPCs unless the
vpc-id
filter is also used.- filters
List
Security Groups Filter>
- arns string[]
ARNs of the matched security groups.
- id string
The provider-assigned unique ID for this managed resource.
- ids string[]
IDs of the matches security groups.
- {[key: string]: string}
- vpc
Ids string[] The VPC IDs of the matched security groups. The data source's tag or filter will span VPCs unless the
vpc-id
filter is also used.- filters
Get
Security Groups Filter[]
- arns Sequence[str]
ARNs of the matched security groups.
- id str
The provider-assigned unique ID for this managed resource.
- ids Sequence[str]
IDs of the matches security groups.
- Mapping[str, str]
- vpc_
ids Sequence[str] The VPC IDs of the matched security groups. The data source's tag or filter will span VPCs unless the
vpc-id
filter is also used.- filters
Sequence[Get
Security Groups Filter]
- arns
List
ARNs of the matched security groups.
- id String
The provider-assigned unique ID for this managed resource.
- ids
List
IDs of the matches security groups.
- Map
- vpc
Ids List The VPC IDs of the matched security groups. The data source's tag or filter will span VPCs unless the
vpc-id
filter is also used.- filters
List
Supporting Types
GetSecurityGroupsFilter
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.