@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
361 lines • 14.1 kB
JavaScript
"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.Connection = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a Glue Connection resource.
*
* ## Example Usage
*
* ### Non-VPC Connection
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.glue.Connection("example", {
* name: "example",
* connectionProperties: {
* JDBC_CONNECTION_URL: "jdbc:mysql://example.com/exampledatabase",
* PASSWORD: "examplepassword",
* USERNAME: "exampleusername",
* },
* });
* ```
*
* ### Non-VPC Connection with secret manager reference
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = aws.secretsmanager.getSecret({
* name: "example-secret",
* });
* const exampleConnection = new aws.glue.Connection("example", {
* name: "example",
* connectionProperties: {
* JDBC_CONNECTION_URL: "jdbc:mysql://example.com/exampledatabase",
* SECRET_ID: example.then(example => example.name),
* },
* });
* ```
*
* ### VPC Connection
*
* For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/populate-add-connection.html#connection-JDBC-VPC).
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.glue.Connection("example", {
* name: "example",
* connectionProperties: {
* JDBC_CONNECTION_URL: `jdbc:mysql://${exampleAwsRdsCluster.endpoint}/exampledatabase`,
* PASSWORD: "examplepassword",
* USERNAME: "exampleusername",
* },
* physicalConnectionRequirements: {
* availabilityZone: exampleAwsSubnet.availabilityZone,
* securityGroupIdLists: [exampleAwsSecurityGroup.id],
* subnetId: exampleAwsSubnet.id,
* },
* });
* ```
*
* ### Connection using a custom connector
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // Define the custom connector using the connection_type of `CUSTOM` with the match_criteria of `template_connection`
* // Example here being a snowflake jdbc connector with a secret having user and password as keys
* const example = aws.secretsmanager.getSecret({
* name: "example-secret",
* });
* const example1 = new aws.glue.Connection("example1", {
* name: "example1",
* connectionType: "CUSTOM",
* connectionProperties: {
* CONNECTOR_CLASS_NAME: "net.snowflake.client.jdbc.SnowflakeDriver",
* CONNECTION_TYPE: "Jdbc",
* CONNECTOR_URL: "s3://example/snowflake-jdbc.jar",
* JDBC_CONNECTION_URL: "[[\"default=jdbc:snowflake://example.com/?user=${user}&password=${password}\"],\",\"]",
* },
* matchCriterias: ["template-connection"],
* });
* // Reference the connector using match_criteria with the connector created above.
* const example2 = new aws.glue.Connection("example2", {
* name: "example2",
* connectionType: "CUSTOM",
* connectionProperties: {
* CONNECTOR_CLASS_NAME: "net.snowflake.client.jdbc.SnowflakeDriver",
* CONNECTION_TYPE: "Jdbc",
* CONNECTOR_URL: "s3://example/snowflake-jdbc.jar",
* JDBC_CONNECTION_URL: "jdbc:snowflake://example.com/?user=${user}&password=${password}",
* SECRET_ID: example.then(example => example.name),
* },
* matchCriterias: [
* "Connection",
* example1.name,
* ],
* });
* ```
*
* ### Azure Cosmos Connection
*
* For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/connection-properties.html#connection-properties-azurecosmos).
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.secretsmanager.Secret("example", {name: "example-secret"});
* const exampleSecretVersion = new aws.secretsmanager.SecretVersion("example", {
* secretId: example.id,
* secretString: JSON.stringify({
* username: "exampleusername",
* password: "examplepassword",
* }),
* });
* const exampleConnection = new aws.glue.Connection("example", {
* name: "example",
* connectionType: "AZURECOSMOS",
* connectionProperties: {
* SparkProperties: pulumi.jsonStringify({
* secretId: example.name,
* "spark.cosmos.accountEndpoint": "https://exampledbaccount.documents.azure.com:443/",
* }),
* },
* });
* ```
*
* ### Azure SQL Connection
*
* For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/connection-properties.html#connection-properties-azuresql).
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.secretsmanager.Secret("example", {name: "example-secret"});
* const exampleSecretVersion = new aws.secretsmanager.SecretVersion("example", {
* secretId: example.id,
* secretString: JSON.stringify({
* username: "exampleusername",
* password: "examplepassword",
* }),
* });
* const exampleConnection = new aws.glue.Connection("example", {
* name: "example",
* connectionType: "AZURECOSMOS",
* connectionProperties: {
* SparkProperties: pulumi.jsonStringify({
* secretId: example.name,
* url: "jdbc:sqlserver:exampledbserver.database.windows.net:1433;database=exampledatabase",
* }),
* },
* });
* ```
*
* ### Google BigQuery Connection
*
* For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/connection-properties.html#connection-properties-bigquery).
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* import * as std from "@pulumi/std";
*
* const example = new aws.secretsmanager.Secret("example", {name: "example-secret"});
* const exampleSecretVersion = new aws.secretsmanager.SecretVersion("example", {
* secretId: example.id,
* secretString: JSON.stringify({
* credentials: std.base64encode({
* input: `{
* \\"type\\": \\"service_account\\",
* \\"project_id\\": \\"example-project\\",
* \\"private_key_id\\": \\"example-key\\",
* \\"private_key\\": \\"-----BEGIN RSA PRIVATE KEY-----\\
* REDACTED\\
* -----END RSA PRIVATE KEY-----\\",
* \\"client_email\\": \\"example-project@appspot.gserviceaccount.com\\",
* \\"client_id\\": example-client\\",
* \\"auth_uri\\": \\"https://accounts.google.com/o/oauth2/auth\\",
* \\"token_uri\\": \\"https://oauth2.googleapis.com/token\\",
* \\"auth_provider_x509_cert_url\\": \\"https://www.googleapis.com/oauth2/v1/certs\\",
* \\"client_x509_cert_url\\": \\"https://www.googleapis.com/robot/v1/metadata/x509/example-project%%40appspot.gserviceaccount.com\\",
* \\"universe_domain\\": \\"googleapis.com\\"
* }
* `,
* }).then(invoke => invoke.result),
* }),
* });
* const exampleConnection = new aws.glue.Connection("example", {
* name: "example",
* connectionType: "BIGQUERY",
* connectionProperties: {
* SparkProperties: pulumi.jsonStringify({
* secretId: example.name,
* }),
* },
* });
* ```
*
* ### OpenSearch Service Connection
*
* For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/connection-properties.html#connection-properties-opensearch).
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.secretsmanager.Secret("example", {name: "example-secret"});
* const exampleSecretVersion = new aws.secretsmanager.SecretVersion("example", {
* secretId: example.id,
* secretString: JSON.stringify({
* "opensearch.net.http.auth.user": "exampleusername",
* "opensearch.net.http.auth.pass": "examplepassword",
* }),
* });
* const exampleConnection = new aws.glue.Connection("example", {
* name: "example",
* connectionType: "OPENSEARCH",
* connectionProperties: {
* SparkProperties: pulumi.jsonStringify({
* secretId: example.name,
* "opensearch.nodes": "https://search-exampledomain-ixlmh4jieahrau3bfebcgp8cnm.us-east-1.es.amazonaws.com",
* "opensearch.port": "443",
* "opensearch.aws.sigv4.region": "us-east-1",
* "opensearch.nodes.wan.only": "true",
* "opensearch.aws.sigv4.enabled": "true",
* }),
* },
* });
* ```
*
* ### Snowflake Connection
*
* For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/connection-properties.html#connection-properties-snowflake).
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.secretsmanager.Secret("example", {name: "example-secret"});
* const exampleSecretVersion = new aws.secretsmanager.SecretVersion("example", {
* secretId: example.id,
* secretString: JSON.stringify({
* sfUser: "exampleusername",
* sfPassword: "examplepassword",
* }),
* });
* const exampleConnection = new aws.glue.Connection("example", {
* name: "example",
* connectionType: "SNOWFLAKE",
* connectionProperties: {
* SparkProperties: pulumi.jsonStringify({
* secretId: example.name,
* sfRole: "EXAMPLEETLROLE",
* sfUrl: "exampleorg-exampleconnection.snowflakecomputing.com",
* }),
* },
* });
* ```
*
* ### DynamoDB Connection
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const test = new aws.glue.Connection("test", {
* name: "example",
* connectionType: "DYNAMODB",
* athenaProperties: {
* lambda_function_arn: "arn:aws:lambda:us-east-1:123456789012:function:athenafederatedcatalog_athena_abcdefgh",
* disable_spill_encryption: "false",
* spill_bucket: "example-bucket",
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Glue Connections using the `CATALOG-ID` (AWS account ID if not custom) and `NAME`. For example:
*
* ```sh
* $ pulumi import aws:glue/connection:Connection MyConnection 123456789012:MyConnection
* ```
*/
class Connection extends pulumi.CustomResource {
/**
* Get an existing Connection 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 Connection(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Connection. 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'] === Connection.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["athenaProperties"] = state?.athenaProperties;
resourceInputs["catalogId"] = state?.catalogId;
resourceInputs["connectionProperties"] = state?.connectionProperties;
resourceInputs["connectionType"] = state?.connectionType;
resourceInputs["description"] = state?.description;
resourceInputs["matchCriterias"] = state?.matchCriterias;
resourceInputs["name"] = state?.name;
resourceInputs["physicalConnectionRequirements"] = state?.physicalConnectionRequirements;
resourceInputs["region"] = state?.region;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
}
else {
const args = argsOrState;
resourceInputs["athenaProperties"] = args?.athenaProperties ? pulumi.secret(args.athenaProperties) : undefined;
resourceInputs["catalogId"] = args?.catalogId;
resourceInputs["connectionProperties"] = args?.connectionProperties ? pulumi.secret(args.connectionProperties) : undefined;
resourceInputs["connectionType"] = args?.connectionType;
resourceInputs["description"] = args?.description;
resourceInputs["matchCriterias"] = args?.matchCriterias;
resourceInputs["name"] = args?.name;
resourceInputs["physicalConnectionRequirements"] = args?.physicalConnectionRequirements;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["athenaProperties", "connectionProperties"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Connection.__pulumiType, name, resourceInputs, opts);
}
}
exports.Connection = Connection;
/** @internal */
Connection.__pulumiType = 'aws:glue/connection:Connection';
//# sourceMappingURL=connection.js.map