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

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()
    {
        Location = "US",
    });

    var @object = new Gcp.Storage.BucketObject("object", new()
    {
        Bucket = bucket.Name,
        Source = new FileAsset("./test-fixtures/appengine/hello-world.zip"),
    });

    var adminV3 = new Gcp.AppEngine.StandardAppVersion("adminV3", new()
    {
        VersionId = "v3",
        Service = "admin",
        Runtime = "nodejs10",
        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" },
        },
        NoopOnDestroy = true,
    });

    var webService = new Gcp.AppEngine.ApplicationUrlDispatchRules("webService", new()
    {
        DispatchRules = new[]
        {
            new Gcp.AppEngine.Inputs.ApplicationUrlDispatchRulesDispatchRuleArgs
            {
                Domain = "*",
                Path = "/*",
                Service = "default",
            },
            new Gcp.AppEngine.Inputs.ApplicationUrlDispatchRulesDispatchRuleArgs
            {
                Domain = "*",
                Path = "/admin/*",
                Service = adminV3.Service,
            },
        },
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/appengine"
	"github.com/pulumi/pulumi-gcp/sdk/v6/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{
			Location: pulumi.String("US"),
		})
		if err != nil {
			return err
		}
		object, err := storage.NewBucketObject(ctx, "object", &storage.BucketObjectArgs{
			Bucket: bucket.Name,
			Source: pulumi.NewFileAsset("./test-fixtures/appengine/hello-world.zip"),
		})
		if err != nil {
			return err
		}
		adminV3, err := appengine.NewStandardAppVersion(ctx, "adminV3", &appengine.StandardAppVersionArgs{
			VersionId: pulumi.String("v3"),
			Service:   pulumi.String("admin"),
			Runtime:   pulumi.String("nodejs10"),
			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"),
			},
			NoopOnDestroy: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = appengine.NewApplicationUrlDispatchRules(ctx, "webService", &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
	})
}
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()        
            .location("US")
            .build());

        var object = new BucketObject("object", BucketObjectArgs.builder()        
            .bucket(bucket.name())
            .source(new FileAsset("./test-fixtures/appengine/hello-world.zip"))
            .build());

        var adminV3 = new StandardAppVersion("adminV3", StandardAppVersionArgs.builder()        
            .versionId("v3")
            .service("admin")
            .runtime("nodejs10")
            .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"))
            .noopOnDestroy(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());

    }
}
import pulumi
import pulumi_gcp as gcp

bucket = gcp.storage.Bucket("bucket", location="US")
object = gcp.storage.BucketObject("object",
    bucket=bucket.name,
    source=pulumi.FileAsset("./test-fixtures/appengine/hello-world.zip"))
admin_v3 = gcp.appengine.StandardAppVersion("adminV3",
    version_id="v3",
    service="admin",
    runtime="nodejs10",
    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",
    },
    noop_on_destroy=True)
web_service = gcp.appengine.ApplicationUrlDispatchRules("webService", dispatch_rules=[
    gcp.appengine.ApplicationUrlDispatchRulesDispatchRuleArgs(
        domain="*",
        path="/*",
        service="default",
    ),
    gcp.appengine.ApplicationUrlDispatchRulesDispatchRuleArgs(
        domain="*",
        path="/admin/*",
        service=admin_v3.service,
    ),
])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const bucket = new gcp.storage.Bucket("bucket", {location: "US"});
const object = new gcp.storage.BucketObject("object", {
    bucket: bucket.name,
    source: new pulumi.asset.FileAsset("./test-fixtures/appengine/hello-world.zip"),
});
const adminV3 = new gcp.appengine.StandardAppVersion("adminV3", {
    versionId: "v3",
    service: "admin",
    runtime: "nodejs10",
    entrypoint: {
        shell: "node ./app.js",
    },
    deployment: {
        zip: {
            sourceUrl: pulumi.interpolate`https://storage.googleapis.com/${bucket.name}/${object.name}`,
        },
    },
    envVariables: {
        port: "8080",
    },
    noopOnDestroy: true,
});
const webService = new gcp.appengine.ApplicationUrlDispatchRules("webService", {dispatchRules: [
    {
        domain: "*",
        path: "/*",
        service: "default",
    },
    {
        domain: "*",
        path: "/admin/*",
        service: adminV3.service,
    },
]});
resources:
  webService:
    type: gcp:appengine:ApplicationUrlDispatchRules
    properties:
      dispatchRules:
        - domain: '*'
          path: /*
          service: default
        - domain: '*'
          path: /admin/*
          service: ${adminV3.service}
  adminV3:
    type: gcp:appengine:StandardAppVersion
    properties:
      versionId: v3
      service: admin
      runtime: nodejs10
      entrypoint:
        shell: node ./app.js
      deployment:
        zip:
          sourceUrl: https://storage.googleapis.com/${bucket.name}/${object.name}
      envVariables:
        port: '8080'
      noopOnDestroy: true
  bucket:
    type: gcp:storage:Bucket
    properties:
      location: US
  object:
    type: gcp:storage:BucketObject
    properties:
      bucket: ${bucket.name}
      source:
        fn::FileAsset: ./test-fixtures/appengine/hello-world.zip

Create ApplicationUrlDispatchRules Resource

new ApplicationUrlDispatchRules(name: string, args: ApplicationUrlDispatchRulesArgs, opts?: CustomResourceOptions);
@overload
def ApplicationUrlDispatchRules(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                dispatch_rules: Optional[Sequence[ApplicationUrlDispatchRulesDispatchRuleArgs]] = None,
                                project: Optional[str] = None)
@overload
def ApplicationUrlDispatchRules(resource_name: str,
                                args: ApplicationUrlDispatchRulesArgs,
                                opts: Optional[ResourceOptions] = 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.

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.

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:

DispatchRules List<ApplicationUrlDispatchRulesDispatchRuleArgs>

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

DispatchRules []ApplicationUrlDispatchRulesDispatchRuleArgs

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

dispatchRules List<ApplicationUrlDispatchRulesDispatchRuleArgs>

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

dispatchRules ApplicationUrlDispatchRulesDispatchRuleArgs[]

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

dispatch_rules Sequence[ApplicationUrlDispatchRulesDispatchRuleArgs]

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

project str

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

dispatchRules List<Property Map>

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

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.
The following state arguments are supported:
DispatchRules List<ApplicationUrlDispatchRulesDispatchRuleArgs>

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

DispatchRules []ApplicationUrlDispatchRulesDispatchRuleArgs

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

dispatchRules List<ApplicationUrlDispatchRulesDispatchRuleArgs>

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

dispatchRules ApplicationUrlDispatchRulesDispatchRuleArgs[]

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

dispatch_rules Sequence[ApplicationUrlDispatchRulesDispatchRuleArgs]

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

project str

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

dispatchRules List<Property Map>

Rules to match an HTTP request and dispatch that request to a service. Structure is documented below.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Supporting Types

ApplicationUrlDispatchRulesDispatchRule

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

 $ pulumi import gcp:appengine/applicationUrlDispatchRules:ApplicationUrlDispatchRules default {{project}}

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.