Viewing docs for AWS v7.55.0
published on Friday, Nov 13, 2026 by Pulumi
published on Friday, Nov 13, 2026 by Pulumi
Viewing docs for AWS v7.55.0
published on Friday, Nov 13, 2026 by Pulumi
published on Friday, Nov 13, 2026 by Pulumi
This resource can be useful for getting back a set of security group rule IDs.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.vpc.getSecurityGroupRules({
filters: [{
name: "group-id",
values: [securityGroupId],
}],
});
import pulumi
import pulumi_aws as aws
example = aws.vpc.get_security_group_rules(filters=[{
"name": "group-id",
"values": [security_group_id],
}])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/vpc"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := vpc.GetSecurityGroupRules(ctx, &vpc.GetSecurityGroupRulesArgs{
Filters: []vpc.GetSecurityGroupRulesFilter{
{
Name: "group-id",
Values: []string{
securityGroupId,
},
},
},
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.Vpc.GetSecurityGroupRules.Invoke(new()
{
Filters = new[]
{
new Aws.Vpc.Inputs.GetSecurityGroupRulesFilterInputArgs
{
Name = "group-id",
Values = new[]
{
securityGroupId,
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.vpc.VpcFunctions;
import com.pulumi.aws.vpc.inputs.GetSecurityGroupRulesArgs;
import com.pulumi.aws.vpc.inputs.GetSecurityGroupRulesFilterArgs;
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 example = VpcFunctions.getSecurityGroupRules(GetSecurityGroupRulesArgs.builder()
.filters(GetSecurityGroupRulesFilterArgs.builder()
.name("group-id")
.values(securityGroupId)
.build())
.build());
}
}
variables:
example:
fn::invoke:
function: aws:vpc:getSecurityGroupRules
arguments:
filters:
- name: group-id
values:
- ${securityGroupId}
terraform {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_vpc_security_group_rules" "example" {
filter {
name = "group-id"
values = [securityGroupId]
}
}
Using getSecurityGroupRules
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 getSecurityGroupRules(args: GetSecurityGroupRulesArgs, opts?: InvokeOptions): Promise<GetSecurityGroupRulesResult>
function getSecurityGroupRulesOutput(args: GetSecurityGroupRulesOutputArgs, opts?: InvokeOutputOptions): Output<GetSecurityGroupRulesResult>def get_security_group_rules(filters: Optional[Sequence[GetSecurityGroupRulesFilter]] = None,
region: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetSecurityGroupRulesResult
def get_security_group_rules_output(filters: pulumi.Input[Optional[Sequence[pulumi.Input[GetSecurityGroupRulesFilterArgs]]]] = None,
region: pulumi.Input[Optional[str]] = None,
tags: pulumi.Input[Optional[Mapping[str, pulumi.Input[str]]]] = None,
opts: Optional[InvokeOutputOptions] = None) -> Output[GetSecurityGroupRulesResult]func GetSecurityGroupRules(ctx *Context, args *GetSecurityGroupRulesArgs, opts ...InvokeOption) (*GetSecurityGroupRulesResult, error)
func GetSecurityGroupRulesOutput(ctx *Context, args *GetSecurityGroupRulesOutputArgs, opts ...InvokeOption) GetSecurityGroupRulesResultOutput> Note: This function is named GetSecurityGroupRules in the Go SDK.
public static class GetSecurityGroupRules
{
public static Task<GetSecurityGroupRulesResult> InvokeAsync(GetSecurityGroupRulesArgs args, InvokeOptions? opts = null)
public static Output<GetSecurityGroupRulesResult> Invoke(GetSecurityGroupRulesInvokeArgs args, InvokeOptions? opts = null)
public static Output<GetSecurityGroupRulesResult> Invoke(GetSecurityGroupRulesInvokeArgs args, InvokeOutputOptions opts)
}public static CompletableFuture<GetSecurityGroupRulesResult> getSecurityGroupRules(GetSecurityGroupRulesArgs args, InvokeOptions options)
public static Output<GetSecurityGroupRulesResult> getSecurityGroupRules(GetSecurityGroupRulesArgs args, InvokeOptions options)
public static Output<GetSecurityGroupRulesResult> getSecurityGroupRules(GetSecurityGroupRulesArgs args, InvokeOutputOptions options)
fn::invoke:
function: aws:vpc/getSecurityGroupRules:getSecurityGroupRules
arguments:
# arguments dictionarydata "aws_vpc_get_security_group_rules" "name" {
# arguments
}The following arguments are supported:
- Filters
List<Get
Security Group Rules Filter> - Custom filter block as described below.
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Dictionary<string, string>
- Map of tags, each pair of which must exactly match a pair on the desired security group rule.
- Filters
[]Get
Security Group Rules Filter - Custom filter block as described below.
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- map[string]string
- Map of tags, each pair of which must exactly match a pair on the desired security group rule.
- filters list(object)
- Custom filter block as described below.
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- map(string)
- Map of tags, each pair of which must exactly match a pair on the desired security group rule.
- filters
List<Get
Security Group Rules Filter> - Custom filter block as described below.
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Map<String,String>
- Map of tags, each pair of which must exactly match a pair on the desired security group rule.
- filters
Get
Security Group Rules Filter[] - Custom filter block as described below.
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- {[key: string]: string}
- Map of tags, each pair of which must exactly match a pair on the desired security group rule.
- filters
Sequence[Get
Security Group Rules Filter] - Custom filter block as described below.
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Mapping[str, str]
- Map of tags, each pair of which must exactly match a pair on the desired security group rule.
- filters List<Property Map>
- Custom filter block as described below.
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Map<String>
- Map of tags, each pair of which must exactly match a pair on the desired security group rule.
getSecurityGroupRules Result
The following output properties are available:
- Id string
- Ids List<string>
- List of all the security group rule IDs found.
- Region string
- Filters
List<Get
Security Group Rules Filter> - Dictionary<string, string>
- Id string
- Ids []string
- List of all the security group rule IDs found.
- Region string
- Filters
[]Get
Security Group Rules Filter - map[string]string
- id string
- ids list(string)
- List of all the security group rule IDs found.
- region string
- filters list(object)
- map(string)
- id String
- ids List<String>
- List of all the security group rule IDs found.
- region String
- filters
List<Get
Security Group Rules Filter> - Map<String,String>
- id string
- ids string[]
- List of all the security group rule IDs found.
- region string
- filters
Get
Security Group Rules Filter[] - {[key: string]: string}
- id str
- ids Sequence[str]
- List of all the security group rule IDs found.
- region str
- filters
Sequence[Get
Security Group Rules Filter] - Mapping[str, str]
- id String
- ids List<String>
- List of all the security group rule IDs found.
- region String
- filters List<Property Map>
- Map<String>
Supporting Types
GetSecurityGroupRulesFilter
- Name string
- Name of the field to filter by, as defined by the underlying AWS API.
- Values List<string>
- Set of values that are accepted for the given field.
- Name string
- Name of the field to filter by, as defined by the underlying AWS API.
- Values []string
- Set of values that are accepted for the given field.
- name string
- Name of the field to filter by, as defined by the underlying AWS API.
- values list(string)
- Set of values that are accepted for the given field.
- name String
- Name of the field to filter by, as defined by the underlying AWS API.
- values List<String>
- Set of values that are accepted for the given field.
- name string
- Name of the field to filter by, as defined by the underlying AWS API.
- values string[]
- Set of values that are accepted for the given field.
- name str
- Name of the field to filter by, as defined by the underlying AWS API.
- values Sequence[str]
- Set of values that are accepted for the given field.
- name String
- Name of the field to filter by, as defined by the underlying AWS API.
- values List<String>
- Set of values that are accepted for the given field.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
Viewing docs for AWS v7.55.0
published on Friday, Nov 13, 2026 by Pulumi
published on Friday, Nov 13, 2026 by Pulumi