AWS Classic
getPrefixList
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var privateS3VpcEndpoint = new Aws.Ec2.VpcEndpoint("privateS3VpcEndpoint", new Aws.Ec2.VpcEndpointArgs
{
VpcId = aws_vpc.Foo.Id,
ServiceName = "com.amazonaws.us-west-2.s3",
});
var privateS3PrefixList = Aws.Ec2.GetPrefixList.Invoke(new Aws.Ec2.GetPrefixListInvokeArgs
{
PrefixListId = privateS3VpcEndpoint.PrefixListId,
});
var bar = new Aws.Ec2.NetworkAcl("bar", new Aws.Ec2.NetworkAclArgs
{
VpcId = aws_vpc.Foo.Id,
});
var privateS3NetworkAclRule = new Aws.Ec2.NetworkAclRule("privateS3NetworkAclRule", new Aws.Ec2.NetworkAclRuleArgs
{
NetworkAclId = bar.Id,
RuleNumber = 200,
Egress = false,
Protocol = "tcp",
RuleAction = "allow",
CidrBlock = privateS3PrefixList.Apply(privateS3PrefixList => privateS3PrefixList.CidrBlocks?[0]),
FromPort = 443,
ToPort = 443,
});
}
}
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 {
privateS3VpcEndpoint, err := ec2.NewVpcEndpoint(ctx, "privateS3VpcEndpoint", &ec2.VpcEndpointArgs{
VpcId: pulumi.Any(aws_vpc.Foo.Id),
ServiceName: pulumi.String("com.amazonaws.us-west-2.s3"),
})
if err != nil {
return err
}
privateS3PrefixList := ec2.GetPrefixListOutput(ctx, ec2.GetPrefixListOutputArgs{
PrefixListId: privateS3VpcEndpoint.PrefixListId,
}, nil)
bar, err := ec2.NewNetworkAcl(ctx, "bar", &ec2.NetworkAclArgs{
VpcId: pulumi.Any(aws_vpc.Foo.Id),
})
if err != nil {
return err
}
_, err = ec2.NewNetworkAclRule(ctx, "privateS3NetworkAclRule", &ec2.NetworkAclRuleArgs{
NetworkAclId: bar.ID(),
RuleNumber: pulumi.Int(200),
Egress: pulumi.Bool(false),
Protocol: pulumi.String("tcp"),
RuleAction: pulumi.String("allow"),
CidrBlock: privateS3PrefixList.ApplyT(func(privateS3PrefixList ec2.GetPrefixListResult) (string, error) {
return privateS3PrefixList.CidrBlocks[0], nil
}).(pulumi.StringOutput),
FromPort: pulumi.Int(443),
ToPort: pulumi.Int(443),
})
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) {
var privateS3VpcEndpoint = new VpcEndpoint("privateS3VpcEndpoint", VpcEndpointArgs.builder()
.vpcId(aws_vpc.getFoo().getId())
.serviceName("com.amazonaws.us-west-2.s3")
.build());
final var privateS3PrefixList = Ec2Functions.getPrefixList(GetPrefixListArgs.builder()
.prefixListId(privateS3VpcEndpoint.getPrefixListId())
.build());
var bar = new NetworkAcl("bar", NetworkAclArgs.builder()
.vpcId(aws_vpc.getFoo().getId())
.build());
var privateS3NetworkAclRule = new NetworkAclRule("privateS3NetworkAclRule", NetworkAclRuleArgs.builder()
.networkAclId(bar.getId())
.ruleNumber(200)
.egress(false)
.protocol("tcp")
.ruleAction("allow")
.cidrBlock(privateS3PrefixList.apply(getPrefixListResult -> getPrefixListResult).apply(privateS3PrefixList -> privateS3PrefixList.apply(getPrefixListResult -> getPrefixListResult.getCidrBlocks()[0])))
.fromPort(443)
.toPort(443)
.build());
}
}
import pulumi
import pulumi_aws as aws
private_s3_vpc_endpoint = aws.ec2.VpcEndpoint("privateS3VpcEndpoint",
vpc_id=aws_vpc["foo"]["id"],
service_name="com.amazonaws.us-west-2.s3")
private_s3_prefix_list = aws.ec2.get_prefix_list_output(prefix_list_id=private_s3_vpc_endpoint.prefix_list_id)
bar = aws.ec2.NetworkAcl("bar", vpc_id=aws_vpc["foo"]["id"])
private_s3_network_acl_rule = aws.ec2.NetworkAclRule("privateS3NetworkAclRule",
network_acl_id=bar.id,
rule_number=200,
egress=False,
protocol="tcp",
rule_action="allow",
cidr_block=private_s3_prefix_list.cidr_blocks[0],
from_port=443,
to_port=443)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const privateS3VpcEndpoint = new aws.ec2.VpcEndpoint("privateS3VpcEndpoint", {
vpcId: aws_vpc.foo.id,
serviceName: "com.amazonaws.us-west-2.s3",
});
const privateS3PrefixList = aws.ec2.getPrefixListOutput({
prefixListId: privateS3VpcEndpoint.prefixListId,
});
const bar = new aws.ec2.NetworkAcl("bar", {vpcId: aws_vpc.foo.id});
const privateS3NetworkAclRule = new aws.ec2.NetworkAclRule("privateS3NetworkAclRule", {
networkAclId: bar.id,
ruleNumber: 200,
egress: false,
protocol: "tcp",
ruleAction: "allow",
cidrBlock: privateS3PrefixList.apply(privateS3PrefixList => privateS3PrefixList.cidrBlocks?[0]),
fromPort: 443,
toPort: 443,
});
resources:
privateS3VpcEndpoint:
type: aws:ec2:VpcEndpoint
properties:
vpcId: ${aws_vpc.foo.id}
serviceName: com.amazonaws.us-west-2.s3
bar:
type: aws:ec2:NetworkAcl
properties:
vpcId: ${aws_vpc.foo.id}
privateS3NetworkAclRule:
type: aws:ec2:NetworkAclRule
properties:
networkAclId: ${bar.id}
ruleNumber: 200
egress: false
protocol: tcp
ruleAction: allow
cidrBlock: ${privateS3PrefixList.cidrBlocks[0]}
fromPort: 443
toPort: 443
variables:
privateS3PrefixList:
Fn::Invoke:
Function: aws:ec2:getPrefixList
Arguments:
prefixListId: ${privateS3VpcEndpoint.prefixListId}
Filter
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var test = Output.Create(Aws.Ec2.GetPrefixList.InvokeAsync(new Aws.Ec2.GetPrefixListArgs
{
Filters =
{
new Aws.Ec2.Inputs.GetPrefixListFilterArgs
{
Name = "prefix-list-id",
Values =
{
"pl-68a54001",
},
},
},
}));
}
}
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.GetPrefixList(ctx, &ec2.GetPrefixListArgs{
Filters: []ec2.GetPrefixListFilter{
ec2.GetPrefixListFilter{
Name: "prefix-list-id",
Values: []string{
"pl-68a54001",
},
},
},
}, 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.getPrefixList(GetPrefixListArgs.builder()
.filters(GetPrefixListFilter.builder()
.name("prefix-list-id")
.values("pl-68a54001")
.build())
.build()));
}
}
import pulumi
import pulumi_aws as aws
test = aws.ec2.get_prefix_list(filters=[aws.ec2.GetPrefixListFilterArgs(
name="prefix-list-id",
values=["pl-68a54001"],
)])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = pulumi.output(aws.ec2.getPrefixList({
filters: [{
name: "prefix-list-id",
values: ["pl-68a54001"],
}],
}));
variables:
test:
Fn::Invoke:
Function: aws:ec2:getPrefixList
Arguments:
filters:
- name: prefix-list-id
values:
- pl-68a54001
Using getPrefixList
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 getPrefixList(args: GetPrefixListArgs, opts?: InvokeOptions): Promise<GetPrefixListResult>
function getPrefixListOutput(args: GetPrefixListOutputArgs, opts?: InvokeOptions): Output<GetPrefixListResult>
def get_prefix_list(filters: Optional[Sequence[GetPrefixListFilter]] = None,
name: Optional[str] = None,
prefix_list_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPrefixListResult
def get_prefix_list_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetPrefixListFilterArgs]]]] = None,
name: Optional[pulumi.Input[str]] = None,
prefix_list_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPrefixListResult]
func GetPrefixList(ctx *Context, args *GetPrefixListArgs, opts ...InvokeOption) (*GetPrefixListResult, error)
func GetPrefixListOutput(ctx *Context, args *GetPrefixListOutputArgs, opts ...InvokeOption) GetPrefixListResultOutput
> Note: This function is named GetPrefixList
in the Go SDK.
public static class GetPrefixList
{
public static Task<GetPrefixListResult> InvokeAsync(GetPrefixListArgs args, InvokeOptions? opts = null)
public static Output<GetPrefixListResult> Invoke(GetPrefixListInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetPrefixListResult> getPrefixList(GetPrefixListArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
Function: aws:ec2/getPrefixList:getPrefixList
Arguments:
# Arguments dictionary
The following arguments are supported:
- Filters
List<Pulumi.
Aws. Ec2. Inputs. Get Prefix List Filter> Configuration block(s) for filtering. Detailed below.
- Name string
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API Reference.
- Prefix
List stringId The ID of the prefix list to select.
- Filters
[]Get
Prefix List Filter Configuration block(s) for filtering. Detailed below.
- Name string
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API Reference.
- Prefix
List stringId The ID of the prefix list to select.
- filters
List
Prefix List Filter> Configuration block(s) for filtering. Detailed below.
- name String
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API Reference.
- prefix
List StringId The ID of the prefix list to select.
- filters
Get
Prefix List Filter[] Configuration block(s) for filtering. Detailed below.
- name string
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API Reference.
- prefix
List stringId The ID of the prefix list to select.
- filters
Sequence[Get
Prefix List Filter] Configuration block(s) for filtering. Detailed below.
- name str
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API Reference.
- prefix_
list_ strid The ID of the prefix list to select.
- filters
List
Configuration block(s) for filtering. Detailed below.
- name String
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API Reference.
- prefix
List StringId The ID of the prefix list to select.
getPrefixList Result
The following output properties are available:
- Cidr
Blocks List<string> The list of CIDR blocks for the AWS service associated with the prefix list.
- Id string
The provider-assigned unique ID for this managed resource.
- Name string
The name of the selected prefix list.
- Filters
List<Pulumi.
Aws. Ec2. Outputs. Get Prefix List Filter> - Prefix
List stringId
- Cidr
Blocks []string The list of CIDR blocks for the AWS service associated with the prefix list.
- Id string
The provider-assigned unique ID for this managed resource.
- Name string
The name of the selected prefix list.
- Filters
[]Get
Prefix List Filter - Prefix
List stringId
- cidr
Blocks List The list of CIDR blocks for the AWS service associated with the prefix list.
- id String
The provider-assigned unique ID for this managed resource.
- name String
The name of the selected prefix list.
- filters
List
Prefix List Filter> - prefix
List StringId
- cidr
Blocks string[] The list of CIDR blocks for the AWS service associated with the prefix list.
- id string
The provider-assigned unique ID for this managed resource.
- name string
The name of the selected prefix list.
- filters
Get
Prefix List Filter[] - prefix
List stringId
- cidr_
blocks Sequence[str] The list of CIDR blocks for the AWS service associated with the prefix list.
- id str
The provider-assigned unique ID for this managed resource.
- name str
The name of the selected prefix list.
- filters
Sequence[Get
Prefix List Filter] - prefix_
list_ strid
- cidr
Blocks List The list of CIDR blocks for the AWS service associated with the prefix list.
- id String
The provider-assigned unique ID for this managed resource.
- name String
The name of the selected prefix list.
- filters
List
- prefix
List StringId
Supporting Types
GetPrefixListFilter
- Name string
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API 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
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API 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
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API Reference.
- values
List
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
- name string
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API 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
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API 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
The name of the filter field. Valid values can be found in the EC2 DescribePrefixLists API Reference.
- values
List
Set of values that are accepted for the given filter field. Results will be selected if any given value matches.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.