cloudflare.StaticRoute
Explore with Pulumi AI
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",
description: "New route for new prefix 192.0.2.0/24",
prefix: "192.0.2.0/24",
nexthop: "10.0.0.0",
priority: 100,
weight: 10,
coloNames: ["den01"],
coloRegions: ["APAC"],
});
import pulumi
import pulumi_cloudflare as cloudflare
example = cloudflare.StaticRoute("example",
account_id="f037e56e89293a057740de681ac9abbe",
description="New route for new prefix 192.0.2.0/24",
prefix="192.0.2.0/24",
nexthop="10.0.0.0",
priority=100,
weight=10,
colo_names=["den01"],
colo_regions=["APAC"])
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"),
Description: pulumi.String("New route for new prefix 192.0.2.0/24"),
Prefix: pulumi.String("192.0.2.0/24"),
Nexthop: pulumi.String("10.0.0.0"),
Priority: pulumi.Int(100),
Weight: pulumi.Int(10),
ColoNames: pulumi.StringArray{
pulumi.String("den01"),
},
ColoRegions: pulumi.StringArray{
pulumi.String("APAC"),
},
})
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",
Description = "New route for new prefix 192.0.2.0/24",
Prefix = "192.0.2.0/24",
Nexthop = "10.0.0.0",
Priority = 100,
Weight = 10,
ColoNames = new[]
{
"den01",
},
ColoRegions = new[]
{
"APAC",
},
});
});
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")
.description("New route for new prefix 192.0.2.0/24")
.prefix("192.0.2.0/24")
.nexthop("10.0.0.0")
.priority(100)
.weight(10)
.coloNames("den01")
.coloRegions("APAC")
.build());
}
}
resources:
example:
type: cloudflare:StaticRoute
properties:
accountId: f037e56e89293a057740de681ac9abbe
description: New route for new prefix 192.0.2.0/24
prefix: 192.0.2.0/24
nexthop: 10.0.0.0
priority: 100
weight: 10
coloNames:
- den01
coloRegions:
- APAC
Create StaticRoute Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new StaticRoute(name: string, args: StaticRouteArgs, opts?: CustomResourceOptions);
@overload
def StaticRoute(resource_name: str,
args: StaticRouteArgs,
opts: Optional[ResourceOptions] = None)
@overload
def StaticRoute(resource_name: str,
opts: Optional[ResourceOptions] = None,
nexthop: Optional[str] = None,
prefix: Optional[str] = None,
priority: Optional[int] = None,
account_id: Optional[str] = None,
colo_names: Optional[Sequence[str]] = None,
colo_regions: Optional[Sequence[str]] = None,
description: Optional[str] = None,
weight: Optional[int] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var staticRouteResource = new Cloudflare.StaticRoute("staticRouteResource", new()
{
Nexthop = "string",
Prefix = "string",
Priority = 0,
AccountId = "string",
ColoNames = new[]
{
"string",
},
ColoRegions = new[]
{
"string",
},
Description = "string",
Weight = 0,
});
example, err := cloudflare.NewStaticRoute(ctx, "staticRouteResource", &cloudflare.StaticRouteArgs{
Nexthop: pulumi.String("string"),
Prefix: pulumi.String("string"),
Priority: pulumi.Int(0),
AccountId: pulumi.String("string"),
ColoNames: pulumi.StringArray{
pulumi.String("string"),
},
ColoRegions: pulumi.StringArray{
pulumi.String("string"),
},
Description: pulumi.String("string"),
Weight: pulumi.Int(0),
})
var staticRouteResource = new StaticRoute("staticRouteResource", StaticRouteArgs.builder()
.nexthop("string")
.prefix("string")
.priority(0)
.accountId("string")
.coloNames("string")
.coloRegions("string")
.description("string")
.weight(0)
.build());
static_route_resource = cloudflare.StaticRoute("staticRouteResource",
nexthop="string",
prefix="string",
priority=0,
account_id="string",
colo_names=["string"],
colo_regions=["string"],
description="string",
weight=0)
const staticRouteResource = new cloudflare.StaticRoute("staticRouteResource", {
nexthop: "string",
prefix: "string",
priority: 0,
accountId: "string",
coloNames: ["string"],
coloRegions: ["string"],
description: "string",
weight: 0,
});
type: cloudflare:StaticRoute
properties:
accountId: string
coloNames:
- string
coloRegions:
- string
description: string
nexthop: string
prefix: string
priority: 0
weight: 0
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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.
- Account
Id string - The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- Colo
Names List<string> - List of Cloudflare colocation regions for this static route.
- Colo
Regions 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.
- Account
Id string - The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- Colo
Names []string - List of Cloudflare colocation regions for this static route.
- Colo
Regions []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.
- account
Id String - The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- colo
Names List<String> - List of Cloudflare colocation regions for this static route.
- colo
Regions 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.
- account
Id string - The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- colo
Names string[] - List of Cloudflare colocation regions for this static route.
- colo
Regions 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.
- account
Id String - The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- colo
Names List<String> - List of Cloudflare colocation regions for this static route.
- colo
Regions 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.
- Account
Id string - The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- Colo
Names List<string> - List of Cloudflare colocation regions for this static route.
- Colo
Regions 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.
- Account
Id string - The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- Colo
Names []string - List of Cloudflare colocation regions for this static route.
- Colo
Regions []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.
- account
Id String - The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- colo
Names List<String> - List of Cloudflare colocation regions for this static route.
- colo
Regions 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.
- account
Id string - The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- colo
Names string[] - List of Cloudflare colocation regions for this static route.
- colo
Regions 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.
- account
Id String - The account identifier to target for the resource. Modifying this attribute will force creation of a new resource.
- colo
Names List<String> - List of Cloudflare colocation regions for this static route.
- colo
Regions 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>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Cloudflare pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflare
Terraform Provider.