docs/platform/infrastructure/import-pubsub-topic.md
When deploying to your own cloud, Encore Cloud provisions the infrastructure backing your Pub/Sub topics automatically. If you already have a GCP Pub/Sub topic, you can instead connect an Encore Pub/Sub topic directly to that existing topic.
<Callout type="important">The Infrastructure page only lists resources after they've been provisioned. This means importing replaces a topic that Encore has already provisioned — deploy your application first so the topic appears, then import it to point at your existing Pub/Sub topic.
</Callout>Using an existing Pub/Sub topic allows you to:
import { Topic } from "encore.dev/pubsub";
export const signups = new Topic<SignupEvent>("signups", {
deliveryGuarantee: "at-least-once",
});
var Signups = pubsub.NewTopic[*SignupEvent]("signups", pubsub.TopicConfig{
DeliveryGuarantee: pubsub.AtLeastOnce,
})
Importing creates a proposed infrastructure change. Review it in the pending changes summary and click Deploy to apply it. On the next deploy, Encore Cloud switches your Pub/Sub topic to the existing topic, replacing the topic it previously provisioned.
<Callout type="info">If the resource can't be resolved, double-check the project and topic ID, and that Encore has permission to view the topic in the selected GCP account.
</Callout>