@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
456 lines (455 loc) • 16.9 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A named resource to which messages are sent by publishers.
*
* To get more information about Topic, see:
*
* * [API documentation](https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.topics)
* * How-to Guides
* * [Managing Topics](https://cloud.google.com/pubsub/docs/admin#managing_topics)
*
* > **Note:** You can retrieve the email of the Google Managed Pub/Sub Service Account used for forwarding
* by using the `gcp.projects.ServiceIdentity` resource.
*
* ## Example Usage
*
* ### Pubsub Topic Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* labels: {
* foo: "bar",
* },
* messageRetentionDuration: "86600s",
* });
* ```
* ### Pubsub Topic Cmek
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const keyRing = new gcp.kms.KeyRing("key_ring", {
* name: "example-keyring",
* location: "global",
* });
* const cryptoKey = new gcp.kms.CryptoKey("crypto_key", {
* name: "example-key",
* keyRing: keyRing.id,
* });
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* kmsKeyName: cryptoKey.id,
* });
* ```
* ### Pubsub Topic Geo Restricted
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* messageStoragePolicy: {
* allowedPersistenceRegions: ["europe-west3"],
* enforceInTransit: true,
* },
* });
* ```
* ### Pubsub Topic Schema Settings
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Schema("example", {
* name: "example",
* type: "AVRO",
* definition: `{
* "type" : "record",
* "name" : "Avro",
* "fields" : [
* {
* "name" : "StringField",
* "type" : "string"
* },
* {
* "name" : "IntField",
* "type" : "int"
* }
* ]
* }
* `,
* });
* const exampleTopic = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* schemaSettings: {
* schema: "projects/my-project-name/schemas/example",
* encoding: "JSON",
* },
* }, {
* dependsOn: [example],
* });
* ```
* ### Pubsub Topic Ingestion Kinesis
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* ingestionDataSourceSettings: {
* awsKinesis: {
* streamArn: "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name",
* consumerArn: "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111",
* awsRoleArn: "arn:aws:iam::111111111111:role/fake-role-name",
* gcpServiceAccount: "fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
* },
* },
* });
* ```
* ### Pubsub Topic Ingestion Cloud Storage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* ingestionDataSourceSettings: {
* cloudStorage: {
* bucket: "test-bucket",
* textFormat: {
* delimiter: " ",
* },
* minimumObjectCreateTime: "2024-01-01T00:00:00Z",
* matchGlob: "foo/**",
* },
* platformLogsSettings: {
* severity: "WARNING",
* },
* },
* });
* ```
* ### Pubsub Topic Ingestion Azure Event Hubs
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* ingestionDataSourceSettings: {
* azureEventHubs: {
* resourceGroup: "azure-ingestion-resource-group",
* namespace: "azure-ingestion-namespace",
* eventHub: "azure-ingestion-event-hub",
* clientId: "aZZZZZZZ-YYYY-HHHH-GGGG-abcdef569123",
* tenantId: "0XXXXXXX-YYYY-HHHH-GGGG-123456789123",
* subscriptionId: "bXXXXXXX-YYYY-HHHH-GGGG-123456789123",
* gcpServiceAccount: "fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
* },
* },
* });
* ```
* ### Pubsub Topic Ingestion Aws Msk
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* ingestionDataSourceSettings: {
* awsMsk: {
* clusterArn: "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name",
* topic: "test-topic",
* awsRoleArn: "arn:aws:iam::111111111111:role/fake-role-name",
* gcpServiceAccount: "fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
* },
* },
* });
* ```
* ### Pubsub Topic Ingestion Confluent Cloud
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.pubsub.Topic("example", {
* name: "example-topic",
* ingestionDataSourceSettings: {
* confluentCloud: {
* bootstrapServer: "test.us-west2.gcp.confluent.cloud:1111",
* clusterId: "1234",
* topic: "test-topic",
* identityPoolId: "test-identity-pool-id",
* gcpServiceAccount: "fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
* },
* },
* });
* ```
*
* ## Import
*
* Topic can be imported using any of these accepted formats:
*
* * `projects/{{project}}/topics/{{name}}`
*
* * `{{project}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, Topic can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:pubsub/topic:Topic default projects/{{project}}/topics/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:pubsub/topic:Topic default {{project}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:pubsub/topic:Topic default {{name}}
* ```
*/
export declare class Topic extends pulumi.CustomResource {
/**
* Get an existing Topic resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: TopicState, opts?: pulumi.CustomResourceOptions): Topic;
/**
* Returns true if the given object is an instance of Topic. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is Topic;
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
readonly effectiveLabels: pulumi.Output<{
[key: string]: string;
}>;
/**
* Settings for ingestion from a data source into this topic.
* Structure is documented below.
*/
readonly ingestionDataSourceSettings: pulumi.Output<outputs.pubsub.TopicIngestionDataSourceSettings | undefined>;
/**
* The resource name of the Cloud KMS CryptoKey to be used to protect access
* to messages published on this topic. Your project's PubSub service account
* (`service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com`) must have
* `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature.
* The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`
*/
readonly kmsKeyName: pulumi.Output<string | undefined>;
/**
* A set of key/value label pairs to assign to this Topic.
*
* **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
* Please refer to the field `effectiveLabels` for all of the labels present on the resource.
*/
readonly labels: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Indicates the minimum duration to retain a message after it is published
* to the topic. If this field is set, messages published to the topic in
* the last messageRetentionDuration are always available to subscribers.
* For instance, it allows any attached subscription to seek to a timestamp
* that is up to messageRetentionDuration in the past. If this field is not
* set, message retention is controlled by settings on individual subscriptions.
* The rotation period has the format of a decimal number, followed by the
* letter `s` (seconds). Cannot be more than 31 days or less than 10 minutes.
*/
readonly messageRetentionDuration: pulumi.Output<string | undefined>;
/**
* Policy constraining the set of Google Cloud Platform regions where
* messages published to the topic may be stored. If not present, then no
* constraints are in effect.
* Structure is documented below.
*/
readonly messageStoragePolicy: pulumi.Output<outputs.pubsub.TopicMessageStoragePolicy>;
/**
* Name of the topic.
*
*
* - - -
*/
readonly name: pulumi.Output<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* The combination of labels configured directly on the resource
* and default labels configured on the provider.
*/
readonly pulumiLabels: pulumi.Output<{
[key: string]: string;
}>;
/**
* Settings for validating messages published against a schema.
* Structure is documented below.
*/
readonly schemaSettings: pulumi.Output<outputs.pubsub.TopicSchemaSettings | undefined>;
/**
* Create a Topic resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args?: TopicArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering Topic resources.
*/
export interface TopicState {
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
effectiveLabels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Settings for ingestion from a data source into this topic.
* Structure is documented below.
*/
ingestionDataSourceSettings?: pulumi.Input<inputs.pubsub.TopicIngestionDataSourceSettings>;
/**
* The resource name of the Cloud KMS CryptoKey to be used to protect access
* to messages published on this topic. Your project's PubSub service account
* (`service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com`) must have
* `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature.
* The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`
*/
kmsKeyName?: pulumi.Input<string>;
/**
* A set of key/value label pairs to assign to this Topic.
*
* **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
* Please refer to the field `effectiveLabels` for all of the labels present on the resource.
*/
labels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Indicates the minimum duration to retain a message after it is published
* to the topic. If this field is set, messages published to the topic in
* the last messageRetentionDuration are always available to subscribers.
* For instance, it allows any attached subscription to seek to a timestamp
* that is up to messageRetentionDuration in the past. If this field is not
* set, message retention is controlled by settings on individual subscriptions.
* The rotation period has the format of a decimal number, followed by the
* letter `s` (seconds). Cannot be more than 31 days or less than 10 minutes.
*/
messageRetentionDuration?: pulumi.Input<string>;
/**
* Policy constraining the set of Google Cloud Platform regions where
* messages published to the topic may be stored. If not present, then no
* constraints are in effect.
* Structure is documented below.
*/
messageStoragePolicy?: pulumi.Input<inputs.pubsub.TopicMessageStoragePolicy>;
/**
* Name of the topic.
*
*
* - - -
*/
name?: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* The combination of labels configured directly on the resource
* and default labels configured on the provider.
*/
pulumiLabels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Settings for validating messages published against a schema.
* Structure is documented below.
*/
schemaSettings?: pulumi.Input<inputs.pubsub.TopicSchemaSettings>;
}
/**
* The set of arguments for constructing a Topic resource.
*/
export interface TopicArgs {
/**
* Settings for ingestion from a data source into this topic.
* Structure is documented below.
*/
ingestionDataSourceSettings?: pulumi.Input<inputs.pubsub.TopicIngestionDataSourceSettings>;
/**
* The resource name of the Cloud KMS CryptoKey to be used to protect access
* to messages published on this topic. Your project's PubSub service account
* (`service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com`) must have
* `roles/cloudkms.cryptoKeyEncrypterDecrypter` to use this feature.
* The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`
*/
kmsKeyName?: pulumi.Input<string>;
/**
* A set of key/value label pairs to assign to this Topic.
*
* **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
* Please refer to the field `effectiveLabels` for all of the labels present on the resource.
*/
labels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
}>;
/**
* Indicates the minimum duration to retain a message after it is published
* to the topic. If this field is set, messages published to the topic in
* the last messageRetentionDuration are always available to subscribers.
* For instance, it allows any attached subscription to seek to a timestamp
* that is up to messageRetentionDuration in the past. If this field is not
* set, message retention is controlled by settings on individual subscriptions.
* The rotation period has the format of a decimal number, followed by the
* letter `s` (seconds). Cannot be more than 31 days or less than 10 minutes.
*/
messageRetentionDuration?: pulumi.Input<string>;
/**
* Policy constraining the set of Google Cloud Platform regions where
* messages published to the topic may be stored. If not present, then no
* constraints are in effect.
* Structure is documented below.
*/
messageStoragePolicy?: pulumi.Input<inputs.pubsub.TopicMessageStoragePolicy>;
/**
* Name of the topic.
*
*
* - - -
*/
name?: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* Settings for validating messages published against a schema.
* Structure is documented below.
*/
schemaSettings?: pulumi.Input<inputs.pubsub.TopicSchemaSettings>;
}