1. Packages
  2. Packages
  3. ElasticCloud (EC) Provider
  4. API Docs
  5. ServerlessTrafficFilter
Viewing docs for ElasticCloud (EC) v0.10.11
published on Tuesday, Apr 21, 2026 by Pulumi
ec logo
Viewing docs for ElasticCloud (EC) v0.10.11
published on Tuesday, Apr 21, 2026 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ec from "@pulumi/ec";
    
    const example = new ec.ServerlessTrafficFilter("example", {
        name: "my-serverless-traffic-filter",
        region: "aws-us-east-1",
        type: "ip",
        description: "Allow traffic from the office network",
        includeByDefault: false,
        rules: [{
            source: "203.0.113.0/24",
            description: "Office egress",
        }],
    });
    
    import pulumi
    import pulumi_ec as ec
    
    example = ec.ServerlessTrafficFilter("example",
        name="my-serverless-traffic-filter",
        region="aws-us-east-1",
        type="ip",
        description="Allow traffic from the office network",
        include_by_default=False,
        rules=[{
            "source": "203.0.113.0/24",
            "description": "Office egress",
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-ec/sdk/go/ec"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ec.NewServerlessTrafficFilter(ctx, "example", &ec.ServerlessTrafficFilterArgs{
    			Name:             pulumi.String("my-serverless-traffic-filter"),
    			Region:           pulumi.String("aws-us-east-1"),
    			Type:             pulumi.String("ip"),
    			Description:      pulumi.String("Allow traffic from the office network"),
    			IncludeByDefault: pulumi.Bool(false),
    			Rules: ec.ServerlessTrafficFilterRuleArray{
    				&ec.ServerlessTrafficFilterRuleArgs{
    					Source:      pulumi.String("203.0.113.0/24"),
    					Description: pulumi.String("Office egress"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using ElasticCloud = Pulumi.ElasticCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new ElasticCloud.Index.ServerlessTrafficFilter("example", new()
        {
            Name = "my-serverless-traffic-filter",
            Region = "aws-us-east-1",
            Type = "ip",
            Description = "Allow traffic from the office network",
            IncludeByDefault = false,
            Rules = new[]
            {
                new ElasticCloud.Inputs.ServerlessTrafficFilterRuleArgs
                {
                    Source = "203.0.113.0/24",
                    Description = "Office egress",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ec.ServerlessTrafficFilter;
    import com.pulumi.ec.ServerlessTrafficFilterArgs;
    import com.pulumi.ec.inputs.ServerlessTrafficFilterRuleArgs;
    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) {
            var example = new ServerlessTrafficFilter("example", ServerlessTrafficFilterArgs.builder()
                .name("my-serverless-traffic-filter")
                .region("aws-us-east-1")
                .type("ip")
                .description("Allow traffic from the office network")
                .includeByDefault(false)
                .rules(ServerlessTrafficFilterRuleArgs.builder()
                    .source("203.0.113.0/24")
                    .description("Office egress")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: ec:ServerlessTrafficFilter
        properties:
          name: my-serverless-traffic-filter
          region: aws-us-east-1
          type: ip
          description: Allow traffic from the office network
          includeByDefault: false
          rules:
            - source: 203.0.113.0/24
              description: Office egress
    

    Create ServerlessTrafficFilter Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ServerlessTrafficFilter(name: string, args: ServerlessTrafficFilterArgs, opts?: CustomResourceOptions);
    @overload
    def ServerlessTrafficFilter(resource_name: str,
                                args: ServerlessTrafficFilterArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServerlessTrafficFilter(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                region: Optional[str] = None,
                                type: Optional[str] = None,
                                description: Optional[str] = None,
                                include_by_default: Optional[bool] = None,
                                name: Optional[str] = None,
                                rules: Optional[Sequence[ServerlessTrafficFilterRuleArgs]] = None)
    func NewServerlessTrafficFilter(ctx *Context, name string, args ServerlessTrafficFilterArgs, opts ...ResourceOption) (*ServerlessTrafficFilter, error)
    public ServerlessTrafficFilter(string name, ServerlessTrafficFilterArgs args, CustomResourceOptions? opts = null)
    public ServerlessTrafficFilter(String name, ServerlessTrafficFilterArgs args)
    public ServerlessTrafficFilter(String name, ServerlessTrafficFilterArgs args, CustomResourceOptions options)
    
    type: ec:ServerlessTrafficFilter
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ServerlessTrafficFilterArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ServerlessTrafficFilterArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ServerlessTrafficFilterArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServerlessTrafficFilterArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServerlessTrafficFilterArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var serverlessTrafficFilterResource = new ElasticCloud.ServerlessTrafficFilter("serverlessTrafficFilterResource", new()
    {
        Region = "string",
        Type = "string",
        Description = "string",
        IncludeByDefault = false,
        Name = "string",
        Rules = new[]
        {
            new ElasticCloud.Inputs.ServerlessTrafficFilterRuleArgs
            {
                Source = "string",
                Description = "string",
            },
        },
    });
    
    example, err := ec.NewServerlessTrafficFilter(ctx, "serverlessTrafficFilterResource", &ec.ServerlessTrafficFilterArgs{
    	Region:           pulumi.String("string"),
    	Type:             pulumi.String("string"),
    	Description:      pulumi.String("string"),
    	IncludeByDefault: pulumi.Bool(false),
    	Name:             pulumi.String("string"),
    	Rules: ec.ServerlessTrafficFilterRuleArray{
    		&ec.ServerlessTrafficFilterRuleArgs{
    			Source:      pulumi.String("string"),
    			Description: pulumi.String("string"),
    		},
    	},
    })
    
    var serverlessTrafficFilterResource = new ServerlessTrafficFilter("serverlessTrafficFilterResource", ServerlessTrafficFilterArgs.builder()
        .region("string")
        .type("string")
        .description("string")
        .includeByDefault(false)
        .name("string")
        .rules(ServerlessTrafficFilterRuleArgs.builder()
            .source("string")
            .description("string")
            .build())
        .build());
    
    serverless_traffic_filter_resource = ec.ServerlessTrafficFilter("serverlessTrafficFilterResource",
        region="string",
        type="string",
        description="string",
        include_by_default=False,
        name="string",
        rules=[{
            "source": "string",
            "description": "string",
        }])
    
    const serverlessTrafficFilterResource = new ec.ServerlessTrafficFilter("serverlessTrafficFilterResource", {
        region: "string",
        type: "string",
        description: "string",
        includeByDefault: false,
        name: "string",
        rules: [{
            source: "string",
            description: "string",
        }],
    });
    
    type: ec:ServerlessTrafficFilter
    properties:
        description: string
        includeByDefault: false
        name: string
        region: string
        rules:
            - description: string
              source: string
        type: string
    

    ServerlessTrafficFilter Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ServerlessTrafficFilter resource accepts the following input properties:

    Region string
    The traffic filter can be attached only to projects in the specific region
    Type string
    Type of the traffic filter
    Description string
    Description of the traffic filter
    IncludeByDefault bool
    Should the traffic filter be automatically included in the new projects
    Name string
    Name of the traffic filter
    Rules List<Pulumi.ElasticCloud.Inputs.ServerlessTrafficFilterRule>
    List of rules
    Region string
    The traffic filter can be attached only to projects in the specific region
    Type string
    Type of the traffic filter
    Description string
    Description of the traffic filter
    IncludeByDefault bool
    Should the traffic filter be automatically included in the new projects
    Name string
    Name of the traffic filter
    Rules []ServerlessTrafficFilterRuleArgs
    List of rules
    region String
    The traffic filter can be attached only to projects in the specific region
    type String
    Type of the traffic filter
    description String
    Description of the traffic filter
    includeByDefault Boolean
    Should the traffic filter be automatically included in the new projects
    name String
    Name of the traffic filter
    rules List<ServerlessTrafficFilterRule>
    List of rules
    region string
    The traffic filter can be attached only to projects in the specific region
    type string
    Type of the traffic filter
    description string
    Description of the traffic filter
    includeByDefault boolean
    Should the traffic filter be automatically included in the new projects
    name string
    Name of the traffic filter
    rules ServerlessTrafficFilterRule[]
    List of rules
    region str
    The traffic filter can be attached only to projects in the specific region
    type str
    Type of the traffic filter
    description str
    Description of the traffic filter
    include_by_default bool
    Should the traffic filter be automatically included in the new projects
    name str
    Name of the traffic filter
    rules Sequence[ServerlessTrafficFilterRuleArgs]
    List of rules
    region String
    The traffic filter can be attached only to projects in the specific region
    type String
    Type of the traffic filter
    description String
    Description of the traffic filter
    includeByDefault Boolean
    Should the traffic filter be automatically included in the new projects
    name String
    Name of the traffic filter
    rules List<Property Map>
    List of rules

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ServerlessTrafficFilter resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ServerlessTrafficFilter Resource

    Get an existing ServerlessTrafficFilter resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ServerlessTrafficFilterState, opts?: CustomResourceOptions): ServerlessTrafficFilter
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            include_by_default: Optional[bool] = None,
            name: Optional[str] = None,
            region: Optional[str] = None,
            rules: Optional[Sequence[ServerlessTrafficFilterRuleArgs]] = None,
            type: Optional[str] = None) -> ServerlessTrafficFilter
    func GetServerlessTrafficFilter(ctx *Context, name string, id IDInput, state *ServerlessTrafficFilterState, opts ...ResourceOption) (*ServerlessTrafficFilter, error)
    public static ServerlessTrafficFilter Get(string name, Input<string> id, ServerlessTrafficFilterState? state, CustomResourceOptions? opts = null)
    public static ServerlessTrafficFilter get(String name, Output<String> id, ServerlessTrafficFilterState state, CustomResourceOptions options)
    resources:  _:    type: ec:ServerlessTrafficFilter    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Description string
    Description of the traffic filter
    IncludeByDefault bool
    Should the traffic filter be automatically included in the new projects
    Name string
    Name of the traffic filter
    Region string
    The traffic filter can be attached only to projects in the specific region
    Rules List<Pulumi.ElasticCloud.Inputs.ServerlessTrafficFilterRule>
    List of rules
    Type string
    Type of the traffic filter
    Description string
    Description of the traffic filter
    IncludeByDefault bool
    Should the traffic filter be automatically included in the new projects
    Name string
    Name of the traffic filter
    Region string
    The traffic filter can be attached only to projects in the specific region
    Rules []ServerlessTrafficFilterRuleArgs
    List of rules
    Type string
    Type of the traffic filter
    description String
    Description of the traffic filter
    includeByDefault Boolean
    Should the traffic filter be automatically included in the new projects
    name String
    Name of the traffic filter
    region String
    The traffic filter can be attached only to projects in the specific region
    rules List<ServerlessTrafficFilterRule>
    List of rules
    type String
    Type of the traffic filter
    description string
    Description of the traffic filter
    includeByDefault boolean
    Should the traffic filter be automatically included in the new projects
    name string
    Name of the traffic filter
    region string
    The traffic filter can be attached only to projects in the specific region
    rules ServerlessTrafficFilterRule[]
    List of rules
    type string
    Type of the traffic filter
    description str
    Description of the traffic filter
    include_by_default bool
    Should the traffic filter be automatically included in the new projects
    name str
    Name of the traffic filter
    region str
    The traffic filter can be attached only to projects in the specific region
    rules Sequence[ServerlessTrafficFilterRuleArgs]
    List of rules
    type str
    Type of the traffic filter
    description String
    Description of the traffic filter
    includeByDefault Boolean
    Should the traffic filter be automatically included in the new projects
    name String
    Name of the traffic filter
    region String
    The traffic filter can be attached only to projects in the specific region
    rules List<Property Map>
    List of rules
    type String
    Type of the traffic filter

    Supporting Types

    ServerlessTrafficFilterRule, ServerlessTrafficFilterRuleArgs

    Source string
    Allowed traffic filter source: IP address, CIDR mask, or VPC endpoint ID
    Description string
    Description of the rule.
    Source string
    Allowed traffic filter source: IP address, CIDR mask, or VPC endpoint ID
    Description string
    Description of the rule.
    source String
    Allowed traffic filter source: IP address, CIDR mask, or VPC endpoint ID
    description String
    Description of the rule.
    source string
    Allowed traffic filter source: IP address, CIDR mask, or VPC endpoint ID
    description string
    Description of the rule.
    source str
    Allowed traffic filter source: IP address, CIDR mask, or VPC endpoint ID
    description str
    Description of the rule.
    source String
    Allowed traffic filter source: IP address, CIDR mask, or VPC endpoint ID
    description String
    Description of the rule.

    Import

    Serverless traffic filters can be imported using the id, for example:

    $ pulumi import ec:index/serverlessTrafficFilter:ServerlessTrafficFilter id 320b7b540dfc967a7a649c18e2fce4ed
    

    Note on Credentials The credentials attribute (containing username and password) is only available when the project is first created. When importing an existing project, these credentials will not be available in the Terraform state as the API does not return them on read operations.

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    ec pulumi/pulumi-ec
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ec Terraform Provider.
    ec logo
    Viewing docs for ElasticCloud (EC) v0.10.11
    published on Tuesday, Apr 21, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.