Try AWS Native preview for resources not in the classic version.
aws.vpc.getSecurityGroupRules
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
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<Get
Security Group Rules Filter> - Custom filter block as described below.
- 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
[]Get
Security Group Rules Filter - Custom filter block as described below.
- 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<Get
Security Group Rules Filter> - Custom filter block as described below.
- 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
Get
Security Group Rules Filter[] - Custom filter block as described below.
- {[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[Get
Security Group Rules Filter] - Custom filter block as described below.
- 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.
- 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<Get
Security Group Rules Filter> - Dictionary<string, string>
- Id string
- Ids []string
- List of all the security group rule IDs found.
- Filters
[]Get
Security Group Rules Filter - map[string]string
- id String
- ids List<String>
- List of all the security group rule IDs found.
- filters
List<Get
Security Group Rules Filter> - Map<String,String>
- id string
- ids string[]
- List of all the security group rule IDs found.
- filters
Get
Security Group Rules Filter[] - {[key: string]: string}
- id str
- ids Sequence[str]
- List of all the security group rule IDs found.
- filters
Sequence[Get
Security Group Rules Filter] - Mapping[str, str]
- id String
- ids List<String>
- List of all the security group rule IDs found.
- 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. 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.
Try AWS Native preview for resources not in the classic version.