Service Lb Policies Args
Example Usage
Network Services Service Lb Policies Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const _default = new gcp.networkservices.ServiceLbPolicies("default", {
name: "my-lb-policy",
location: "global",
});
import pulumi
import pulumi_gcp as gcp
default = gcp.networkservices.ServiceLbPolicies("default",
name="my-lb-policy",
location="global")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var @default = new Gcp.NetworkServices.ServiceLbPolicies("default", new()
{
Name = "my-lb-policy",
Location = "global",
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/networkservices"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := networkservices.NewServiceLbPolicies(ctx, "default", &networkservices.ServiceLbPoliciesArgs{
Name: pulumi.String("my-lb-policy"),
Location: pulumi.String("global"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.networkservices.ServiceLbPolicies;
import com.pulumi.gcp.networkservices.ServiceLbPoliciesArgs;
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 default_ = new ServiceLbPolicies("default", ServiceLbPoliciesArgs.builder()
.name("my-lb-policy")
.location("global")
.build());
}
}
resources:
default:
type: gcp:networkservices:ServiceLbPolicies
properties:
name: my-lb-policy
location: global
Network Services Service Lb Policies Advanced
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const _default = new gcp.networkservices.ServiceLbPolicies("default", {
name: "my-lb-policy",
location: "global",
description: "my description",
loadBalancingAlgorithm: "SPRAY_TO_REGION",
autoCapacityDrain: {
enable: true,
},
failoverConfig: {
failoverHealthThreshold: 70,
},
labels: {
foo: "bar",
},
});
const defaultBackendService = new gcp.compute.BackendService("default", {
name: "my-lb-backend",
description: "my description",
loadBalancingScheme: "INTERNAL_SELF_MANAGED",
protocol: "HTTP",
serviceLbPolicy: pulumi.interpolate`//networkservices.googleapis.com/${_default.id}`,
});
import pulumi
import pulumi_gcp as gcp
default = gcp.networkservices.ServiceLbPolicies("default",
name="my-lb-policy",
location="global",
description="my description",
load_balancing_algorithm="SPRAY_TO_REGION",
auto_capacity_drain={
"enable": True,
},
failover_config={
"failover_health_threshold": 70,
},
labels={
"foo": "bar",
})
default_backend_service = gcp.compute.BackendService("default",
name="my-lb-backend",
description="my description",
load_balancing_scheme="INTERNAL_SELF_MANAGED",
protocol="HTTP",
service_lb_policy=default.id.apply(lambda id: f"//networkservices.googleapis.com/{id}"))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var @default = new Gcp.NetworkServices.ServiceLbPolicies("default", new()
{
Name = "my-lb-policy",
Location = "global",
Description = "my description",
LoadBalancingAlgorithm = "SPRAY_TO_REGION",
AutoCapacityDrain = new Gcp.NetworkServices.Inputs.ServiceLbPoliciesAutoCapacityDrainArgs
{
Enable = true,
},
FailoverConfig = new Gcp.NetworkServices.Inputs.ServiceLbPoliciesFailoverConfigArgs
{
FailoverHealthThreshold = 70,
},
Labels =
{
{ "foo", "bar" },
},
});
var defaultBackendService = new Gcp.Compute.BackendService("default", new()
{
Name = "my-lb-backend",
Description = "my description",
LoadBalancingScheme = "INTERNAL_SELF_MANAGED",
Protocol = "HTTP",
ServiceLbPolicy = @default.Id.Apply(id => $"//networkservices.googleapis.com/{id}"),
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/networkservices"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_default, err := networkservices.NewServiceLbPolicies(ctx, "default", &networkservices.ServiceLbPoliciesArgs{
Name: pulumi.String("my-lb-policy"),
Location: pulumi.String("global"),
Description: pulumi.String("my description"),
LoadBalancingAlgorithm: pulumi.String("SPRAY_TO_REGION"),
AutoCapacityDrain: &networkservices.ServiceLbPoliciesAutoCapacityDrainArgs{
Enable: pulumi.Bool(true),
},
FailoverConfig: &networkservices.ServiceLbPoliciesFailoverConfigArgs{
FailoverHealthThreshold: pulumi.Int(70),
},
Labels: pulumi.StringMap{
"foo": pulumi.String("bar"),
},
})
if err != nil {
return err
}
_, err = compute.NewBackendService(ctx, "default", &compute.BackendServiceArgs{
Name: pulumi.String("my-lb-backend"),
Description: pulumi.String("my description"),
LoadBalancingScheme: pulumi.String("INTERNAL_SELF_MANAGED"),
Protocol: pulumi.String("HTTP"),
ServiceLbPolicy: _default.ID().ApplyT(func(id string) (string, error) {
return fmt.Sprintf("//networkservices.googleapis.com/%v", id), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.networkservices.ServiceLbPolicies;
import com.pulumi.gcp.networkservices.ServiceLbPoliciesArgs;
import com.pulumi.gcp.networkservices.inputs.ServiceLbPoliciesAutoCapacityDrainArgs;
import com.pulumi.gcp.networkservices.inputs.ServiceLbPoliciesFailoverConfigArgs;
import com.pulumi.gcp.compute.BackendService;
import com.pulumi.gcp.compute.BackendServiceArgs;
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 default_ = new ServiceLbPolicies("default", ServiceLbPoliciesArgs.builder()
.name("my-lb-policy")
.location("global")
.description("my description")
.loadBalancingAlgorithm("SPRAY_TO_REGION")
.autoCapacityDrain(ServiceLbPoliciesAutoCapacityDrainArgs.builder()
.enable(true)
.build())
.failoverConfig(ServiceLbPoliciesFailoverConfigArgs.builder()
.failoverHealthThreshold(70)
.build())
.labels(Map.of("foo", "bar"))
.build());
var defaultBackendService = new BackendService("defaultBackendService", BackendServiceArgs.builder()
.name("my-lb-backend")
.description("my description")
.loadBalancingScheme("INTERNAL_SELF_MANAGED")
.protocol("HTTP")
.serviceLbPolicy(default_.id().applyValue(_id -> String.format("//networkservices.googleapis.com/%s", _id)))
.build());
}
}
resources:
default:
type: gcp:networkservices:ServiceLbPolicies
properties:
name: my-lb-policy
location: global
description: my description
loadBalancingAlgorithm: SPRAY_TO_REGION
autoCapacityDrain:
enable: true
failoverConfig:
failoverHealthThreshold: 70
labels:
foo: bar
defaultBackendService:
type: gcp:compute:BackendService
name: default
properties:
name: my-lb-backend
description: my description
loadBalancingScheme: INTERNAL_SELF_MANAGED
protocol: HTTP
serviceLbPolicy: //networkservices.googleapis.com/${default.id}
Import
ServiceLbPolicies can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/serviceLbPolicies/{{name}}
{{project}}/{{location}}/{{name}}
{{location}}/{{name}}
When using thepulumi import
command, ServiceLbPolicies can be imported using one of the formats above. For example:
$ pulumi import gcp:networkservices/serviceLbPolicies:ServiceLbPolicies default projects/{{project}}/locations/{{location}}/serviceLbPolicies/{{name}}
$ pulumi import gcp:networkservices/serviceLbPolicies:ServiceLbPolicies default {{project}}/{{location}}/{{name}}
$ pulumi import gcp:networkservices/serviceLbPolicies:ServiceLbPolicies default {{location}}/{{name}}
Constructors
Properties
Option to specify if an unhealthy MIG/NEG should be considered for global load balancing and traffic routing. Structure is documented below.
A free-text description of the resource. Max length 1024 characters.
Option to specify health based failover behavior. This is not related to Network load balancer FailoverPolicy. Structure is documented below.
Set of label tags associated with the ServiceLbPolicy resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels
for all of the labels present on the resource.
The type of load balancing algorithm to be used. The default behavior is WATERFALL_BY_REGION. Possible values are: SPRAY_TO_REGION
, SPRAY_TO_WORLD
, WATERFALL_BY_REGION
, WATERFALL_BY_ZONE
.