Hosting Custom Domain
Example Usage
Firebasehosting Customdomain Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const _default = new gcp.firebase.HostingCustomDomain("default", {
project: "my-project-name",
siteId: "site-id",
customDomain: "custom.domain.com",
});
import pulumi
import pulumi_gcp as gcp
default = gcp.firebase.HostingCustomDomain("default",
project="my-project-name",
site_id="site-id",
custom_domain="custom.domain.com")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var @default = new Gcp.Firebase.HostingCustomDomain("default", new()
{
Project = "my-project-name",
SiteId = "site-id",
CustomDomain = "custom.domain.com",
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := firebase.NewHostingCustomDomain(ctx, "default", &firebase.HostingCustomDomainArgs{
Project: pulumi.String("my-project-name"),
SiteId: pulumi.String("site-id"),
CustomDomain: pulumi.String("custom.domain.com"),
})
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.firebase.HostingCustomDomain;
import com.pulumi.gcp.firebase.HostingCustomDomainArgs;
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 HostingCustomDomain("default", HostingCustomDomainArgs.builder()
.project("my-project-name")
.siteId("site-id")
.customDomain("custom.domain.com")
.build());
}
}
resources:
default:
type: gcp:firebase:HostingCustomDomain
properties:
project: my-project-name
siteId: site-id
customDomain: custom.domain.com
Firebasehosting Customdomain Full
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const _default = new gcp.firebase.HostingSite("default", {
project: "my-project-name",
siteId: "site-id-full",
});
const defaultHostingCustomDomain = new gcp.firebase.HostingCustomDomain("default", {
project: "my-project-name",
siteId: _default.siteId,
customDomain: "source.domain.com",
certPreference: "GROUPED",
redirectTarget: "destination.domain.com",
waitDnsVerification: false,
});
import pulumi
import pulumi_gcp as gcp
default = gcp.firebase.HostingSite("default",
project="my-project-name",
site_id="site-id-full")
default_hosting_custom_domain = gcp.firebase.HostingCustomDomain("default",
project="my-project-name",
site_id=default.site_id,
custom_domain="source.domain.com",
cert_preference="GROUPED",
redirect_target="destination.domain.com",
wait_dns_verification=False)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var @default = new Gcp.Firebase.HostingSite("default", new()
{
Project = "my-project-name",
SiteId = "site-id-full",
});
var defaultHostingCustomDomain = new Gcp.Firebase.HostingCustomDomain("default", new()
{
Project = "my-project-name",
SiteId = @default.SiteId,
CustomDomain = "source.domain.com",
CertPreference = "GROUPED",
RedirectTarget = "destination.domain.com",
WaitDnsVerification = false,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := firebase.NewHostingSite(ctx, "default", &firebase.HostingSiteArgs{
Project: pulumi.String("my-project-name"),
SiteId: pulumi.String("site-id-full"),
})
if err != nil {
return err
}
_, err = firebase.NewHostingCustomDomain(ctx, "default", &firebase.HostingCustomDomainArgs{
Project: pulumi.String("my-project-name"),
SiteId: _default.SiteId,
CustomDomain: pulumi.String("source.domain.com"),
CertPreference: pulumi.String("GROUPED"),
RedirectTarget: pulumi.String("destination.domain.com"),
WaitDnsVerification: pulumi.Bool(false),
})
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.firebase.HostingSite;
import com.pulumi.gcp.firebase.HostingSiteArgs;
import com.pulumi.gcp.firebase.HostingCustomDomain;
import com.pulumi.gcp.firebase.HostingCustomDomainArgs;
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 HostingSite("default", HostingSiteArgs.builder()
.project("my-project-name")
.siteId("site-id-full")
.build());
var defaultHostingCustomDomain = new HostingCustomDomain("defaultHostingCustomDomain", HostingCustomDomainArgs.builder()
.project("my-project-name")
.siteId(default_.siteId())
.customDomain("source.domain.com")
.certPreference("GROUPED")
.redirectTarget("destination.domain.com")
.waitDnsVerification(false)
.build());
}
}
resources:
default:
type: gcp:firebase:HostingSite
properties:
project: my-project-name
siteId: site-id-full
defaultHostingCustomDomain:
type: gcp:firebase:HostingCustomDomain
name: default
properties:
project: my-project-name
siteId: ${default.siteId}
customDomain: source.domain.com
certPreference: GROUPED
redirectTarget: destination.domain.com
waitDnsVerification: false
Firebasehosting Customdomain Cloud Run
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const _default = new gcp.firebase.HostingSite("default", {
project: "my-project-name",
siteId: "site-id",
});
const defaultService = new gcp.cloudrunv2.Service("default", {
project: "my-project-name",
name: "cloud-run-service-via-hosting",
location: "us-central1",
ingress: "INGRESS_TRAFFIC_ALL",
template: {
containers: [{
image: "us-docker.pkg.dev/cloudrun/container/hello",
}],
},
});
const defaultHostingVersion = new gcp.firebase.HostingVersion("default", {
siteId: _default.siteId,
config: {
rewrites: [{
glob: "/hello/**",
run: {
serviceId: defaultService.name,
region: defaultService.location,
},
}],
},
});
const defaultHostingRelease = new gcp.firebase.HostingRelease("default", {
siteId: _default.siteId,
versionName: defaultHostingVersion.name,
message: "Cloud Run Integration",
});
const defaultHostingCustomDomain = new gcp.firebase.HostingCustomDomain("default", {
project: "my-project-name",
siteId: _default.siteId,
customDomain: "run.custom.domain.com",
waitDnsVerification: false,
});
import pulumi
import pulumi_gcp as gcp
default = gcp.firebase.HostingSite("default",
project="my-project-name",
site_id="site-id")
default_service = gcp.cloudrunv2.Service("default",
project="my-project-name",
name="cloud-run-service-via-hosting",
location="us-central1",
ingress="INGRESS_TRAFFIC_ALL",
template={
"containers": [{
"image": "us-docker.pkg.dev/cloudrun/container/hello",
}],
})
default_hosting_version = gcp.firebase.HostingVersion("default",
site_id=default.site_id,
config={
"rewrites": [{
"glob": "/hello/**",
"run": {
"service_id": default_service.name,
"region": default_service.location,
},
}],
})
default_hosting_release = gcp.firebase.HostingRelease("default",
site_id=default.site_id,
version_name=default_hosting_version.name,
message="Cloud Run Integration")
default_hosting_custom_domain = gcp.firebase.HostingCustomDomain("default",
project="my-project-name",
site_id=default.site_id,
custom_domain="run.custom.domain.com",
wait_dns_verification=False)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var @default = new Gcp.Firebase.HostingSite("default", new()
{
Project = "my-project-name",
SiteId = "site-id",
});
var defaultService = new Gcp.CloudRunV2.Service("default", new()
{
Project = "my-project-name",
Name = "cloud-run-service-via-hosting",
Location = "us-central1",
Ingress = "INGRESS_TRAFFIC_ALL",
Template = new Gcp.CloudRunV2.Inputs.ServiceTemplateArgs
{
Containers = new[]
{
new Gcp.CloudRunV2.Inputs.ServiceTemplateContainerArgs
{
Image = "us-docker.pkg.dev/cloudrun/container/hello",
},
},
},
});
var defaultHostingVersion = new Gcp.Firebase.HostingVersion("default", new()
{
SiteId = @default.SiteId,
Config = new Gcp.Firebase.Inputs.HostingVersionConfigArgs
{
Rewrites = new[]
{
new Gcp.Firebase.Inputs.HostingVersionConfigRewriteArgs
{
Glob = "/hello/**",
Run = new Gcp.Firebase.Inputs.HostingVersionConfigRewriteRunArgs
{
ServiceId = defaultService.Name,
Region = defaultService.Location,
},
},
},
},
});
var defaultHostingRelease = new Gcp.Firebase.HostingRelease("default", new()
{
SiteId = @default.SiteId,
VersionName = defaultHostingVersion.Name,
Message = "Cloud Run Integration",
});
var defaultHostingCustomDomain = new Gcp.Firebase.HostingCustomDomain("default", new()
{
Project = "my-project-name",
SiteId = @default.SiteId,
CustomDomain = "run.custom.domain.com",
WaitDnsVerification = false,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/cloudrunv2"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/firebase"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := firebase.NewHostingSite(ctx, "default", &firebase.HostingSiteArgs{
Project: pulumi.String("my-project-name"),
SiteId: pulumi.String("site-id"),
})
if err != nil {
return err
}
defaultService, err := cloudrunv2.NewService(ctx, "default", &cloudrunv2.ServiceArgs{
Project: pulumi.String("my-project-name"),
Name: pulumi.String("cloud-run-service-via-hosting"),
Location: pulumi.String("us-central1"),
Ingress: pulumi.String("INGRESS_TRAFFIC_ALL"),
Template: &cloudrunv2.ServiceTemplateArgs{
Containers: cloudrunv2.ServiceTemplateContainerArray{
&cloudrunv2.ServiceTemplateContainerArgs{
Image: pulumi.String("us-docker.pkg.dev/cloudrun/container/hello"),
},
},
},
})
if err != nil {
return err
}
defaultHostingVersion, err := firebase.NewHostingVersion(ctx, "default", &firebase.HostingVersionArgs{
SiteId: _default.SiteId,
Config: &firebase.HostingVersionConfigArgs{
Rewrites: firebase.HostingVersionConfigRewriteArray{
&firebase.HostingVersionConfigRewriteArgs{
Glob: pulumi.String("/hello/**"),
Run: &firebase.HostingVersionConfigRewriteRunArgs{
ServiceId: defaultService.Name,
Region: defaultService.Location,
},
},
},
},
})
if err != nil {
return err
}
_, err = firebase.NewHostingRelease(ctx, "default", &firebase.HostingReleaseArgs{
SiteId: _default.SiteId,
VersionName: defaultHostingVersion.Name,
Message: pulumi.String("Cloud Run Integration"),
})
if err != nil {
return err
}
_, err = firebase.NewHostingCustomDomain(ctx, "default", &firebase.HostingCustomDomainArgs{
Project: pulumi.String("my-project-name"),
SiteId: _default.SiteId,
CustomDomain: pulumi.String("run.custom.domain.com"),
WaitDnsVerification: pulumi.Bool(false),
})
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.firebase.HostingSite;
import com.pulumi.gcp.firebase.HostingSiteArgs;
import com.pulumi.gcp.cloudrunv2.Service;
import com.pulumi.gcp.cloudrunv2.ServiceArgs;
import com.pulumi.gcp.cloudrunv2.inputs.ServiceTemplateArgs;
import com.pulumi.gcp.firebase.HostingVersion;
import com.pulumi.gcp.firebase.HostingVersionArgs;
import com.pulumi.gcp.firebase.inputs.HostingVersionConfigArgs;
import com.pulumi.gcp.firebase.HostingRelease;
import com.pulumi.gcp.firebase.HostingReleaseArgs;
import com.pulumi.gcp.firebase.HostingCustomDomain;
import com.pulumi.gcp.firebase.HostingCustomDomainArgs;
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 HostingSite("default", HostingSiteArgs.builder()
.project("my-project-name")
.siteId("site-id")
.build());
var defaultService = new Service("defaultService", ServiceArgs.builder()
.project("my-project-name")
.name("cloud-run-service-via-hosting")
.location("us-central1")
.ingress("INGRESS_TRAFFIC_ALL")
.template(ServiceTemplateArgs.builder()
.containers(ServiceTemplateContainerArgs.builder()
.image("us-docker.pkg.dev/cloudrun/container/hello")
.build())
.build())
.build());
var defaultHostingVersion = new HostingVersion("defaultHostingVersion", HostingVersionArgs.builder()
.siteId(default_.siteId())
.config(HostingVersionConfigArgs.builder()
.rewrites(HostingVersionConfigRewriteArgs.builder()
.glob("/hello/**")
.run(HostingVersionConfigRewriteRunArgs.builder()
.serviceId(defaultService.name())
.region(defaultService.location())
.build())
.build())
.build())
.build());
var defaultHostingRelease = new HostingRelease("defaultHostingRelease", HostingReleaseArgs.builder()
.siteId(default_.siteId())
.versionName(defaultHostingVersion.name())
.message("Cloud Run Integration")
.build());
var defaultHostingCustomDomain = new HostingCustomDomain("defaultHostingCustomDomain", HostingCustomDomainArgs.builder()
.project("my-project-name")
.siteId(default_.siteId())
.customDomain("run.custom.domain.com")
.waitDnsVerification(false)
.build());
}
}
resources:
default:
type: gcp:firebase:HostingSite
properties:
project: my-project-name
siteId: site-id
defaultService:
type: gcp:cloudrunv2:Service
name: default
properties:
project: my-project-name
name: cloud-run-service-via-hosting
location: us-central1
ingress: INGRESS_TRAFFIC_ALL
template:
containers:
- image: us-docker.pkg.dev/cloudrun/container/hello
defaultHostingVersion:
type: gcp:firebase:HostingVersion
name: default
properties:
siteId: ${default.siteId}
config:
rewrites:
- glob: /hello/**
run:
serviceId: ${defaultService.name}
region: ${defaultService.location}
defaultHostingRelease:
type: gcp:firebase:HostingRelease
name: default
properties:
siteId: ${default.siteId}
versionName: ${defaultHostingVersion.name}
message: Cloud Run Integration
defaultHostingCustomDomain:
type: gcp:firebase:HostingCustomDomain
name: default
properties:
project: my-project-name
siteId: ${default.siteId}
customDomain: run.custom.domain.com
waitDnsVerification: false
Import
CustomDomain can be imported using any of these accepted formats:
projects/{{project}}/sites/{{site_id}}/customDomains/{{custom_domain}}
sites/{{site_id}}/customDomains/{{custom_domain}}
{{project}}/{{site_id}}/{{custom_domain}}
{{site_id}}/{{custom_domain}}
When using thepulumi import
command, CustomDomain can be imported using one of the formats above. For example:
$ pulumi import gcp:firebase/hostingCustomDomain:HostingCustomDomain default projects/{{project}}/sites/{{site_id}}/customDomains/{{custom_domain}}
$ pulumi import gcp:firebase/hostingCustomDomain:HostingCustomDomain default sites/{{site_id}}/customDomains/{{custom_domain}}
$ pulumi import gcp:firebase/hostingCustomDomain:HostingCustomDomain default {{project}}/{{site_id}}/{{custom_domain}}
$ pulumi import gcp:firebase/hostingCustomDomain:HostingCustomDomain default {{site_id}}/{{custom_domain}}
//////
Properties
A field that lets you specify which SSL certificate type Hosting creates for your domain name. Spark plan CustomDomain
s only have access to the GROUPED
cert type, while Blaze plan can select any option. Possible values are: GROUPED
, PROJECT_GROUPED
, DEDICATED
.
The SSL certificate Hosting has for this CustomDomain
's domain name. For new CustomDomain
s, this often represents Hosting's intent to create a certificate, rather than an actual cert. Check the state
field for more. Structure is documented below.
The CustomDomain
's create time.
The ID of the CustomDomain
, which is the domain name you'd like to use with Firebase Hosting.
The time the CustomDomain
was deleted; null for CustomDomains
that haven't been deleted. Deleted CustomDomains
persist for approximately 30 days, after which time Hosting removes them completely.
The minimum time before a soft-deleted CustomDomain
is completely removed from Hosting; null for CustomDomains
that haven't been deleted.
The host state of your domain name. Host state is determined by checking each IP address associated with your domain name to see if it's serving Hosting content. HOST_UNHOSTED: Your CustomDomain
's domain name isn't associated with any IP addresses. HOST_UNREACHABLE: Your CustomDomain
's domain name can't be reached. Hosting services' DNS queries to find your domain name's IP addresses resulted in errors. See your CustomDomain
's issues
field for more details. HOST_MISMATCH: Your CustomDomain
's domain name has IP addresses that don't ultimately resolve to Hosting. HOST_CONFLICT: Your CustomDomain
's domain name has IP addresses that resolve to both Hosting and other services. To ensure consistent results, remove A
and AAAA
records related to non-Hosting services. HOST_ACTIVE: All requests against your CustomDomain
's domain name are served by Hosting. If the CustomDomain
's OwnershipState
is also ACTIVE
, Hosting serves your Hosting Site's content on the domain name.
A set of errors Hosting systems encountered when trying to establish Hosting's ability to serve secure content for your domain name. Resolve these issues to ensure your CustomDomain
behaves properly. Structure is documented below.
The ownership state of your domain name. Ownership is determined at a Firebase project level, and established by adding TXT
records to your domain name's DNS records. Ownership cascades to subdomains. Granting a project ownership of foo.com
also grants that project ownership over bar.foo.com
, unless you add specific TXT
records to bar.foo.com
that grant a different project ownership. If your CustomDomain
is in an OwnershipState
other than OWNERSHIP_ACTIVE
for more than 30 days and it hasn't been updated in at least 30 days, Hosting's ownership systems delete the CustomDomain
. OWNERSHIP_MISSING: Your CustomDomain
's domain name has no Hosting-related ownership records; no Firebase project has permission to act on the domain name's behalf. OWNERSHIP_UNREACHABLE: Your CustomDomain
's domain name can't be reached. Hosting services' DNS queries to find your domain name's ownership records resulted in errors. See your CustomDomain
's issues
field for more details. OWNERSHIP_MISMATCH: Your CustomDomain
's domain name is owned by another Firebase project. Remove the conflicting TXT
records and replace them with project-specific records for your current Firebase project. OWNERSHIP_CONFLICT: Your CustomDomain
's domain name has conflicting TXT
records that indicate ownership by both your current Firebase project and another project. Remove the other project's ownership records to grant the current project ownership. OWNERSHIP_PENDING: Your CustomDomain
's DNS records are configured correctly. Hosting will transfer ownership of your domain to this CustomDomain
within 24 hours. OWNERSHIP_ACTIVE: Your CustomDomain
's domain name has TXT
records that grant its project permission to act on its behalf.
if true, indicates that Hosting's systems are attmepting to make the CustomDomain
's state match your preferred state. This is most frequently true
when initially provisioning a CustomDomain
or when creating a new SSL certificate to match an updated cert_preference
A domain name that this CustomDomain should direct traffic towards. If specified, Hosting will respond to requests against this CustomDomain with an HTTP 301 code, and route traffic to the specified redirect_target
instead.
A set of updates you should make to the domain name's DNS records to let Hosting serve secure content on its behalf. Structure is documented below.
The last time the CustomDomain
was updated.