ovh.IpLoadBalancing.HttpRouteRule
Explore with Pulumi AI
Manage rules for HTTP route.
Example Usage
Route which redirect all URL to HTTPs for example.com (Vhost).
import * as pulumi from "@pulumi/pulumi";
import * as ovh from "@ovhcloud/pulumi-ovh";
const httpsredirect = new ovh.iploadbalancing.HttpRoute("httpsredirect", {
action: {
status: 302,
target: "https://${host}${path}${arguments}",
type: "redirect",
},
displayName: "Redirect to HTTPS",
frontendId: 11111,
serviceName: "loadbalancer-xxxxxxxxxxxxxxxxxx",
weight: 1,
});
const examplerule = new ovh.iploadbalancing.HttpRouteRule("examplerule", {
displayName: "Match example.com host",
field: "host",
match: "is",
negate: false,
pattern: "example.com",
routeId: httpsredirect.id,
serviceName: "loadbalancer-xxxxxxxxxxxxxxxxxx",
});
import pulumi
import pulumi_ovh as ovh
httpsredirect = ovh.ip_load_balancing.HttpRoute("httpsredirect",
action={
"status": 302,
"target": "https://${host}${path}${arguments}",
"type": "redirect",
},
display_name="Redirect to HTTPS",
frontend_id=11111,
service_name="loadbalancer-xxxxxxxxxxxxxxxxxx",
weight=1)
examplerule = ovh.ip_load_balancing.HttpRouteRule("examplerule",
display_name="Match example.com host",
field="host",
match="is",
negate=False,
pattern="example.com",
route_id=httpsredirect.id,
service_name="loadbalancer-xxxxxxxxxxxxxxxxxx")
package main
import (
"github.com/ovh/pulumi-ovh/sdk/go/ovh/IpLoadBalancing"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
httpsredirect, err := IpLoadBalancing.NewHttpRoute(ctx, "httpsredirect", &IpLoadBalancing.HttpRouteArgs{
Action: &iploadbalancing.HttpRouteActionArgs{
Status: pulumi.Int(302),
Target: pulumi.String("https://${host}${path}${arguments}"),
Type: pulumi.String("redirect"),
},
DisplayName: pulumi.String("Redirect to HTTPS"),
FrontendId: pulumi.Int(11111),
ServiceName: pulumi.String("loadbalancer-xxxxxxxxxxxxxxxxxx"),
Weight: pulumi.Int(1),
})
if err != nil {
return err
}
_, err = IpLoadBalancing.NewHttpRouteRule(ctx, "examplerule", &IpLoadBalancing.HttpRouteRuleArgs{
DisplayName: pulumi.String("Match example.com host"),
Field: pulumi.String("host"),
Match: pulumi.String("is"),
Negate: pulumi.Bool(false),
Pattern: pulumi.String("example.com"),
RouteId: httpsredirect.ID(),
ServiceName: pulumi.String("loadbalancer-xxxxxxxxxxxxxxxxxx"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ovh = Pulumi.Ovh;
return await Deployment.RunAsync(() =>
{
var httpsredirect = new Ovh.IpLoadBalancing.HttpRoute("httpsredirect", new()
{
Action = new Ovh.IpLoadBalancing.Inputs.HttpRouteActionArgs
{
Status = 302,
Target = "https://${host}${path}${arguments}",
Type = "redirect",
},
DisplayName = "Redirect to HTTPS",
FrontendId = 11111,
ServiceName = "loadbalancer-xxxxxxxxxxxxxxxxxx",
Weight = 1,
});
var examplerule = new Ovh.IpLoadBalancing.HttpRouteRule("examplerule", new()
{
DisplayName = "Match example.com host",
Field = "host",
Match = "is",
Negate = false,
Pattern = "example.com",
RouteId = httpsredirect.Id,
ServiceName = "loadbalancer-xxxxxxxxxxxxxxxxxx",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ovh.IpLoadBalancing.HttpRoute;
import com.pulumi.ovh.IpLoadBalancing.HttpRouteArgs;
import com.pulumi.ovh.IpLoadBalancing.inputs.HttpRouteActionArgs;
import com.pulumi.ovh.IpLoadBalancing.HttpRouteRule;
import com.pulumi.ovh.IpLoadBalancing.HttpRouteRuleArgs;
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 httpsredirect = new HttpRoute("httpsredirect", HttpRouteArgs.builder()
.action(HttpRouteActionArgs.builder()
.status(302)
.target("https://${host}${path}${arguments}")
.type("redirect")
.build())
.displayName("Redirect to HTTPS")
.frontendId(11111)
.serviceName("loadbalancer-xxxxxxxxxxxxxxxxxx")
.weight(1)
.build());
var examplerule = new HttpRouteRule("examplerule", HttpRouteRuleArgs.builder()
.displayName("Match example.com host")
.field("host")
.match("is")
.negate(false)
.pattern("example.com")
.routeId(httpsredirect.id())
.serviceName("loadbalancer-xxxxxxxxxxxxxxxxxx")
.build());
}
}
resources:
httpsredirect:
type: ovh:IpLoadBalancing:HttpRoute
properties:
action:
status: 302
target: https://${host}${path}${arguments}
type: redirect
displayName: Redirect to HTTPS
frontendId: 11111
serviceName: loadbalancer-xxxxxxxxxxxxxxxxxx
weight: 1
examplerule:
type: ovh:IpLoadBalancing:HttpRouteRule
properties:
displayName: Match example.com host
field: host
match: is
negate: false
pattern: example.com
routeId: ${httpsredirect.id}
serviceName: loadbalancer-xxxxxxxxxxxxxxxxxx
Rule which match a specific header (same effect as the host match above).
import * as pulumi from "@pulumi/pulumi";
import * as ovh from "@ovhcloud/pulumi-ovh";
const examplerule = new ovh.iploadbalancing.HttpRouteRule("examplerule", {
displayName: "Match example.com Host header",
field: "headers",
match: "is",
negate: false,
pattern: "example.com",
routeId: ovh_iploadbalancing_http_route.httpsredirect.id,
serviceName: "loadbalancer-xxxxxxxxxxxxxxxxxx",
subField: "Host",
});
import pulumi
import pulumi_ovh as ovh
examplerule = ovh.ip_load_balancing.HttpRouteRule("examplerule",
display_name="Match example.com Host header",
field="headers",
match="is",
negate=False,
pattern="example.com",
route_id=ovh_iploadbalancing_http_route["httpsredirect"]["id"],
service_name="loadbalancer-xxxxxxxxxxxxxxxxxx",
sub_field="Host")
package main
import (
"github.com/ovh/pulumi-ovh/sdk/go/ovh/IpLoadBalancing"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := IpLoadBalancing.NewHttpRouteRule(ctx, "examplerule", &IpLoadBalancing.HttpRouteRuleArgs{
DisplayName: pulumi.String("Match example.com Host header"),
Field: pulumi.String("headers"),
Match: pulumi.String("is"),
Negate: pulumi.Bool(false),
Pattern: pulumi.String("example.com"),
RouteId: pulumi.Any(ovh_iploadbalancing_http_route.Httpsredirect.Id),
ServiceName: pulumi.String("loadbalancer-xxxxxxxxxxxxxxxxxx"),
SubField: pulumi.String("Host"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ovh = Pulumi.Ovh;
return await Deployment.RunAsync(() =>
{
var examplerule = new Ovh.IpLoadBalancing.HttpRouteRule("examplerule", new()
{
DisplayName = "Match example.com Host header",
Field = "headers",
Match = "is",
Negate = false,
Pattern = "example.com",
RouteId = ovh_iploadbalancing_http_route.Httpsredirect.Id,
ServiceName = "loadbalancer-xxxxxxxxxxxxxxxxxx",
SubField = "Host",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ovh.IpLoadBalancing.HttpRouteRule;
import com.pulumi.ovh.IpLoadBalancing.HttpRouteRuleArgs;
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 examplerule = new HttpRouteRule("examplerule", HttpRouteRuleArgs.builder()
.displayName("Match example.com Host header")
.field("headers")
.match("is")
.negate(false)
.pattern("example.com")
.routeId(ovh_iploadbalancing_http_route.httpsredirect().id())
.serviceName("loadbalancer-xxxxxxxxxxxxxxxxxx")
.subField("Host")
.build());
}
}
resources:
examplerule:
type: ovh:IpLoadBalancing:HttpRouteRule
properties:
displayName: Match example.com Host header
field: headers
match: is
negate: false
pattern: example.com
routeId: ${ovh_iploadbalancing_http_route.httpsredirect.id}
serviceName: loadbalancer-xxxxxxxxxxxxxxxxxx
subField: Host
Create HttpRouteRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new HttpRouteRule(name: string, args: HttpRouteRuleArgs, opts?: CustomResourceOptions);
@overload
def HttpRouteRule(resource_name: str,
args: HttpRouteRuleInitArgs,
opts: Optional[ResourceOptions] = None)
@overload
def HttpRouteRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
field: Optional[str] = None,
match: Optional[str] = None,
route_id: Optional[str] = None,
service_name: Optional[str] = None,
display_name: Optional[str] = None,
negate: Optional[bool] = None,
pattern: Optional[str] = None,
sub_field: Optional[str] = None)
func NewHttpRouteRule(ctx *Context, name string, args HttpRouteRuleArgs, opts ...ResourceOption) (*HttpRouteRule, error)
public HttpRouteRule(string name, HttpRouteRuleArgs args, CustomResourceOptions? opts = null)
public HttpRouteRule(String name, HttpRouteRuleArgs args)
public HttpRouteRule(String name, HttpRouteRuleArgs args, CustomResourceOptions options)
type: ovh:IpLoadBalancing:HttpRouteRule
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 HttpRouteRuleArgs
- 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 HttpRouteRuleInitArgs
- 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 HttpRouteRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args HttpRouteRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args HttpRouteRuleArgs
- 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 httpRouteRuleResource = new Ovh.IpLoadBalancing.HttpRouteRule("httpRouteRuleResource", new()
{
Field = "string",
Match = "string",
RouteId = "string",
ServiceName = "string",
DisplayName = "string",
Negate = false,
Pattern = "string",
SubField = "string",
});
example, err := IpLoadBalancing.NewHttpRouteRule(ctx, "httpRouteRuleResource", &IpLoadBalancing.HttpRouteRuleArgs{
Field: pulumi.String("string"),
Match: pulumi.String("string"),
RouteId: pulumi.String("string"),
ServiceName: pulumi.String("string"),
DisplayName: pulumi.String("string"),
Negate: pulumi.Bool(false),
Pattern: pulumi.String("string"),
SubField: pulumi.String("string"),
})
var httpRouteRuleResource = new HttpRouteRule("httpRouteRuleResource", HttpRouteRuleArgs.builder()
.field("string")
.match("string")
.routeId("string")
.serviceName("string")
.displayName("string")
.negate(false)
.pattern("string")
.subField("string")
.build());
http_route_rule_resource = ovh.ip_load_balancing.HttpRouteRule("httpRouteRuleResource",
field="string",
match="string",
route_id="string",
service_name="string",
display_name="string",
negate=False,
pattern="string",
sub_field="string")
const httpRouteRuleResource = new ovh.iploadbalancing.HttpRouteRule("httpRouteRuleResource", {
field: "string",
match: "string",
routeId: "string",
serviceName: "string",
displayName: "string",
negate: false,
pattern: "string",
subField: "string",
});
type: ovh:IpLoadBalancing:HttpRouteRule
properties:
displayName: string
field: string
match: string
negate: false
pattern: string
routeId: string
serviceName: string
subField: string
HttpRouteRule 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 HttpRouteRule resource accepts the following input properties:
- Field string
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- Match string
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- Route
Id string - The route to apply this rule
- Service
Name string - The internal name of your IP load balancing
- Display
Name string - Human readable name for your rule, this field is for you
- Negate bool
- Invert the matching operator effect
- Pattern string
- Value to match against this match. Interpretation if this field depends on the match and field
- Sub
Field string - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
- Field string
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- Match string
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- Route
Id string - The route to apply this rule
- Service
Name string - The internal name of your IP load balancing
- Display
Name string - Human readable name for your rule, this field is for you
- Negate bool
- Invert the matching operator effect
- Pattern string
- Value to match against this match. Interpretation if this field depends on the match and field
- Sub
Field string - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
- field String
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- match String
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- route
Id String - The route to apply this rule
- service
Name String - The internal name of your IP load balancing
- display
Name String - Human readable name for your rule, this field is for you
- negate Boolean
- Invert the matching operator effect
- pattern String
- Value to match against this match. Interpretation if this field depends on the match and field
- sub
Field String - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
- field string
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- match string
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- route
Id string - The route to apply this rule
- service
Name string - The internal name of your IP load balancing
- display
Name string - Human readable name for your rule, this field is for you
- negate boolean
- Invert the matching operator effect
- pattern string
- Value to match against this match. Interpretation if this field depends on the match and field
- sub
Field string - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
- field str
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- match str
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- route_
id str - The route to apply this rule
- service_
name str - The internal name of your IP load balancing
- display_
name str - Human readable name for your rule, this field is for you
- negate bool
- Invert the matching operator effect
- pattern str
- Value to match against this match. Interpretation if this field depends on the match and field
- sub_
field str - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
- field String
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- match String
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- route
Id String - The route to apply this rule
- service
Name String - The internal name of your IP load balancing
- display
Name String - Human readable name for your rule, this field is for you
- negate Boolean
- Invert the matching operator effect
- pattern String
- Value to match against this match. Interpretation if this field depends on the match and field
- sub
Field String - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
Outputs
All input properties are implicitly available as output properties. Additionally, the HttpRouteRule 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 HttpRouteRule Resource
Get an existing HttpRouteRule 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?: HttpRouteRuleState, opts?: CustomResourceOptions): HttpRouteRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
display_name: Optional[str] = None,
field: Optional[str] = None,
match: Optional[str] = None,
negate: Optional[bool] = None,
pattern: Optional[str] = None,
route_id: Optional[str] = None,
service_name: Optional[str] = None,
sub_field: Optional[str] = None) -> HttpRouteRule
func GetHttpRouteRule(ctx *Context, name string, id IDInput, state *HttpRouteRuleState, opts ...ResourceOption) (*HttpRouteRule, error)
public static HttpRouteRule Get(string name, Input<string> id, HttpRouteRuleState? state, CustomResourceOptions? opts = null)
public static HttpRouteRule get(String name, Output<String> id, HttpRouteRuleState 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.
- Display
Name string - Human readable name for your rule, this field is for you
- Field string
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- Match string
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- Negate bool
- Invert the matching operator effect
- Pattern string
- Value to match against this match. Interpretation if this field depends on the match and field
- Route
Id string - The route to apply this rule
- Service
Name string - The internal name of your IP load balancing
- Sub
Field string - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
- Display
Name string - Human readable name for your rule, this field is for you
- Field string
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- Match string
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- Negate bool
- Invert the matching operator effect
- Pattern string
- Value to match against this match. Interpretation if this field depends on the match and field
- Route
Id string - The route to apply this rule
- Service
Name string - The internal name of your IP load balancing
- Sub
Field string - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
- display
Name String - Human readable name for your rule, this field is for you
- field String
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- match String
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- negate Boolean
- Invert the matching operator effect
- pattern String
- Value to match against this match. Interpretation if this field depends on the match and field
- route
Id String - The route to apply this rule
- service
Name String - The internal name of your IP load balancing
- sub
Field String - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
- display
Name string - Human readable name for your rule, this field is for you
- field string
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- match string
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- negate boolean
- Invert the matching operator effect
- pattern string
- Value to match against this match. Interpretation if this field depends on the match and field
- route
Id string - The route to apply this rule
- service
Name string - The internal name of your IP load balancing
- sub
Field string - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
- display_
name str - Human readable name for your rule, this field is for you
- field str
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- match str
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- negate bool
- Invert the matching operator effect
- pattern str
- Value to match against this match. Interpretation if this field depends on the match and field
- route_
id str - The route to apply this rule
- service_
name str - The internal name of your IP load balancing
- sub_
field str - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
- display
Name String - Human readable name for your rule, this field is for you
- field String
- Name of the field to match like "protocol" or "host". See "/ipLoadbalancing/{serviceName}/availableRouteRules" for a list of available rules
- match String
- Matching operator. Not all operators are available for all fields. See "/ipLoadbalancing/{serviceName}/availableRouteRules"
- negate Boolean
- Invert the matching operator effect
- pattern String
- Value to match against this match. Interpretation if this field depends on the match and field
- route
Id String - The route to apply this rule
- service
Name String - The internal name of your IP load balancing
- sub
Field String - Name of sub-field, if applicable. This may be a Cookie or Header name for instance
Import
HTTP route rule can be imported using the following format service_name
, the id
of the route and the id
of the rule separated by “/” e.g.
$ terraform import ovh_iploadbalancing_http_route_rule.examplerule service_name/route_id/rule_id
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- ovh ovh/pulumi-ovh
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
ovh
Terraform Provider.