UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

274 lines • 11.6 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.Cluster = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages an Amazon MSK cluster. * * > **Note:** This resource manages _provisioned_ clusters. To manage a _serverless_ Amazon MSK cluster, use the `aws.msk.ServerlessCluster` resource. * * ## Example Usage * * ### Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const vpc = new aws.ec2.Vpc("vpc", {cidrBlock: "192.168.0.0/22"}); * const azs = aws.getAvailabilityZones({ * state: "available", * }); * const subnetAz1 = new aws.ec2.Subnet("subnet_az1", { * availabilityZone: azs.then(azs => azs.names?.[0]), * cidrBlock: "192.168.0.0/24", * vpcId: vpc.id, * }); * const subnetAz2 = new aws.ec2.Subnet("subnet_az2", { * availabilityZone: azs.then(azs => azs.names?.[1]), * cidrBlock: "192.168.1.0/24", * vpcId: vpc.id, * }); * const subnetAz3 = new aws.ec2.Subnet("subnet_az3", { * availabilityZone: azs.then(azs => azs.names?.[2]), * cidrBlock: "192.168.2.0/24", * vpcId: vpc.id, * }); * const sg = new aws.ec2.SecurityGroup("sg", {vpcId: vpc.id}); * const kms = new aws.kms.Key("kms", {description: "example"}); * const test = new aws.cloudwatch.LogGroup("test", {name: "msk_broker_logs"}); * const bucket = new aws.s3.Bucket("bucket", {bucket: "msk-broker-logs-bucket"}); * const bucketAcl = new aws.s3.BucketAcl("bucket_acl", { * bucket: bucket.id, * acl: "private", * }); * const assumeRole = aws.iam.getPolicyDocument({ * statements: [{ * effect: "Allow", * principals: [{ * type: "Service", * identifiers: ["firehose.amazonaws.com"], * }], * actions: ["sts:AssumeRole"], * }], * }); * const firehoseRole = new aws.iam.Role("firehose_role", { * name: "firehose_test_role", * assumeRolePolicy: assumeRole.then(assumeRole => assumeRole.json), * }); * const testStream = new aws.kinesis.FirehoseDeliveryStream("test_stream", { * name: "kinesis-firehose-msk-broker-logs-stream", * destination: "extended_s3", * extendedS3Configuration: { * roleArn: firehoseRole.arn, * bucketArn: bucket.arn, * }, * tags: { * LogDeliveryEnabled: "placeholder", * }, * }); * const example = new aws.msk.Cluster("example", { * clusterName: "example", * kafkaVersion: "3.2.0", * numberOfBrokerNodes: 3, * brokerNodeGroupInfo: { * instanceType: "kafka.m5.large", * clientSubnets: [ * subnetAz1.id, * subnetAz2.id, * subnetAz3.id, * ], * storageInfo: { * ebsStorageInfo: { * volumeSize: 1000, * }, * }, * securityGroups: [sg.id], * }, * encryptionInfo: { * encryptionAtRestKmsKeyArn: kms.arn, * }, * openMonitoring: { * prometheus: { * jmxExporter: { * enabledInBroker: true, * }, * nodeExporter: { * enabledInBroker: true, * }, * }, * }, * loggingInfo: { * brokerLogs: { * cloudwatchLogs: { * enabled: true, * logGroup: test.name, * }, * firehose: { * enabled: true, * deliveryStream: testStream.name, * }, * s3: { * enabled: true, * bucket: bucket.id, * prefix: "logs/msk-", * }, * }, * }, * tags: { * foo: "bar", * }, * }); * export const zookeeperConnectString = example.zookeeperConnectString; * export const bootstrapBrokersTls = example.bootstrapBrokersTls; * ``` * * ### With volumeThroughput argument * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.msk.Cluster("example", { * clusterName: "example", * kafkaVersion: "2.7.1", * numberOfBrokerNodes: 3, * brokerNodeGroupInfo: { * instanceType: "kafka.m5.4xlarge", * clientSubnets: [ * subnetAz1.id, * subnetAz2.id, * subnetAz3.id, * ], * storageInfo: { * ebsStorageInfo: { * provisionedThroughput: { * enabled: true, * volumeThroughput: 250, * }, * volumeSize: 1000, * }, * }, * securityGroups: [sg.id], * }, * }); * ``` * * ## Import * * Using `pulumi import`, import MSK clusters using the cluster `arn`. For example: * * ```sh * $ pulumi import aws:msk/cluster:Cluster example arn:aws:kafka:us-west-2:123456789012:cluster/example/279c0212-d057-4dba-9aa9-1c4e5a25bfc7-3 * ``` */ class Cluster extends pulumi.CustomResource { /** * Get an existing Cluster 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, id, state, opts) { return new Cluster(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Cluster. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === Cluster.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["bootstrapBrokers"] = state?.bootstrapBrokers; resourceInputs["bootstrapBrokersPublicSaslIam"] = state?.bootstrapBrokersPublicSaslIam; resourceInputs["bootstrapBrokersPublicSaslScram"] = state?.bootstrapBrokersPublicSaslScram; resourceInputs["bootstrapBrokersPublicTls"] = state?.bootstrapBrokersPublicTls; resourceInputs["bootstrapBrokersSaslIam"] = state?.bootstrapBrokersSaslIam; resourceInputs["bootstrapBrokersSaslScram"] = state?.bootstrapBrokersSaslScram; resourceInputs["bootstrapBrokersTls"] = state?.bootstrapBrokersTls; resourceInputs["bootstrapBrokersVpcConnectivitySaslIam"] = state?.bootstrapBrokersVpcConnectivitySaslIam; resourceInputs["bootstrapBrokersVpcConnectivitySaslScram"] = state?.bootstrapBrokersVpcConnectivitySaslScram; resourceInputs["bootstrapBrokersVpcConnectivityTls"] = state?.bootstrapBrokersVpcConnectivityTls; resourceInputs["brokerNodeGroupInfo"] = state?.brokerNodeGroupInfo; resourceInputs["clientAuthentication"] = state?.clientAuthentication; resourceInputs["clusterName"] = state?.clusterName; resourceInputs["clusterUuid"] = state?.clusterUuid; resourceInputs["configurationInfo"] = state?.configurationInfo; resourceInputs["currentVersion"] = state?.currentVersion; resourceInputs["encryptionInfo"] = state?.encryptionInfo; resourceInputs["enhancedMonitoring"] = state?.enhancedMonitoring; resourceInputs["kafkaVersion"] = state?.kafkaVersion; resourceInputs["loggingInfo"] = state?.loggingInfo; resourceInputs["numberOfBrokerNodes"] = state?.numberOfBrokerNodes; resourceInputs["openMonitoring"] = state?.openMonitoring; resourceInputs["region"] = state?.region; resourceInputs["storageMode"] = state?.storageMode; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["zookeeperConnectString"] = state?.zookeeperConnectString; resourceInputs["zookeeperConnectStringTls"] = state?.zookeeperConnectStringTls; } else { const args = argsOrState; if (args?.brokerNodeGroupInfo === undefined && !opts.urn) { throw new Error("Missing required property 'brokerNodeGroupInfo'"); } if (args?.kafkaVersion === undefined && !opts.urn) { throw new Error("Missing required property 'kafkaVersion'"); } if (args?.numberOfBrokerNodes === undefined && !opts.urn) { throw new Error("Missing required property 'numberOfBrokerNodes'"); } resourceInputs["brokerNodeGroupInfo"] = args?.brokerNodeGroupInfo; resourceInputs["clientAuthentication"] = args?.clientAuthentication; resourceInputs["clusterName"] = args?.clusterName; resourceInputs["configurationInfo"] = args?.configurationInfo; resourceInputs["encryptionInfo"] = args?.encryptionInfo; resourceInputs["enhancedMonitoring"] = args?.enhancedMonitoring; resourceInputs["kafkaVersion"] = args?.kafkaVersion; resourceInputs["loggingInfo"] = args?.loggingInfo; resourceInputs["numberOfBrokerNodes"] = args?.numberOfBrokerNodes; resourceInputs["openMonitoring"] = args?.openMonitoring; resourceInputs["region"] = args?.region; resourceInputs["storageMode"] = args?.storageMode; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["bootstrapBrokers"] = undefined /*out*/; resourceInputs["bootstrapBrokersPublicSaslIam"] = undefined /*out*/; resourceInputs["bootstrapBrokersPublicSaslScram"] = undefined /*out*/; resourceInputs["bootstrapBrokersPublicTls"] = undefined /*out*/; resourceInputs["bootstrapBrokersSaslIam"] = undefined /*out*/; resourceInputs["bootstrapBrokersSaslScram"] = undefined /*out*/; resourceInputs["bootstrapBrokersTls"] = undefined /*out*/; resourceInputs["bootstrapBrokersVpcConnectivitySaslIam"] = undefined /*out*/; resourceInputs["bootstrapBrokersVpcConnectivitySaslScram"] = undefined /*out*/; resourceInputs["bootstrapBrokersVpcConnectivityTls"] = undefined /*out*/; resourceInputs["clusterUuid"] = undefined /*out*/; resourceInputs["currentVersion"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; resourceInputs["zookeeperConnectString"] = undefined /*out*/; resourceInputs["zookeeperConnectStringTls"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Cluster.__pulumiType, name, resourceInputs, opts); } } exports.Cluster = Cluster; /** @internal */ Cluster.__pulumiType = 'aws:msk/cluster:Cluster'; //# sourceMappingURL=cluster.js.map