Viewing docs for AWS v7.51.1
published on Friday, Oct 16, 2026 by Pulumi
published on Friday, Oct 16, 2026 by Pulumi
Viewing docs for AWS v7.51.1
published on Friday, Oct 16, 2026 by Pulumi
published on Friday, Oct 16, 2026 by Pulumi
aws.vpc.getSecurityGroupRule provides details about a specific security group rule.
The arguments of this data source act as filters for querying the available security group rules. The given filters must match exactly one security group rule whose data will be exported as attributes.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.vpc.getSecurityGroupRule({
securityGroupRuleId: securityGroupRuleId,
});
import pulumi
import pulumi_aws as aws
example = aws.vpc.get_security_group_rule(security_group_rule_id=security_group_rule_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.GetSecurityGroupRule(ctx, &vpc.GetSecurityGroupRuleArgs{
SecurityGroupRuleId: pulumi.StringRef(securityGroupRuleId),
}, 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.GetSecurityGroupRule.Invoke(new()
{
SecurityGroupRuleId = securityGroupRuleId,
});
});
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.GetSecurityGroupRuleArgs;
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.getSecurityGroupRule(GetSecurityGroupRuleArgs.builder()
.securityGroupRuleId(securityGroupRuleId)
.build());
}
}
variables:
example:
fn::invoke:
function: aws:vpc:getSecurityGroupRule
arguments:
securityGroupRuleId: ${securityGroupRuleId}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_vpc_getsecuritygrouprule" "example" {
security_group_rule_id = securityGroupRuleId
}
Using getSecurityGroupRule
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 getSecurityGroupRule(args: GetSecurityGroupRuleArgs, opts?: InvokeOptions): Promise<GetSecurityGroupRuleResult>
function getSecurityGroupRuleOutput(args: GetSecurityGroupRuleOutputArgs, opts?: InvokeOutputOptions): Output<GetSecurityGroupRuleResult>def get_security_group_rule(filters: Optional[Sequence[GetSecurityGroupRuleFilter]] = None,
region: Optional[str] = None,
security_group_rule_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSecurityGroupRuleResult
def get_security_group_rule_output(filters: pulumi.Input[Optional[Sequence[pulumi.Input[GetSecurityGroupRuleFilterArgs]]]] = None,
region: pulumi.Input[Optional[str]] = None,
security_group_rule_id: pulumi.Input[Optional[str]] = None,
opts: Optional[InvokeOutputOptions] = None) -> Output[GetSecurityGroupRuleResult]func GetSecurityGroupRule(ctx *Context, args *GetSecurityGroupRuleArgs, opts ...InvokeOption) (*GetSecurityGroupRuleResult, error)
func GetSecurityGroupRuleOutput(ctx *Context, args *GetSecurityGroupRuleOutputArgs, opts ...InvokeOption) GetSecurityGroupRuleResultOutput> Note: This function is named GetSecurityGroupRule in the Go SDK.
public static class GetSecurityGroupRule
{
public static Task<GetSecurityGroupRuleResult> InvokeAsync(GetSecurityGroupRuleArgs args, InvokeOptions? opts = null)
public static Output<GetSecurityGroupRuleResult> Invoke(GetSecurityGroupRuleInvokeArgs args, InvokeOptions? opts = null)
public static Output<GetSecurityGroupRuleResult> Invoke(GetSecurityGroupRuleInvokeArgs args, InvokeOutputOptions opts)
}public static CompletableFuture<GetSecurityGroupRuleResult> getSecurityGroupRule(GetSecurityGroupRuleArgs args, InvokeOptions options)
public static Output<GetSecurityGroupRuleResult> getSecurityGroupRule(GetSecurityGroupRuleArgs args, InvokeOptions options)
public static Output<GetSecurityGroupRuleResult> getSecurityGroupRule(GetSecurityGroupRuleArgs args, InvokeOutputOptions options)
fn::invoke:
function: aws:vpc/getSecurityGroupRule:getSecurityGroupRule
arguments:
# arguments dictionarydata "aws_vpc_get_security_group_rule" "name" {
# arguments
}The following arguments are supported:
- Filters
List<Get
Security Group Rule Filter> - Configuration block(s) for filtering. Detailed below.
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Security
Group stringRule Id - ID of the security group rule to select.
- Filters
[]Get
Security Group Rule Filter - Configuration block(s) for filtering. Detailed below.
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Security
Group stringRule Id - ID of the security group rule to select.
- filters list(object)
- Configuration block(s) for filtering. Detailed below.
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- security_
group_ stringrule_ id - ID of the security group rule to select.
- filters
List<Get
Security Group Rule Filter> - Configuration block(s) for filtering. Detailed below.
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- security
Group StringRule Id - ID of the security group rule to select.
- filters
Get
Security Group Rule Filter[] - Configuration block(s) for filtering. Detailed below.
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- security
Group stringRule Id - ID of the security group rule to select.
- filters
Sequence[Get
Security Group Rule Filter] - Configuration block(s) for filtering. Detailed below.
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- security_
group_ strrule_ id - ID of the security group rule to select.
- filters List<Property Map>
- Configuration block(s) for filtering. Detailed below.
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- security
Group StringRule Id - ID of the security group rule to select.
getSecurityGroupRule Result
The following output properties are available:
- Arn string
- ARN of the security group rule.
- Cidr
Ipv4 string - Destination IPv4 CIDR range.
- Cidr
Ipv6 string - Destination IPv6 CIDR range.
- Description string
- Security group rule description.
- From
Port int - Start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
- Id string
- Ip
Protocol string - IP protocol name or number. Use
-1to specify all protocols. - Is
Egress bool - Whether the security group rule is an outbound rule.
- Prefix
List stringId - ID of the destination prefix list.
- Referenced
Security stringGroup Id - Destination security group that is referenced in the rule.
- Region string
- Security
Group stringId - ID of the security group.
- Security
Group stringRule Id - Dictionary<string, string>
- Map of tags assigned to the resource.
- To
Port int - End of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
- Filters
List<Get
Security Group Rule Filter>
- Arn string
- ARN of the security group rule.
- Cidr
Ipv4 string - Destination IPv4 CIDR range.
- Cidr
Ipv6 string - Destination IPv6 CIDR range.
- Description string
- Security group rule description.
- From
Port int - Start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
- Id string
- Ip
Protocol string - IP protocol name or number. Use
-1to specify all protocols. - Is
Egress bool - Whether the security group rule is an outbound rule.
- Prefix
List stringId - ID of the destination prefix list.
- Referenced
Security stringGroup Id - Destination security group that is referenced in the rule.
- Region string
- Security
Group stringId - ID of the security group.
- Security
Group stringRule Id - map[string]string
- Map of tags assigned to the resource.
- To
Port int - End of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
- Filters
[]Get
Security Group Rule Filter
- arn string
- ARN of the security group rule.
- cidr_
ipv4 string - Destination IPv4 CIDR range.
- cidr_
ipv6 string - Destination IPv6 CIDR range.
- description string
- Security group rule description.
- from_
port number - Start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
- id string
- ip_
protocol string - IP protocol name or number. Use
-1to specify all protocols. - is_
egress bool - Whether the security group rule is an outbound rule.
- prefix_
list_ stringid - ID of the destination prefix list.
- referenced_
security_ stringgroup_ id - Destination security group that is referenced in the rule.
- region string
- security_
group_ stringid - ID of the security group.
- security_
group_ stringrule_ id - map(string)
- Map of tags assigned to the resource.
- to_
port number - End of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
- filters list(object)
- arn String
- ARN of the security group rule.
- cidr
Ipv4 String - Destination IPv4 CIDR range.
- cidr
Ipv6 String - Destination IPv6 CIDR range.
- description String
- Security group rule description.
- from
Port Integer - Start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
- id String
- ip
Protocol String - IP protocol name or number. Use
-1to specify all protocols. - is
Egress Boolean - Whether the security group rule is an outbound rule.
- prefix
List StringId - ID of the destination prefix list.
- referenced
Security StringGroup Id - Destination security group that is referenced in the rule.
- region String
- security
Group StringId - ID of the security group.
- security
Group StringRule Id - Map<String,String>
- Map of tags assigned to the resource.
- to
Port Integer - End of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
- filters
List<Get
Security Group Rule Filter>
- arn string
- ARN of the security group rule.
- cidr
Ipv4 string - Destination IPv4 CIDR range.
- cidr
Ipv6 string - Destination IPv6 CIDR range.
- description string
- Security group rule description.
- from
Port number - Start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
- id string
- ip
Protocol string - IP protocol name or number. Use
-1to specify all protocols. - is
Egress boolean - Whether the security group rule is an outbound rule.
- prefix
List stringId - ID of the destination prefix list.
- referenced
Security stringGroup Id - Destination security group that is referenced in the rule.
- region string
- security
Group stringId - ID of the security group.
- security
Group stringRule Id - {[key: string]: string}
- Map of tags assigned to the resource.
- to
Port number - End of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
- filters
Get
Security Group Rule Filter[]
- arn str
- ARN of the security group rule.
- cidr_
ipv4 str - Destination IPv4 CIDR range.
- cidr_
ipv6 str - Destination IPv6 CIDR range.
- description str
- Security group rule description.
- from_
port int - Start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
- id str
- ip_
protocol str - IP protocol name or number. Use
-1to specify all protocols. - is_
egress bool - Whether the security group rule is an outbound rule.
- prefix_
list_ strid - ID of the destination prefix list.
- referenced_
security_ strgroup_ id - Destination security group that is referenced in the rule.
- region str
- security_
group_ strid - ID of the security group.
- security_
group_ strrule_ id - Mapping[str, str]
- Map of tags assigned to the resource.
- to_
port int - End of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
- filters
Sequence[Get
Security Group Rule Filter]
- arn String
- ARN of the security group rule.
- cidr
Ipv4 String - Destination IPv4 CIDR range.
- cidr
Ipv6 String - Destination IPv6 CIDR range.
- description String
- Security group rule description.
- from
Port Number - Start of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 type.
- id String
- ip
Protocol String - IP protocol name or number. Use
-1to specify all protocols. - is
Egress Boolean - Whether the security group rule is an outbound rule.
- prefix
List StringId - ID of the destination prefix list.
- referenced
Security StringGroup Id - Destination security group that is referenced in the rule.
- region String
- security
Group StringId - ID of the security group.
- security
Group StringRule Id - Map<String>
- Map of tags assigned to the resource.
- to
Port Number - End of port range for the TCP and UDP protocols, or an ICMP/ICMPv6 code.
- filters List<Property Map>
Supporting Types
GetSecurityGroupRuleFilter
- Name string
- Name of the filter field. Valid values can be found in the EC2
DescribeSecurityGroupRulesAPI Reference. - Values List<string>
- Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
- Name string
- Name of the filter field. Valid values can be found in the EC2
DescribeSecurityGroupRulesAPI Reference. - Values []string
- Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
- name string
- Name of the filter field. Valid values can be found in the EC2
DescribeSecurityGroupRulesAPI Reference. - values list(string)
- Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
- name String
- Name of the filter field. Valid values can be found in the EC2
DescribeSecurityGroupRulesAPI Reference. - values List<String>
- Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
- name string
- Name of the filter field. Valid values can be found in the EC2
DescribeSecurityGroupRulesAPI Reference. - values string[]
- Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
- name str
- Name of the filter field. Valid values can be found in the EC2
DescribeSecurityGroupRulesAPI Reference. - values Sequence[str]
- Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
- name String
- Name of the filter field. Valid values can be found in the EC2
DescribeSecurityGroupRulesAPI Reference. - values List<String>
- Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
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.51.1
published on Friday, Oct 16, 2026 by Pulumi
published on Friday, Oct 16, 2026 by Pulumi