Hosting Custom Domain
Example Usage
Firebasehosting Customdomain Basic
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 com.pulumi.resources.CustomResourceOptions;
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(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
}
}Firebasehosting Customdomain Full
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 com.pulumi.resources.CustomResourceOptions;
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 defaultHostingSite = new HostingSite("defaultHostingSite", HostingSiteArgs.builder()
.project("my-project-name")
.siteId("site-id-full")
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var defaultHostingCustomDomain = new HostingCustomDomain("defaultHostingCustomDomain", HostingCustomDomainArgs.builder()
.project("my-project-name")
.siteId(defaultHostingSite.siteId())
.customDomain("source.domain.com")
.certPreference("GROUPED")
.redirectTarget("destination.domain.com")
.waitDnsVerification(false)
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
}
}Firebasehosting Customdomain Cloud Run
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 com.pulumi.resources.CustomResourceOptions;
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 defaultHostingSite = new HostingSite("defaultHostingSite", HostingSiteArgs.builder()
.project("my-project-name")
.siteId("site-id")
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var defaultService = new Service("defaultService", ServiceArgs.builder()
.project("my-project-name")
.location("us-central1")
.ingress("INGRESS_TRAFFIC_ALL")
.template(ServiceTemplateArgs.builder()
.containers(ServiceTemplateContainerArgs.builder()
.image("us-docker.pkg.dev/cloudrun/container/hello")
.build())
.build())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var defaultHostingVersion = new HostingVersion("defaultHostingVersion", HostingVersionArgs.builder()
.siteId(defaultHostingSite.siteId())
.config(HostingVersionConfigArgs.builder()
.rewrites(HostingVersionConfigRewriteArgs.builder()
.glob("/hello/**")
.run(HostingVersionConfigRewriteRunArgs.builder()
.serviceId(defaultService.name())
.region(defaultService.location())
.build())
.build())
.build())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var defaultHostingRelease = new HostingRelease("defaultHostingRelease", HostingReleaseArgs.builder()
.siteId(defaultHostingSite.siteId())
.versionName(defaultHostingVersion.name())
.message("Cloud Run Integration")
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var defaultHostingCustomDomain = new HostingCustomDomain("defaultHostingCustomDomain", HostingCustomDomainArgs.builder()
.project("my-project-name")
.siteId(defaultHostingSite.siteId())
.customDomain("run.custom.domain.com")
.waitDnsVerification(false)
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
}
}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}} In Terraform v1.5.0 and later, use an import block to import CustomDomain using one of the formats above. For exampletf import { id = "projects/{{project}}/sites/{{site_id}}/customDomains/{{custom_domain}}" to = google_firebase_hosting_custom_domain.default }
$ pulumi import gcp:firebase/hostingCustomDomain:HostingCustomDomain When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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
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.
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.