get Backend Service
Provide access to a Backend Service's attribute. For more information see the official documentation and the API.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const baz = gcp.compute.getBackendService({
name: "foobar",
});
const _default = new gcp.compute.BackendService("default", {
name: "backend-service",
healthChecks: baz.then(baz => baz.healthChecks?.[0]),
});
Content copied to clipboard
import pulumi
import pulumi_gcp as gcp
baz = gcp.compute.get_backend_service(name="foobar")
default = gcp.compute.BackendService("default",
name="backend-service",
health_checks=baz.health_checks[0])
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var baz = Gcp.Compute.GetBackendService.Invoke(new()
{
Name = "foobar",
});
var @default = new Gcp.Compute.BackendService("default", new()
{
Name = "backend-service",
HealthChecks = baz.Apply(getBackendServiceResult => getBackendServiceResult.HealthChecks[0]),
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
baz, err := compute.LookupBackendService(ctx, &compute.LookupBackendServiceArgs{
Name: "foobar",
}, nil)
if err != nil {
return err
}
_, err = compute.NewBackendService(ctx, "default", &compute.BackendServiceArgs{
Name: pulumi.String("backend-service"),
HealthChecks: pulumi.String(baz.HealthChecks[0]),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetBackendServiceArgs;
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) {
final var baz = ComputeFunctions.getBackendService(GetBackendServiceArgs.builder()
.name("foobar")
.build());
var default_ = new BackendService("default", BackendServiceArgs.builder()
.name("backend-service")
.healthChecks(baz.healthChecks()[0])
.build());
}
}
Content copied to clipboard
resources:
default:
type: gcp:compute:BackendService
properties:
name: backend-service
healthChecks: ${baz.healthChecks[0]}
variables:
baz:
fn::invoke:
function: gcp:compute:getBackendService
arguments:
name: foobar
Content copied to clipboard
Return
A collection of values returned by getBackendService.
Parameters
argument
A collection of arguments for invoking getBackendService.
Return
A collection of values returned by getBackendService.
Parameters
name
The name of the Backend Service.
project
The project in which the resource belongs. If it is not provided, the provider project is used.
See also
suspend fun getBackendService(argument: suspend GetBackendServicePlainArgsBuilder.() -> Unit): GetBackendServiceResult
Return
A collection of values returned by getBackendService.
Parameters
argument
Builder for com.pulumi.gcp.compute.kotlin.inputs.GetBackendServicePlainArgs.