@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
274 lines • 12.4 kB
JavaScript
;
// *** 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, Object.assign(Object.assign({}, 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 ? state.arn : undefined;
resourceInputs["bootstrapBrokers"] = state ? state.bootstrapBrokers : undefined;
resourceInputs["bootstrapBrokersPublicSaslIam"] = state ? state.bootstrapBrokersPublicSaslIam : undefined;
resourceInputs["bootstrapBrokersPublicSaslScram"] = state ? state.bootstrapBrokersPublicSaslScram : undefined;
resourceInputs["bootstrapBrokersPublicTls"] = state ? state.bootstrapBrokersPublicTls : undefined;
resourceInputs["bootstrapBrokersSaslIam"] = state ? state.bootstrapBrokersSaslIam : undefined;
resourceInputs["bootstrapBrokersSaslScram"] = state ? state.bootstrapBrokersSaslScram : undefined;
resourceInputs["bootstrapBrokersTls"] = state ? state.bootstrapBrokersTls : undefined;
resourceInputs["bootstrapBrokersVpcConnectivitySaslIam"] = state ? state.bootstrapBrokersVpcConnectivitySaslIam : undefined;
resourceInputs["bootstrapBrokersVpcConnectivitySaslScram"] = state ? state.bootstrapBrokersVpcConnectivitySaslScram : undefined;
resourceInputs["bootstrapBrokersVpcConnectivityTls"] = state ? state.bootstrapBrokersVpcConnectivityTls : undefined;
resourceInputs["brokerNodeGroupInfo"] = state ? state.brokerNodeGroupInfo : undefined;
resourceInputs["clientAuthentication"] = state ? state.clientAuthentication : undefined;
resourceInputs["clusterName"] = state ? state.clusterName : undefined;
resourceInputs["clusterUuid"] = state ? state.clusterUuid : undefined;
resourceInputs["configurationInfo"] = state ? state.configurationInfo : undefined;
resourceInputs["currentVersion"] = state ? state.currentVersion : undefined;
resourceInputs["encryptionInfo"] = state ? state.encryptionInfo : undefined;
resourceInputs["enhancedMonitoring"] = state ? state.enhancedMonitoring : undefined;
resourceInputs["kafkaVersion"] = state ? state.kafkaVersion : undefined;
resourceInputs["loggingInfo"] = state ? state.loggingInfo : undefined;
resourceInputs["numberOfBrokerNodes"] = state ? state.numberOfBrokerNodes : undefined;
resourceInputs["openMonitoring"] = state ? state.openMonitoring : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["storageMode"] = state ? state.storageMode : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
resourceInputs["zookeeperConnectString"] = state ? state.zookeeperConnectString : undefined;
resourceInputs["zookeeperConnectStringTls"] = state ? state.zookeeperConnectStringTls : undefined;
}
else {
const args = argsOrState;
if ((!args || args.brokerNodeGroupInfo === undefined) && !opts.urn) {
throw new Error("Missing required property 'brokerNodeGroupInfo'");
}
if ((!args || args.kafkaVersion === undefined) && !opts.urn) {
throw new Error("Missing required property 'kafkaVersion'");
}
if ((!args || args.numberOfBrokerNodes === undefined) && !opts.urn) {
throw new Error("Missing required property 'numberOfBrokerNodes'");
}
resourceInputs["brokerNodeGroupInfo"] = args ? args.brokerNodeGroupInfo : undefined;
resourceInputs["clientAuthentication"] = args ? args.clientAuthentication : undefined;
resourceInputs["clusterName"] = args ? args.clusterName : undefined;
resourceInputs["configurationInfo"] = args ? args.configurationInfo : undefined;
resourceInputs["encryptionInfo"] = args ? args.encryptionInfo : undefined;
resourceInputs["enhancedMonitoring"] = args ? args.enhancedMonitoring : undefined;
resourceInputs["kafkaVersion"] = args ? args.kafkaVersion : undefined;
resourceInputs["loggingInfo"] = args ? args.loggingInfo : undefined;
resourceInputs["numberOfBrokerNodes"] = args ? args.numberOfBrokerNodes : undefined;
resourceInputs["openMonitoring"] = args ? args.openMonitoring : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["storageMode"] = args ? args.storageMode : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
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