get Forwarding Rule
Get a forwarding rule within GCE from its name.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const my_forwarding_rule = gcp.compute.getForwardingRule({
name: "forwarding-rule-us-east1",
});
Content copied to clipboard
import pulumi
import pulumi_gcp as gcp
my_forwarding_rule = gcp.compute.get_forwarding_rule(name="forwarding-rule-us-east1")
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var my_forwarding_rule = Gcp.Compute.GetForwardingRule.Invoke(new()
{
Name = "forwarding-rule-us-east1",
});
});
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 {
_, err := compute.LookupForwardingRule(ctx, &compute.LookupForwardingRuleArgs{
Name: "forwarding-rule-us-east1",
}, nil)
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.GetForwardingRuleArgs;
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 my-forwarding-rule = ComputeFunctions.getForwardingRule(GetForwardingRuleArgs.builder()
.name("forwarding-rule-us-east1")
.build());
}
}
Content copied to clipboard
variables:
my-forwarding-rule:
fn::invoke:
function: gcp:compute:getForwardingRule
arguments:
name: forwarding-rule-us-east1
Content copied to clipboard
Return
A collection of values returned by getForwardingRule.
Parameters
argument
A collection of arguments for invoking getForwardingRule.
suspend fun getForwardingRule(name: String, project: String? = null, region: String? = null): GetForwardingRuleResult
Return
A collection of values returned by getForwardingRule.
Parameters
name
The name of the forwarding rule.
project
The project in which the resource belongs. If it is not provided, the provider project is used.
region
The region in which the resource belongs. If it is not provided, the project region is used.
See also
suspend fun getForwardingRule(argument: suspend GetForwardingRulePlainArgsBuilder.() -> Unit): GetForwardingRuleResult
Return
A collection of values returned by getForwardingRule.
Parameters
argument
Builder for com.pulumi.gcp.compute.kotlin.inputs.GetForwardingRulePlainArgs.