UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

288 lines (287 loc) • 11.5 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * ## Example Usage * * ### Managedkafka Connector Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as time from "@pulumiverse/time"; * * const project = new gcp.organizations.Project("project", { * projectId: "tf-test_32706", * name: "tf-test_49082", * orgId: "123456789", * billingAccount: "000000-0000000-0000000-000000", * deletionPolicy: "DELETE", * }); * const wait60Seconds = new time.index.Sleep("wait_60_seconds", {createDuration: "60s"}, { * dependsOn: [project], * }); * const compute = new gcp.projects.Service("compute", { * project: project.projectId, * service: "compute.googleapis.com", * }, { * dependsOn: [wait60Seconds], * }); * const managedkafka = new gcp.projects.Service("managedkafka", { * project: project.projectId, * service: "managedkafka.googleapis.com", * }, { * dependsOn: [compute], * }); * const wait120Seconds = new time.index.Sleep("wait_120_seconds", {createDuration: "120s"}, { * dependsOn: [managedkafka], * }); * const mkcSecondarySubnet = new gcp.compute.Subnetwork("mkc_secondary_subnet", { * project: project.projectId, * name: "my-secondary-subnetwork-00", * ipCidrRange: "10.5.0.0/16", * region: "us-central1", * network: "default", * }, { * dependsOn: [wait120Seconds], * }); * const cpsTopic = new gcp.pubsub.Topic("cps_topic", { * project: project.projectId, * name: "my-cps-topic", * messageRetentionDuration: "86600s", * }); * const gmkCluster = new gcp.managedkafka.Cluster("gmk_cluster", { * project: project.projectId, * clusterId: "my-cluster", * location: "us-central1", * capacityConfig: { * vcpuCount: "3", * memoryBytes: "3221225472", * }, * gcpConfig: { * accessConfig: { * networkConfigs: [{ * subnet: pulumi.interpolate`projects/${project.projectId}/regions/us-central1/subnetworks/default`, * }], * }, * }, * }, { * dependsOn: [managedkafka], * }); * const gmkTopic = new gcp.managedkafka.Topic("gmk_topic", { * project: project.projectId, * topicId: "my-topic", * cluster: gmkCluster.clusterId, * location: "us-central1", * partitionCount: 2, * replicationFactor: 3, * }, { * dependsOn: [managedkafka], * }); * const mkcCluster = new gcp.managedkafka.ConnectCluster("mkc_cluster", { * project: project.projectId, * connectClusterId: "my-connect-cluster", * kafkaCluster: pulumi.interpolate`projects/${project.projectId}/locations/us-central1/clusters/${gmkCluster.clusterId}`, * location: "us-central1", * capacityConfig: { * vcpuCount: "12", * memoryBytes: "21474836480", * }, * gcpConfig: { * accessConfig: { * networkConfigs: [{ * primarySubnet: pulumi.interpolate`projects/${project.projectId}/regions/us-central1/subnetworks/default`, * additionalSubnets: [mkcSecondarySubnet.id], * dnsDomainNames: [pulumi.interpolate`${gmkCluster.clusterId}.us-central1.managedkafka.${project.projectId}.cloud.goog`], * }], * }, * }, * labels: { * key: "value", * }, * }, { * dependsOn: [managedkafka], * }); * const example = new gcp.managedkafka.Connector("example", { * project: project.projectId, * connectorId: "my-connector", * connectCluster: mkcCluster.connectClusterId, * location: "us-central1", * configs: { * "connector.class": "com.google.pubsub.kafka.sink.CloudPubSubSinkConnector", * name: "my-connector", * "tasks.max": "1", * topics: gmkTopic.topicId, * "cps.topic": cpsTopic.name, * "cps.project": project.projectId, * "value.converter": "org.apache.kafka.connect.storage.StringConverter", * "key.converter": "org.apache.kafka.connect.storage.StringConverter", * }, * taskRestartPolicy: { * minimumBackoff: "60s", * maximumBackoff: "1800s", * }, * }, { * dependsOn: [managedkafka], * }); * ``` * * ## Import * * Connector can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/connectClusters/{{connect_cluster}}/connectors/{{connector_id}}` * * * `{{project}}/{{location}}/{{connect_cluster}}/{{connector_id}}` * * * `{{location}}/{{connect_cluster}}/{{connector_id}}` * * When using the `pulumi import` command, Connector can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:managedkafka/connector:Connector default projects/{{project}}/locations/{{location}}/connectClusters/{{connect_cluster}}/connectors/{{connector_id}} * ``` * * ```sh * $ pulumi import gcp:managedkafka/connector:Connector default {{project}}/{{location}}/{{connect_cluster}}/{{connector_id}} * ``` * * ```sh * $ pulumi import gcp:managedkafka/connector:Connector default {{location}}/{{connect_cluster}}/{{connector_id}} * ``` */ export declare class Connector extends pulumi.CustomResource { /** * Get an existing Connector 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?: ConnectorState, opts?: pulumi.CustomResourceOptions): Connector; /** * Returns true if the given object is an instance of Connector. 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 Connector; /** * Connector config as keys/values. The keys of the map are connector property names, for example: `connector.class`, `tasks.max`, `key.converter`. */ readonly configs: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The connect cluster name. */ readonly connectCluster: pulumi.Output<string>; /** * The ID to use for the connector, which will become the final component of the connector's name. This value is structured like: `my-connector-id`. */ readonly connectorId: pulumi.Output<string>; /** * ID of the location of the Kafka Connect resource. See https://cloud.google.com/managed-kafka/docs/locations for a list of supported locations. */ readonly location: pulumi.Output<string>; /** * The name of the connector. The `connector` segment is used when connecting directly to the connect cluster. Structured like: `projects/PROJECT_ID/locations/LOCATION/connectClusters/CONNECT_CLUSTER/connectors/CONNECTOR_ID`. */ 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 current state of the connect. Possible values: `STATE_UNSPECIFIED`, `UNASSIGNED`, `RUNNING`, `PAUSED`, `FAILED`, `RESTARTING`, and `STOPPED`. */ readonly state: pulumi.Output<string>; /** * A policy that specifies how to restart the failed connectors/tasks in a Cluster resource. If not set, the failed connectors/tasks won't be restarted. * Structure is documented below. */ readonly taskRestartPolicy: pulumi.Output<outputs.managedkafka.ConnectorTaskRestartPolicy | undefined>; /** * Create a Connector 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: ConnectorArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Connector resources. */ export interface ConnectorState { /** * Connector config as keys/values. The keys of the map are connector property names, for example: `connector.class`, `tasks.max`, `key.converter`. */ configs?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The connect cluster name. */ connectCluster?: pulumi.Input<string>; /** * The ID to use for the connector, which will become the final component of the connector's name. This value is structured like: `my-connector-id`. */ connectorId?: pulumi.Input<string>; /** * ID of the location of the Kafka Connect resource. See https://cloud.google.com/managed-kafka/docs/locations for a list of supported locations. */ location?: pulumi.Input<string>; /** * The name of the connector. The `connector` segment is used when connecting directly to the connect cluster. Structured like: `projects/PROJECT_ID/locations/LOCATION/connectClusters/CONNECT_CLUSTER/connectors/CONNECTOR_ID`. */ 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 current state of the connect. Possible values: `STATE_UNSPECIFIED`, `UNASSIGNED`, `RUNNING`, `PAUSED`, `FAILED`, `RESTARTING`, and `STOPPED`. */ state?: pulumi.Input<string>; /** * A policy that specifies how to restart the failed connectors/tasks in a Cluster resource. If not set, the failed connectors/tasks won't be restarted. * Structure is documented below. */ taskRestartPolicy?: pulumi.Input<inputs.managedkafka.ConnectorTaskRestartPolicy>; } /** * The set of arguments for constructing a Connector resource. */ export interface ConnectorArgs { /** * Connector config as keys/values. The keys of the map are connector property names, for example: `connector.class`, `tasks.max`, `key.converter`. */ configs?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The connect cluster name. */ connectCluster: pulumi.Input<string>; /** * The ID to use for the connector, which will become the final component of the connector's name. This value is structured like: `my-connector-id`. */ connectorId: pulumi.Input<string>; /** * ID of the location of the Kafka Connect resource. See https://cloud.google.com/managed-kafka/docs/locations for a list of supported locations. */ location: 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>; /** * A policy that specifies how to restart the failed connectors/tasks in a Cluster resource. If not set, the failed connectors/tasks won't be restarted. * Structure is documented below. */ taskRestartPolicy?: pulumi.Input<inputs.managedkafka.ConnectorTaskRestartPolicy>; }