gcp.appengine.ApplicationUrlDispatchRules
Explore with Pulumi AI
Rules to match an HTTP request and dispatch that request to a service.
To get more information about ApplicationUrlDispatchRules, see:
Example Usage
App Engine Application Url Dispatch Rules Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const bucket = new gcp.storage.Bucket("bucket", {
name: "appengine-test-bucket",
location: "US",
});
const object = new gcp.storage.BucketObject("object", {
name: "hello-world.zip",
bucket: bucket.name,
source: new pulumi.asset.FileAsset("./test-fixtures/hello-world.zip"),
});
const adminV3 = new gcp.appengine.StandardAppVersion("admin_v3", {
versionId: "v3",
service: "admin",
runtime: "nodejs20",
entrypoint: {
shell: "node ./app.js",
},
deployment: {
zip: {
sourceUrl: pulumi.interpolate`https://storage.googleapis.com/${bucket.name}/${object.name}`,
},
},
envVariables: {
port: "8080",
},
deleteServiceOnDestroy: true,
});
const webService = new gcp.appengine.ApplicationUrlDispatchRules("web_service", {dispatchRules: [
{
domain: "*",
path: "/*",
service: "default",
},
{
domain: "*",
path: "/admin/*",
service: adminV3.service,
},
]});
import pulumi
import pulumi_gcp as gcp
bucket = gcp.storage.Bucket("bucket",
name="appengine-test-bucket",
location="US")
object = gcp.storage.BucketObject("object",
name="hello-world.zip",
bucket=bucket.name,
source=pulumi.FileAsset("./test-fixtures/hello-world.zip"))
admin_v3 = gcp.appengine.StandardAppVersion("admin_v3",
version_id="v3",
service="admin",
runtime="nodejs20",
entrypoint=gcp.appengine.StandardAppVersionEntrypointArgs(
shell="node ./app.js",
),
deployment=gcp.appengine.StandardAppVersionDeploymentArgs(
zip=gcp.appengine.StandardAppVersionDeploymentZipArgs(
source_url=pulumi.Output.all(bucket.name, object.name).apply(lambda bucketName, objectName: f"https://storage.googleapis.com/{bucket_name}/{object_name}"),
),
),
env_variables={
"port": "8080",
},
delete_service_on_destroy=True)
web_service = gcp.appengine.ApplicationUrlDispatchRules("web_service", dispatch_rules=[
gcp.appengine.ApplicationUrlDispatchRulesDispatchRuleArgs(
domain="*",
path="/*",
service="default",
),
gcp.appengine.ApplicationUrlDispatchRulesDispatchRuleArgs(
domain="*",
path="/admin/*",
service=admin_v3.service,
),
])
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/appengine"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
bucket, err := storage.NewBucket(ctx, "bucket", &storage.BucketArgs{
Name: pulumi.String("appengine-test-bucket"),
Location: pulumi.String("US"),
})
if err != nil {
return err
}
object, err := storage.NewBucketObject(ctx, "object", &storage.BucketObjectArgs{
Name: pulumi.String("hello-world.zip"),
Bucket: bucket.Name,
Source: pulumi.NewFileAsset("./test-fixtures/hello-world.zip"),
})
if err != nil {
return err
}
adminV3, err := appengine.NewStandardAppVersion(ctx, "admin_v3", &appengine.StandardAppVersionArgs{
VersionId: pulumi.String("v3"),
Service: pulumi.String("admin"),
Runtime: pulumi.String("nodejs20"),
Entrypoint: &appengine.StandardAppVersionEntrypointArgs{
Shell: pulumi.String("node ./app.js"),
},
Deployment: &appengine.StandardAppVersionDeploymentArgs{
Zip: &appengine.StandardAppVersionDeploymentZipArgs{
SourceUrl: pulumi.All(bucket.Name, object.Name).ApplyT(func(_args []interface{}) (string, error) {
bucketName := _args[0].(string)
objectName := _args[1].(string)
return fmt.Sprintf("https://storage.googleapis.com/%v/%v", bucketName, objectName), nil
}).(pulumi.StringOutput),
},
},
EnvVariables: pulumi.StringMap{
"port": pulumi.String("8080"),
},
DeleteServiceOnDestroy: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = appengine.NewApplicationUrlDispatchRules(ctx, "web_service", &appengine.ApplicationUrlDispatchRulesArgs{
DispatchRules: appengine.ApplicationUrlDispatchRulesDispatchRuleArray{
&appengine.ApplicationUrlDispatchRulesDispatchRuleArgs{
Domain: pulumi.String("*"),
Path: pulumi.String("/*"),
Service: pulumi.String("default"),
},
&appengine.ApplicationUrlDispatchRulesDispatchRuleArgs{
Domain: pulumi.String("*"),
Path: pulumi.String("/admin/*"),
Service: adminV3.Service,
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var bucket = new Gcp.Storage.Bucket("bucket", new()
{
Name = "appengine-test-bucket",
Location = "US",
});
var @object = new Gcp.Storage.BucketObject("object", new()
{
Name = "hello-world.zip",
Bucket = bucket.Name,
Source = new FileAsset("./test-fixtures/hello-world.zip"),
});
var adminV3 = new Gcp.AppEngine.StandardAppVersion("admin_v3", new()
{
VersionId = "v3",
Service = "admin",
Runtime = "nodejs20",
Entrypoint = new Gcp.AppEngine.Inputs.StandardAppVersionEntrypointArgs
{
Shell = "node ./app.js",
},
Deployment = new Gcp.AppEngine.Inputs.StandardAppVersionDeploymentArgs
{
Zip = new Gcp.AppEngine.Inputs.StandardAppVersionDeploymentZipArgs
{
SourceUrl = Output.Tuple(bucket.Name, @object.Name).Apply(values =>
{
var bucketName = values.Item1;
var objectName = values.Item2;
return $"https://storage.googleapis.com/{bucketName}/{objectName}";
}),
},
},
EnvVariables =
{
{ "port", "8080" },
},
DeleteServiceOnDestroy = true,
});
var webService = new Gcp.AppEngine.ApplicationUrlDispatchRules("web_service", new()
{
DispatchRules = new[]
{
new Gcp.AppEngine.Inputs.ApplicationUrlDispatchRulesDispatchRuleArgs
{
Domain = "*",
Path = "/*",
Service = "default",
},
new Gcp.AppEngine.Inputs.ApplicationUrlDispatchRulesDispatchRuleArgs
{
Domain = "*",
Path = "/admin/*",
Service = adminV3.Service,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.storage.BucketObject;
import com.pulumi.gcp.storage.BucketObjectArgs;
import com.pulumi.gcp.appengine.StandardAppVersion;
import com.pulumi.gcp.appengine.StandardAppVersionArgs;
import com.pulumi.gcp.appengine.inputs.StandardAppVersionEntrypointArgs;
import com.pulumi.gcp.appengine.inputs.StandardAppVersionDeploymentArgs;
import com.pulumi.gcp.appengine.inputs.StandardAppVersionDeploymentZipArgs;
import com.pulumi.gcp.appengine.ApplicationUrlDispatchRules;
import com.pulumi.gcp.appengine.ApplicationUrlDispatchRulesArgs;
import com.pulumi.gcp.appengine.inputs.ApplicationUrlDispatchRulesDispatchRuleArgs;
import com.pulumi.asset.FileAsset;
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 bucket = new Bucket("bucket", BucketArgs.builder()
.name("appengine-test-bucket")
.location("US")
.build());
var object = new BucketObject("object", BucketObjectArgs.builder()
.name("hello-world.zip")
.bucket(bucket.name())
.source(new FileAsset("./test-fixtures/hello-world.zip"))
.build());
var adminV3 = new StandardAppVersion("adminV3", StandardAppVersionArgs.builder()
.versionId("v3")
.service("admin")
.runtime("nodejs20")
.entrypoint(StandardAppVersionEntrypointArgs.builder()
.shell("node ./app.js")
.build())
.deployment(StandardAppVersionDeploymentArgs.builder()
.zip(StandardAppVersionDeploymentZipArgs.builder()
.sourceUrl(Output.tuple(bucket.name(), object.name()).applyValue(values -> {
var bucketName = values.t1;
var objectName = values.t2;
return String.format("https://storage.googleapis.com/%s/%s", bucketName,objectName);
}))
.build())
.build())
.envVariables(Map.of("port", "8080"))
.deleteServiceOnDestroy(true)
.build());
var webService = new ApplicationUrlDispatchRules("webService", ApplicationUrlDispatchRulesArgs.builder()
.dispatchRules(
ApplicationUrlDispatchRulesDispatchRuleArgs.builder()
.domain("*")
.path("/*")
.service("default")
.build(),
ApplicationUrlDispatchRulesDispatchRuleArgs.builder()
.domain("*")
.path("/admin/*")
.service(adminV3.service())
.build())
.build());
}
}
resources:
webService:
type: gcp:appengine:ApplicationUrlDispatchRules
name: web_service
properties:
dispatchRules:
- domain: '*'
path: /*
service: default
- domain: '*'
path: /admin/*
service: ${adminV3.service}
adminV3:
type: gcp:appengine:StandardAppVersion
name: admin_v3
properties:
versionId: v3
service: admin
runtime: nodejs20
entrypoint:
shell: node ./app.js
deployment:
zip:
sourceUrl: https://storage.googleapis.com/${bucket.name}/${object.name}
envVariables:
port: '8080'
deleteServiceOnDestroy: true
bucket:
type: gcp:storage:Bucket
properties:
name: appengine-test-bucket
location: US
object:
type: gcp:storage:BucketObject
properties:
name: hello-world.zip
bucket: ${bucket.name}
source:
fn::FileAsset: ./test-fixtures/hello-world.zip
Create ApplicationUrlDispatchRules Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApplicationUrlDispatchRules(name: string, args: ApplicationUrlDispatchRulesArgs, opts?: CustomResourceOptions);
@overload
def ApplicationUrlDispatchRules(resource_name: str,
args: ApplicationUrlDispatchRulesArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ApplicationUrlDispatchRules(resource_name: str,
opts: Optional[ResourceOptions] = None,
dispatch_rules: Optional[Sequence[ApplicationUrlDispatchRulesDispatchRuleArgs]] = None,
project: Optional[str] = None)
func NewApplicationUrlDispatchRules(ctx *Context, name string, args ApplicationUrlDispatchRulesArgs, opts ...ResourceOption) (*ApplicationUrlDispatchRules, error)
public ApplicationUrlDispatchRules(string name, ApplicationUrlDispatchRulesArgs args, CustomResourceOptions? opts = null)
public ApplicationUrlDispatchRules(String name, ApplicationUrlDispatchRulesArgs args)
public ApplicationUrlDispatchRules(String name, ApplicationUrlDispatchRulesArgs args, CustomResourceOptions options)
type: gcp:appengine:ApplicationUrlDispatchRules
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 ApplicationUrlDispatchRulesArgs
- 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 ApplicationUrlDispatchRulesArgs
- 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 ApplicationUrlDispatchRulesArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApplicationUrlDispatchRulesArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApplicationUrlDispatchRulesArgs
- 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 applicationUrlDispatchRulesResource = new Gcp.AppEngine.ApplicationUrlDispatchRules("applicationUrlDispatchRulesResource", new()
{
DispatchRules = new[]
{
new Gcp.AppEngine.Inputs.ApplicationUrlDispatchRulesDispatchRuleArgs
{
Path = "string",
Service = "string",
Domain = "string",
},
},
Project = "string",
});
example, err := appengine.NewApplicationUrlDispatchRules(ctx, "applicationUrlDispatchRulesResource", &appengine.ApplicationUrlDispatchRulesArgs{
DispatchRules: appengine.ApplicationUrlDispatchRulesDispatchRuleArray{
&appengine.ApplicationUrlDispatchRulesDispatchRuleArgs{
Path: pulumi.String("string"),
Service: pulumi.String("string"),
Domain: pulumi.String("string"),
},
},
Project: pulumi.String("string"),
})
var applicationUrlDispatchRulesResource = new ApplicationUrlDispatchRules("applicationUrlDispatchRulesResource", ApplicationUrlDispatchRulesArgs.builder()
.dispatchRules(ApplicationUrlDispatchRulesDispatchRuleArgs.builder()
.path("string")
.service("string")
.domain("string")
.build())
.project("string")
.build());
application_url_dispatch_rules_resource = gcp.appengine.ApplicationUrlDispatchRules("applicationUrlDispatchRulesResource",
dispatch_rules=[gcp.appengine.ApplicationUrlDispatchRulesDispatchRuleArgs(
path="string",
service="string",
domain="string",
)],
project="string")
const applicationUrlDispatchRulesResource = new gcp.appengine.ApplicationUrlDispatchRules("applicationUrlDispatchRulesResource", {
dispatchRules: [{
path: "string",
service: "string",
domain: "string",
}],
project: "string",
});
type: gcp:appengine:ApplicationUrlDispatchRules
properties:
dispatchRules:
- domain: string
path: string
service: string
project: string
ApplicationUrlDispatchRules Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The ApplicationUrlDispatchRules resource accepts the following input properties:
- Dispatch
Rules List<ApplicationUrl Dispatch Rules Dispatch Rule> - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- Project string
- Dispatch
Rules []ApplicationUrl Dispatch Rules Dispatch Rule Args - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- Project string
- dispatch
Rules List<ApplicationUrl Dispatch Rules Dispatch Rule> - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- project String
- dispatch
Rules ApplicationUrl Dispatch Rules Dispatch Rule[] - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- project string
- dispatch_
rules Sequence[ApplicationUrl Dispatch Rules Dispatch Rule Args] - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- project str
- dispatch
Rules List<Property Map> - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- project String
Outputs
All input properties are implicitly available as output properties. Additionally, the ApplicationUrlDispatchRules 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 ApplicationUrlDispatchRules Resource
Get an existing ApplicationUrlDispatchRules 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?: ApplicationUrlDispatchRulesState, opts?: CustomResourceOptions): ApplicationUrlDispatchRules
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
dispatch_rules: Optional[Sequence[ApplicationUrlDispatchRulesDispatchRuleArgs]] = None,
project: Optional[str] = None) -> ApplicationUrlDispatchRules
func GetApplicationUrlDispatchRules(ctx *Context, name string, id IDInput, state *ApplicationUrlDispatchRulesState, opts ...ResourceOption) (*ApplicationUrlDispatchRules, error)
public static ApplicationUrlDispatchRules Get(string name, Input<string> id, ApplicationUrlDispatchRulesState? state, CustomResourceOptions? opts = null)
public static ApplicationUrlDispatchRules get(String name, Output<String> id, ApplicationUrlDispatchRulesState 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.
- Dispatch
Rules List<ApplicationUrl Dispatch Rules Dispatch Rule> - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- Project string
- Dispatch
Rules []ApplicationUrl Dispatch Rules Dispatch Rule Args - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- Project string
- dispatch
Rules List<ApplicationUrl Dispatch Rules Dispatch Rule> - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- project String
- dispatch
Rules ApplicationUrl Dispatch Rules Dispatch Rule[] - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- project string
- dispatch_
rules Sequence[ApplicationUrl Dispatch Rules Dispatch Rule Args] - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- project str
- dispatch
Rules List<Property Map> - Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.
- project String
Supporting Types
ApplicationUrlDispatchRulesDispatchRule, ApplicationUrlDispatchRulesDispatchRuleArgs
- Path string
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters.
- Service string
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path.
The sum of the lengths of the domain and path may not exceed 100 characters.
- Domain string
- Domain name to match against. The wildcard "" is supported if specified before a period: ".". Defaults to matching all domains: "*".
- Path string
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters.
- Service string
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path.
The sum of the lengths of the domain and path may not exceed 100 characters.
- Domain string
- Domain name to match against. The wildcard "" is supported if specified before a period: ".". Defaults to matching all domains: "*".
- path String
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters.
- service String
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path.
The sum of the lengths of the domain and path may not exceed 100 characters.
- domain String
- Domain name to match against. The wildcard "" is supported if specified before a period: ".". Defaults to matching all domains: "*".
- path string
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters.
- service string
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path.
The sum of the lengths of the domain and path may not exceed 100 characters.
- domain string
- Domain name to match against. The wildcard "" is supported if specified before a period: ".". Defaults to matching all domains: "*".
- path str
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters.
- service str
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path.
The sum of the lengths of the domain and path may not exceed 100 characters.
- domain str
- Domain name to match against. The wildcard "" is supported if specified before a period: ".". Defaults to matching all domains: "*".
- path String
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path. The sum of the lengths of the domain and path may not exceed 100 characters.
- service String
- Pathname within the host. Must start with a "/". A single "*" can be included at the end of the path.
The sum of the lengths of the domain and path may not exceed 100 characters.
- domain String
- Domain name to match against. The wildcard "" is supported if specified before a period: ".". Defaults to matching all domains: "*".
Import
ApplicationUrlDispatchRules can be imported using any of these accepted formats:
{{project}}
When using the pulumi import
command, ApplicationUrlDispatchRules can be imported using one of the formats above. For example:
$ pulumi import gcp:appengine/applicationUrlDispatchRules:ApplicationUrlDispatchRules default {{project}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-beta
Terraform Provider.