1. Packages
  2. AWS
  3. API Docs
  4. vpc
  5. getSecurityGroupRules
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

aws.vpc.getSecurityGroupRules

Explore with Pulumi AI

aws logo
AWS v6.54.0 published on Friday, Sep 27, 2024 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/v6/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: interface{}{
    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 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 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}
    

    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?: InvokeOptions): Output<GetSecurityGroupRulesResult>
    def get_security_group_rules(filters: Optional[Sequence[GetSecurityGroupRulesFilter]] = None,
                                 tags: Optional[Mapping[str, str]] = None,
                                 opts: Optional[InvokeOptions] = None) -> GetSecurityGroupRulesResult
    def get_security_group_rules_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSecurityGroupRulesFilterArgs]]]] = None,
                                 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                                 opts: Optional[InvokeOptions] = 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 CompletableFuture<GetSecurityGroupRulesResult> getSecurityGroupRules(GetSecurityGroupRulesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:vpc/getSecurityGroupRules:getSecurityGroupRules
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetSecurityGroupRulesFilter>
    Custom filter block as described below.
    Tags Dictionary<string, string>

    Map of tags, each pair of which must exactly match a pair on the desired security group rule.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    Filters []GetSecurityGroupRulesFilter
    Custom filter block as described below.
    Tags map[string]string

    Map of tags, each pair of which must exactly match a pair on the desired security group rule.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    filters List<GetSecurityGroupRulesFilter>
    Custom filter block as described below.
    tags Map<String,String>

    Map of tags, each pair of which must exactly match a pair on the desired security group rule.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    filters GetSecurityGroupRulesFilter[]
    Custom filter block as described below.
    tags {[key: string]: string}

    Map of tags, each pair of which must exactly match a pair on the desired security group rule.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    filters Sequence[GetSecurityGroupRulesFilter]
    Custom filter block as described below.
    tags Mapping[str, str]

    Map of tags, each pair of which must exactly match a pair on the desired security group rule.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    filters List<Property Map>
    Custom filter block as described below.
    tags Map<String>

    Map of tags, each pair of which must exactly match a pair on the desired security group rule.

    More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

    getSecurityGroupRules Result

    The following output properties are available:

    Id string
    Ids List<string>
    List of all the security group rule IDs found.
    Filters List<GetSecurityGroupRulesFilter>
    Tags Dictionary<string, string>
    Id string
    Ids []string
    List of all the security group rule IDs found.
    Filters []GetSecurityGroupRulesFilter
    Tags map[string]string
    id String
    ids List<String>
    List of all the security group rule IDs found.
    filters List<GetSecurityGroupRulesFilter>
    tags Map<String,String>
    id string
    ids string[]
    List of all the security group rule IDs found.
    filters GetSecurityGroupRulesFilter[]
    tags {[key: string]: string}
    id str
    ids Sequence[str]
    List of all the security group rule IDs found.
    filters Sequence[GetSecurityGroupRulesFilter]
    tags Mapping[str, str]
    id String
    ids List<String>
    List of all the security group rule IDs found.
    filters List<Property Map>
    tags 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. Security group rule IDs will be selected if any one of the given values match.
    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. Security group rule IDs will be selected if any one of the given values match.
    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. Security group rule IDs will be selected if any one of the given values match.
    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. Security group rule IDs will be selected if any one of the given values match.
    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. Security group rule IDs will be selected if any one of the given values match.
    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. Security group rule IDs will be selected if any one of the given values match.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi