UNPKG

@pulumi/aws

Version:

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

497 lines (496 loc) • 19.8 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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 * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: ConnectionState, opts?: pulumi.CustomResourceOptions): Connection; /** * 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: any): obj is Connection; /** * ARN of the Glue Connection. */ readonly arn: pulumi.Output<string>; /** * Map of key-value pairs used as connection properties specific to the Athena compute environment. */ readonly athenaProperties: pulumi.Output<{ [key: string]: string; } | undefined>; /** * ID of the Data Catalog in which to create the connection. If none is supplied, the AWS account ID is used by default. */ readonly catalogId: pulumi.Output<string>; /** * Map of key-value pairs used as parameters for this connection. For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/connection-properties.html). * * **Note:** Some connection types require the `SparkProperties` property with a JSON document that contains the actual connection properties. For specific examples, refer to Example Usage. */ readonly connectionProperties: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Type of the connection. Valid values: `AZURECOSMOS`, `AZURESQL`, `BIGQUERY`, `CUSTOM`, `DYNAMODB`, `JDBC`, `KAFKA`, `MARKETPLACE`, `MONGODB`, `NETWORK`, `OPENSEARCH`, `SNOWFLAKE`. Defaults to `JDBC`. */ readonly connectionType: pulumi.Output<string | undefined>; /** * Description of the connection. */ readonly description: pulumi.Output<string | undefined>; /** * List of criteria that can be used in selecting this connection. */ readonly matchCriterias: pulumi.Output<string[] | undefined>; /** * Name of the connection. * * The following arguments are optional: */ readonly name: pulumi.Output<string>; /** * Map of physical connection requirements, such as VPC and SecurityGroup. See `physicalConnectionRequirements` Block for details. */ readonly physicalConnectionRequirements: pulumi.Output<outputs.glue.ConnectionPhysicalConnectionRequirements | undefined>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output<string>; /** * Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ readonly tagsAll: pulumi.Output<{ [key: string]: string; }>; /** * Create a Connection 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?: ConnectionArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Connection resources. */ export interface ConnectionState { /** * ARN of the Glue Connection. */ arn?: pulumi.Input<string>; /** * Map of key-value pairs used as connection properties specific to the Athena compute environment. */ athenaProperties?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * ID of the Data Catalog in which to create the connection. If none is supplied, the AWS account ID is used by default. */ catalogId?: pulumi.Input<string>; /** * Map of key-value pairs used as parameters for this connection. For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/connection-properties.html). * * **Note:** Some connection types require the `SparkProperties` property with a JSON document that contains the actual connection properties. For specific examples, refer to Example Usage. */ connectionProperties?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Type of the connection. Valid values: `AZURECOSMOS`, `AZURESQL`, `BIGQUERY`, `CUSTOM`, `DYNAMODB`, `JDBC`, `KAFKA`, `MARKETPLACE`, `MONGODB`, `NETWORK`, `OPENSEARCH`, `SNOWFLAKE`. Defaults to `JDBC`. */ connectionType?: pulumi.Input<string>; /** * Description of the connection. */ description?: pulumi.Input<string>; /** * List of criteria that can be used in selecting this connection. */ matchCriterias?: pulumi.Input<pulumi.Input<string>[]>; /** * Name of the connection. * * The following arguments are optional: */ name?: pulumi.Input<string>; /** * Map of physical connection requirements, such as VPC and SecurityGroup. See `physicalConnectionRequirements` Block for details. */ physicalConnectionRequirements?: pulumi.Input<inputs.glue.ConnectionPhysicalConnectionRequirements>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ tagsAll?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; } /** * The set of arguments for constructing a Connection resource. */ export interface ConnectionArgs { /** * Map of key-value pairs used as connection properties specific to the Athena compute environment. */ athenaProperties?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * ID of the Data Catalog in which to create the connection. If none is supplied, the AWS account ID is used by default. */ catalogId?: pulumi.Input<string>; /** * Map of key-value pairs used as parameters for this connection. For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/connection-properties.html). * * **Note:** Some connection types require the `SparkProperties` property with a JSON document that contains the actual connection properties. For specific examples, refer to Example Usage. */ connectionProperties?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Type of the connection. Valid values: `AZURECOSMOS`, `AZURESQL`, `BIGQUERY`, `CUSTOM`, `DYNAMODB`, `JDBC`, `KAFKA`, `MARKETPLACE`, `MONGODB`, `NETWORK`, `OPENSEARCH`, `SNOWFLAKE`. Defaults to `JDBC`. */ connectionType?: pulumi.Input<string>; /** * Description of the connection. */ description?: pulumi.Input<string>; /** * List of criteria that can be used in selecting this connection. */ matchCriterias?: pulumi.Input<pulumi.Input<string>[]>; /** * Name of the connection. * * The following arguments are optional: */ name?: pulumi.Input<string>; /** * Map of physical connection requirements, such as VPC and SecurityGroup. See `physicalConnectionRequirements` Block for details. */ physicalConnectionRequirements?: pulumi.Input<inputs.glue.ConnectionPhysicalConnectionRequirements>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; }