1. Packages
  2. Cloudflare
  3. API Docs
  4. StaticRoute
Cloudflare v5.23.0 published on Monday, Mar 25, 2024 by Pulumi

cloudflare.StaticRoute

Explore with Pulumi AI

cloudflare logo
Cloudflare v5.23.0 published on Monday, Mar 25, 2024 by Pulumi

    Provides a resource, that manages Cloudflare static routes for Magic Transit or Magic WAN. Static routes are used to route traffic through GRE tunnels.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as cloudflare from "@pulumi/cloudflare";
    
    const example = new cloudflare.StaticRoute("example", {
        accountId: "f037e56e89293a057740de681ac9abbe",
        coloNames: ["den01"],
        coloRegions: ["APAC"],
        description: "New route for new prefix 192.0.2.0/24",
        nexthop: "10.0.0.0",
        prefix: "192.0.2.0/24",
        priority: 100,
        weight: 10,
    });
    
    import pulumi
    import pulumi_cloudflare as cloudflare
    
    example = cloudflare.StaticRoute("example",
        account_id="f037e56e89293a057740de681ac9abbe",
        colo_names=["den01"],
        colo_regions=["APAC"],
        description="New route for new prefix 192.0.2.0/24",
        nexthop="10.0.0.0",
        prefix="192.0.2.0/24",
        priority=100,
        weight=10)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudflare.NewStaticRoute(ctx, "example", &cloudflare.StaticRouteArgs{
    			AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
    			ColoNames: pulumi.StringArray{
    				pulumi.String("den01"),
    			},
    			ColoRegions: pulumi.StringArray{
    				pulumi.String("APAC"),
    			},
    			Description: pulumi.String("New route for new prefix 192.0.2.0/24"),
    			Nexthop:     pulumi.String("10.0.0.0"),
    			Prefix:      pulumi.String("192.0.2.0/24"),
    			Priority:    pulumi.Int(100),
    			Weight:      pulumi.Int(10),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Cloudflare = Pulumi.Cloudflare;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Cloudflare.StaticRoute("example", new()
        {
            AccountId = "f037e56e89293a057740de681ac9abbe",
            ColoNames = new[]
            {
                "den01",
            },
            ColoRegions = new[]
            {
                "APAC",
            },
            Description = "New route for new prefix 192.0.2.0/24",
            Nexthop = "10.0.0.0",
            Prefix = "192.0.2.0/24",
            Priority = 100,
            Weight = 10,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.cloudflare.StaticRoute;
    import com.pulumi.cloudflare.StaticRouteArgs;
    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 StaticRoute("example", StaticRouteArgs.builder()        
                .accountId("f037e56e89293a057740de681ac9abbe")
                .coloNames("den01")
                .coloRegions("APAC")
                .description("New route for new prefix 192.0.2.0/24")
                .nexthop("10.0.0.0")
                .prefix("192.0.2.0/24")
                .priority(100)
                .weight(10)
                .build());
    
        }
    }
    
    resources:
      example:
        type: cloudflare:StaticRoute
        properties:
          accountId: f037e56e89293a057740de681ac9abbe
          coloNames:
            - den01
          coloRegions:
            - APAC
          description: New route for new prefix 192.0.2.0/24
          nexthop: 10.0.0.0
          prefix: 192.0.2.0/24
          priority: 100
          weight: 10
    

    Create StaticRoute Resource

    new StaticRoute(name: string, args: StaticRouteArgs, opts?: CustomResourceOptions);
    @overload
    def StaticRoute(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    account_id: Optional[str] = None,
                    colo_names: Optional[Sequence[str]] = None,
                    colo_regions: Optional[Sequence[str]] = None,
                    description: Optional[str] = None,
                    nexthop: Optional[str] = None,
                    prefix: Optional[str] = None,
                    priority: Optional[int] = None,
                    weight: Optional[int] = None)
    @overload
    def StaticRoute(resource_name: str,
                    args: StaticRouteArgs,
                    opts: Optional[ResourceOptions] = None)
    func NewStaticRoute(ctx *Context, name string, args StaticRouteArgs, opts ...ResourceOption) (*StaticRoute, error)
    public StaticRoute(string name, StaticRouteArgs args, CustomResourceOptions? opts = null)
    public StaticRoute(String name, StaticRouteArgs args)
    public StaticRoute(String name, StaticRouteArgs args, CustomResourceOptions options)
    
    type: cloudflare:StaticRoute
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args StaticRouteArgs
    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 StaticRouteArgs
    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 StaticRouteArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args StaticRouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args StaticRouteArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    StaticRoute Resource Properties

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

    Inputs

    The StaticRoute resource accepts the following input properties:

    Nexthop string
    The nexthop IP address where traffic will be routed to.
    Prefix string
    Your network prefix using CIDR notation.
    Priority int
    The priority for the static route.
    AccountId string
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    ColoNames List<string>
    List of Cloudflare colocation regions for this static route.
    ColoRegions List<string>
    List of Cloudflare colocation names for this static route.
    Description string
    Description of the static route.
    Weight int
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.
    Nexthop string
    The nexthop IP address where traffic will be routed to.
    Prefix string
    Your network prefix using CIDR notation.
    Priority int
    The priority for the static route.
    AccountId string
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    ColoNames []string
    List of Cloudflare colocation regions for this static route.
    ColoRegions []string
    List of Cloudflare colocation names for this static route.
    Description string
    Description of the static route.
    Weight int
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.
    nexthop String
    The nexthop IP address where traffic will be routed to.
    prefix String
    Your network prefix using CIDR notation.
    priority Integer
    The priority for the static route.
    accountId String
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    coloNames List<String>
    List of Cloudflare colocation regions for this static route.
    coloRegions List<String>
    List of Cloudflare colocation names for this static route.
    description String
    Description of the static route.
    weight Integer
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.
    nexthop string
    The nexthop IP address where traffic will be routed to.
    prefix string
    Your network prefix using CIDR notation.
    priority number
    The priority for the static route.
    accountId string
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    coloNames string[]
    List of Cloudflare colocation regions for this static route.
    coloRegions string[]
    List of Cloudflare colocation names for this static route.
    description string
    Description of the static route.
    weight number
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.
    nexthop str
    The nexthop IP address where traffic will be routed to.
    prefix str
    Your network prefix using CIDR notation.
    priority int
    The priority for the static route.
    account_id str
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    colo_names Sequence[str]
    List of Cloudflare colocation regions for this static route.
    colo_regions Sequence[str]
    List of Cloudflare colocation names for this static route.
    description str
    Description of the static route.
    weight int
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.
    nexthop String
    The nexthop IP address where traffic will be routed to.
    prefix String
    Your network prefix using CIDR notation.
    priority Number
    The priority for the static route.
    accountId String
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    coloNames List<String>
    List of Cloudflare colocation regions for this static route.
    coloRegions List<String>
    List of Cloudflare colocation names for this static route.
    description String
    Description of the static route.
    weight Number
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the StaticRoute 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 StaticRoute Resource

    Get an existing StaticRoute 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?: StaticRouteState, opts?: CustomResourceOptions): StaticRoute
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            colo_names: Optional[Sequence[str]] = None,
            colo_regions: Optional[Sequence[str]] = None,
            description: Optional[str] = None,
            nexthop: Optional[str] = None,
            prefix: Optional[str] = None,
            priority: Optional[int] = None,
            weight: Optional[int] = None) -> StaticRoute
    func GetStaticRoute(ctx *Context, name string, id IDInput, state *StaticRouteState, opts ...ResourceOption) (*StaticRoute, error)
    public static StaticRoute Get(string name, Input<string> id, StaticRouteState? state, CustomResourceOptions? opts = null)
    public static StaticRoute get(String name, Output<String> id, StaticRouteState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    AccountId string
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    ColoNames List<string>
    List of Cloudflare colocation regions for this static route.
    ColoRegions List<string>
    List of Cloudflare colocation names for this static route.
    Description string
    Description of the static route.
    Nexthop string
    The nexthop IP address where traffic will be routed to.
    Prefix string
    Your network prefix using CIDR notation.
    Priority int
    The priority for the static route.
    Weight int
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.
    AccountId string
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    ColoNames []string
    List of Cloudflare colocation regions for this static route.
    ColoRegions []string
    List of Cloudflare colocation names for this static route.
    Description string
    Description of the static route.
    Nexthop string
    The nexthop IP address where traffic will be routed to.
    Prefix string
    Your network prefix using CIDR notation.
    Priority int
    The priority for the static route.
    Weight int
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.
    accountId String
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    coloNames List<String>
    List of Cloudflare colocation regions for this static route.
    coloRegions List<String>
    List of Cloudflare colocation names for this static route.
    description String
    Description of the static route.
    nexthop String
    The nexthop IP address where traffic will be routed to.
    prefix String
    Your network prefix using CIDR notation.
    priority Integer
    The priority for the static route.
    weight Integer
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.
    accountId string
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    coloNames string[]
    List of Cloudflare colocation regions for this static route.
    coloRegions string[]
    List of Cloudflare colocation names for this static route.
    description string
    Description of the static route.
    nexthop string
    The nexthop IP address where traffic will be routed to.
    prefix string
    Your network prefix using CIDR notation.
    priority number
    The priority for the static route.
    weight number
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.
    account_id str
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    colo_names Sequence[str]
    List of Cloudflare colocation regions for this static route.
    colo_regions Sequence[str]
    List of Cloudflare colocation names for this static route.
    description str
    Description of the static route.
    nexthop str
    The nexthop IP address where traffic will be routed to.
    prefix str
    Your network prefix using CIDR notation.
    priority int
    The priority for the static route.
    weight int
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.
    accountId String
    The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
    coloNames List<String>
    List of Cloudflare colocation regions for this static route.
    coloRegions List<String>
    List of Cloudflare colocation names for this static route.
    description String
    Description of the static route.
    nexthop String
    The nexthop IP address where traffic will be routed to.
    prefix String
    Your network prefix using CIDR notation.
    priority Number
    The priority for the static route.
    weight Number
    The optional weight for ECMP routes. Modifying this attribute will force creation of a new resource.

    Import

    $ pulumi import cloudflare:index/staticRoute:StaticRoute example <account_id>/<static_route_id>
    

    Package Details

    Repository
    Cloudflare pulumi/pulumi-cloudflare
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the cloudflare Terraform Provider.
    cloudflare logo
    Cloudflare v5.23.0 published on Monday, Mar 25, 2024 by Pulumi