Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.gcp.bigquery.kotlin.Connection.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.bigquery.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionAws
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionAzure
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionCloudResource
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionCloudSpanner
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionCloudSql
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionSpark
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionAws.Companion.toKotlin as connectionAwsToKotlin
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionAzure.Companion.toKotlin as connectionAzureToKotlin
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionCloudResource.Companion.toKotlin as connectionCloudResourceToKotlin
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionCloudSpanner.Companion.toKotlin as connectionCloudSpannerToKotlin
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionCloudSql.Companion.toKotlin as connectionCloudSqlToKotlin
import com.pulumi.gcp.bigquery.kotlin.outputs.ConnectionSpark.Companion.toKotlin as connectionSparkToKotlin
/**
* Builder for [Connection].
*/
@PulumiTagMarker
public class ConnectionResourceBuilder internal constructor() {
public var name: String? = null
public var args: ConnectionArgs = ConnectionArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend ConnectionArgsBuilder.() -> Unit) {
val builder = ConnectionArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Connection {
val builtJavaResource = com.pulumi.gcp.bigquery.Connection(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Connection(builtJavaResource)
}
}
/**
* A connection allows BigQuery connections to external data sources..
* To get more information about Connection, see:
* * [API documentation](https://cloud.google.com/bigquery/docs/reference/bigqueryconnection/rest/v1/projects.locations.connections/create)
* * How-to Guides
* * [Cloud SQL federated queries](https://cloud.google.com/bigquery/docs/cloud-sql-federated-queries)
* ## Example Usage
* ### Bigquery Connection Cloud Resource
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const connection = new gcp.bigquery.Connection("connection", {
* connectionId: "my-connection",
* location: "US",
* friendlyName: "👋",
* description: "a riveting description",
* cloudResource: {},
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* connection = gcp.bigquery.Connection("connection",
* connection_id="my-connection",
* location="US",
* friendly_name="👋",
* description="a riveting description",
* cloud_resource={})
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var connection = new Gcp.BigQuery.Connection("connection", new()
* {
* ConnectionId = "my-connection",
* Location = "US",
* FriendlyName = "👋",
* Description = "a riveting description",
* CloudResource = null,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := bigquery.NewConnection(ctx, "connection", &bigquery.ConnectionArgs{
* ConnectionId: pulumi.String("my-connection"),
* Location: pulumi.String("US"),
* FriendlyName: pulumi.String("👋"),
* Description: pulumi.String("a riveting description"),
* CloudResource: nil,
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.bigquery.Connection;
* import com.pulumi.gcp.bigquery.ConnectionArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionCloudResourceArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var connection = new Connection("connection", ConnectionArgs.builder()
* .connectionId("my-connection")
* .location("US")
* .friendlyName("👋")
* .description("a riveting description")
* .cloudResource()
* .build());
* }
* }
* ```
* ```yaml
* resources:
* connection:
* type: gcp:bigquery:Connection
* properties:
* connectionId: my-connection
* location: US
* friendlyName: "\U0001F44B"
* description: a riveting description
* cloudResource: {}
* ```
*
* ### Bigquery Connection Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "my-database-instance",
* databaseVersion: "POSTGRES_11",
* region: "us-central1",
* settings: {
* tier: "db-f1-micro",
* },
* deletionProtection: true,
* });
* const db = new gcp.sql.Database("db", {
* instance: instance.name,
* name: "db",
* });
* const pwd = new random.RandomPassword("pwd", {
* length: 16,
* special: false,
* });
* const user = new gcp.sql.User("user", {
* name: "user",
* instance: instance.name,
* password: pwd.result,
* });
* const connection = new gcp.bigquery.Connection("connection", {
* friendlyName: "👋",
* description: "a riveting description",
* location: "US",
* cloudSql: {
* instanceId: instance.connectionName,
* database: db.name,
* type: "POSTGRES",
* credential: {
* username: user.name,
* password: user.password,
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* import pulumi_random as random
* instance = gcp.sql.DatabaseInstance("instance",
* name="my-database-instance",
* database_version="POSTGRES_11",
* region="us-central1",
* settings={
* "tier": "db-f1-micro",
* },
* deletion_protection=True)
* db = gcp.sql.Database("db",
* instance=instance.name,
* name="db")
* pwd = random.RandomPassword("pwd",
* length=16,
* special=False)
* user = gcp.sql.User("user",
* name="user",
* instance=instance.name,
* password=pwd.result)
* connection = gcp.bigquery.Connection("connection",
* friendly_name="👋",
* description="a riveting description",
* location="US",
* cloud_sql={
* "instance_id": instance.connection_name,
* "database": db.name,
* "type": "POSTGRES",
* "credential": {
* "username": user.name,
* "password": user.password,
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* using Random = Pulumi.Random;
* return await Deployment.RunAsync(() =>
* {
* var instance = new Gcp.Sql.DatabaseInstance("instance", new()
* {
* Name = "my-database-instance",
* DatabaseVersion = "POSTGRES_11",
* Region = "us-central1",
* Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
* {
* Tier = "db-f1-micro",
* },
* DeletionProtection = true,
* });
* var db = new Gcp.Sql.Database("db", new()
* {
* Instance = instance.Name,
* Name = "db",
* });
* var pwd = new Random.RandomPassword("pwd", new()
* {
* Length = 16,
* Special = false,
* });
* var user = new Gcp.Sql.User("user", new()
* {
* Name = "user",
* Instance = instance.Name,
* Password = pwd.Result,
* });
* var connection = new Gcp.BigQuery.Connection("connection", new()
* {
* FriendlyName = "👋",
* Description = "a riveting description",
* Location = "US",
* CloudSql = new Gcp.BigQuery.Inputs.ConnectionCloudSqlArgs
* {
* InstanceId = instance.ConnectionName,
* Database = db.Name,
* Type = "POSTGRES",
* Credential = new Gcp.BigQuery.Inputs.ConnectionCloudSqlCredentialArgs
* {
* Username = user.Name,
* Password = user.Password,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi-random/sdk/v4/go/random"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* instance, err := sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
* Name: pulumi.String("my-database-instance"),
* DatabaseVersion: pulumi.String("POSTGRES_11"),
* Region: pulumi.String("us-central1"),
* Settings: &sql.DatabaseInstanceSettingsArgs{
* Tier: pulumi.String("db-f1-micro"),
* },
* DeletionProtection: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* db, err := sql.NewDatabase(ctx, "db", &sql.DatabaseArgs{
* Instance: instance.Name,
* Name: pulumi.String("db"),
* })
* if err != nil {
* return err
* }
* pwd, err := random.NewRandomPassword(ctx, "pwd", &random.RandomPasswordArgs{
* Length: pulumi.Int(16),
* Special: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* user, err := sql.NewUser(ctx, "user", &sql.UserArgs{
* Name: pulumi.String("user"),
* Instance: instance.Name,
* Password: pwd.Result,
* })
* if err != nil {
* return err
* }
* _, err = bigquery.NewConnection(ctx, "connection", &bigquery.ConnectionArgs{
* FriendlyName: pulumi.String("👋"),
* Description: pulumi.String("a riveting description"),
* Location: pulumi.String("US"),
* CloudSql: &bigquery.ConnectionCloudSqlArgs{
* InstanceId: instance.ConnectionName,
* Database: db.Name,
* Type: pulumi.String("POSTGRES"),
* Credential: &bigquery.ConnectionCloudSqlCredentialArgs{
* Username: user.Name,
* Password: user.Password,
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.sql.DatabaseInstance;
* import com.pulumi.gcp.sql.DatabaseInstanceArgs;
* import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
* import com.pulumi.gcp.sql.Database;
* import com.pulumi.gcp.sql.DatabaseArgs;
* import com.pulumi.random.RandomPassword;
* import com.pulumi.random.RandomPasswordArgs;
* import com.pulumi.gcp.sql.User;
* import com.pulumi.gcp.sql.UserArgs;
* import com.pulumi.gcp.bigquery.Connection;
* import com.pulumi.gcp.bigquery.ConnectionArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionCloudSqlArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionCloudSqlCredentialArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()
* .name("my-database-instance")
* .databaseVersion("POSTGRES_11")
* .region("us-central1")
* .settings(DatabaseInstanceSettingsArgs.builder()
* .tier("db-f1-micro")
* .build())
* .deletionProtection("true")
* .build());
* var db = new Database("db", DatabaseArgs.builder()
* .instance(instance.name())
* .name("db")
* .build());
* var pwd = new RandomPassword("pwd", RandomPasswordArgs.builder()
* .length(16)
* .special(false)
* .build());
* var user = new User("user", UserArgs.builder()
* .name("user")
* .instance(instance.name())
* .password(pwd.result())
* .build());
* var connection = new Connection("connection", ConnectionArgs.builder()
* .friendlyName("👋")
* .description("a riveting description")
* .location("US")
* .cloudSql(ConnectionCloudSqlArgs.builder()
* .instanceId(instance.connectionName())
* .database(db.name())
* .type("POSTGRES")
* .credential(ConnectionCloudSqlCredentialArgs.builder()
* .username(user.name())
* .password(user.password())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* instance:
* type: gcp:sql:DatabaseInstance
* properties:
* name: my-database-instance
* databaseVersion: POSTGRES_11
* region: us-central1
* settings:
* tier: db-f1-micro
* deletionProtection: 'true'
* db:
* type: gcp:sql:Database
* properties:
* instance: ${instance.name}
* name: db
* pwd:
* type: random:RandomPassword
* properties:
* length: 16
* special: false
* user:
* type: gcp:sql:User
* properties:
* name: user
* instance: ${instance.name}
* password: ${pwd.result}
* connection:
* type: gcp:bigquery:Connection
* properties:
* friendlyName: "\U0001F44B"
* description: a riveting description
* location: US
* cloudSql:
* instanceId: ${instance.connectionName}
* database: ${db.name}
* type: POSTGRES
* credential:
* username: ${user.name}
* password: ${user.password}
* ```
*
* ### Bigquery Connection Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as random from "@pulumi/random";
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "my-database-instance",
* databaseVersion: "POSTGRES_11",
* region: "us-central1",
* settings: {
* tier: "db-f1-micro",
* },
* deletionProtection: true,
* });
* const db = new gcp.sql.Database("db", {
* instance: instance.name,
* name: "db",
* });
* const pwd = new random.RandomPassword("pwd", {
* length: 16,
* special: false,
* });
* const user = new gcp.sql.User("user", {
* name: "user",
* instance: instance.name,
* password: pwd.result,
* });
* const connection = new gcp.bigquery.Connection("connection", {
* connectionId: "my-connection",
* location: "US",
* friendlyName: "👋",
* description: "a riveting description",
* cloudSql: {
* instanceId: instance.connectionName,
* database: db.name,
* type: "POSTGRES",
* credential: {
* username: user.name,
* password: user.password,
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* import pulumi_random as random
* instance = gcp.sql.DatabaseInstance("instance",
* name="my-database-instance",
* database_version="POSTGRES_11",
* region="us-central1",
* settings={
* "tier": "db-f1-micro",
* },
* deletion_protection=True)
* db = gcp.sql.Database("db",
* instance=instance.name,
* name="db")
* pwd = random.RandomPassword("pwd",
* length=16,
* special=False)
* user = gcp.sql.User("user",
* name="user",
* instance=instance.name,
* password=pwd.result)
* connection = gcp.bigquery.Connection("connection",
* connection_id="my-connection",
* location="US",
* friendly_name="👋",
* description="a riveting description",
* cloud_sql={
* "instance_id": instance.connection_name,
* "database": db.name,
* "type": "POSTGRES",
* "credential": {
* "username": user.name,
* "password": user.password,
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* using Random = Pulumi.Random;
* return await Deployment.RunAsync(() =>
* {
* var instance = new Gcp.Sql.DatabaseInstance("instance", new()
* {
* Name = "my-database-instance",
* DatabaseVersion = "POSTGRES_11",
* Region = "us-central1",
* Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
* {
* Tier = "db-f1-micro",
* },
* DeletionProtection = true,
* });
* var db = new Gcp.Sql.Database("db", new()
* {
* Instance = instance.Name,
* Name = "db",
* });
* var pwd = new Random.RandomPassword("pwd", new()
* {
* Length = 16,
* Special = false,
* });
* var user = new Gcp.Sql.User("user", new()
* {
* Name = "user",
* Instance = instance.Name,
* Password = pwd.Result,
* });
* var connection = new Gcp.BigQuery.Connection("connection", new()
* {
* ConnectionId = "my-connection",
* Location = "US",
* FriendlyName = "👋",
* Description = "a riveting description",
* CloudSql = new Gcp.BigQuery.Inputs.ConnectionCloudSqlArgs
* {
* InstanceId = instance.ConnectionName,
* Database = db.Name,
* Type = "POSTGRES",
* Credential = new Gcp.BigQuery.Inputs.ConnectionCloudSqlCredentialArgs
* {
* Username = user.Name,
* Password = user.Password,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi-random/sdk/v4/go/random"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* instance, err := sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
* Name: pulumi.String("my-database-instance"),
* DatabaseVersion: pulumi.String("POSTGRES_11"),
* Region: pulumi.String("us-central1"),
* Settings: &sql.DatabaseInstanceSettingsArgs{
* Tier: pulumi.String("db-f1-micro"),
* },
* DeletionProtection: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* db, err := sql.NewDatabase(ctx, "db", &sql.DatabaseArgs{
* Instance: instance.Name,
* Name: pulumi.String("db"),
* })
* if err != nil {
* return err
* }
* pwd, err := random.NewRandomPassword(ctx, "pwd", &random.RandomPasswordArgs{
* Length: pulumi.Int(16),
* Special: pulumi.Bool(false),
* })
* if err != nil {
* return err
* }
* user, err := sql.NewUser(ctx, "user", &sql.UserArgs{
* Name: pulumi.String("user"),
* Instance: instance.Name,
* Password: pwd.Result,
* })
* if err != nil {
* return err
* }
* _, err = bigquery.NewConnection(ctx, "connection", &bigquery.ConnectionArgs{
* ConnectionId: pulumi.String("my-connection"),
* Location: pulumi.String("US"),
* FriendlyName: pulumi.String("👋"),
* Description: pulumi.String("a riveting description"),
* CloudSql: &bigquery.ConnectionCloudSqlArgs{
* InstanceId: instance.ConnectionName,
* Database: db.Name,
* Type: pulumi.String("POSTGRES"),
* Credential: &bigquery.ConnectionCloudSqlCredentialArgs{
* Username: user.Name,
* Password: user.Password,
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.sql.DatabaseInstance;
* import com.pulumi.gcp.sql.DatabaseInstanceArgs;
* import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
* import com.pulumi.gcp.sql.Database;
* import com.pulumi.gcp.sql.DatabaseArgs;
* import com.pulumi.random.RandomPassword;
* import com.pulumi.random.RandomPasswordArgs;
* import com.pulumi.gcp.sql.User;
* import com.pulumi.gcp.sql.UserArgs;
* import com.pulumi.gcp.bigquery.Connection;
* import com.pulumi.gcp.bigquery.ConnectionArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionCloudSqlArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionCloudSqlCredentialArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()
* .name("my-database-instance")
* .databaseVersion("POSTGRES_11")
* .region("us-central1")
* .settings(DatabaseInstanceSettingsArgs.builder()
* .tier("db-f1-micro")
* .build())
* .deletionProtection("true")
* .build());
* var db = new Database("db", DatabaseArgs.builder()
* .instance(instance.name())
* .name("db")
* .build());
* var pwd = new RandomPassword("pwd", RandomPasswordArgs.builder()
* .length(16)
* .special(false)
* .build());
* var user = new User("user", UserArgs.builder()
* .name("user")
* .instance(instance.name())
* .password(pwd.result())
* .build());
* var connection = new Connection("connection", ConnectionArgs.builder()
* .connectionId("my-connection")
* .location("US")
* .friendlyName("👋")
* .description("a riveting description")
* .cloudSql(ConnectionCloudSqlArgs.builder()
* .instanceId(instance.connectionName())
* .database(db.name())
* .type("POSTGRES")
* .credential(ConnectionCloudSqlCredentialArgs.builder()
* .username(user.name())
* .password(user.password())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* instance:
* type: gcp:sql:DatabaseInstance
* properties:
* name: my-database-instance
* databaseVersion: POSTGRES_11
* region: us-central1
* settings:
* tier: db-f1-micro
* deletionProtection: 'true'
* db:
* type: gcp:sql:Database
* properties:
* instance: ${instance.name}
* name: db
* pwd:
* type: random:RandomPassword
* properties:
* length: 16
* special: false
* user:
* type: gcp:sql:User
* properties:
* name: user
* instance: ${instance.name}
* password: ${pwd.result}
* connection:
* type: gcp:bigquery:Connection
* properties:
* connectionId: my-connection
* location: US
* friendlyName: "\U0001F44B"
* description: a riveting description
* cloudSql:
* instanceId: ${instance.connectionName}
* database: ${db.name}
* type: POSTGRES
* credential:
* username: ${user.name}
* password: ${user.password}
* ```
*
* ### Bigquery Connection Aws
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const connection = new gcp.bigquery.Connection("connection", {
* connectionId: "my-connection",
* location: "aws-us-east-1",
* friendlyName: "👋",
* description: "a riveting description",
* aws: {
* accessRole: {
* iamRoleId: "arn:aws:iam::999999999999:role/omnirole",
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* connection = gcp.bigquery.Connection("connection",
* connection_id="my-connection",
* location="aws-us-east-1",
* friendly_name="👋",
* description="a riveting description",
* aws={
* "access_role": {
* "iam_role_id": "arn:aws:iam::999999999999:role/omnirole",
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var connection = new Gcp.BigQuery.Connection("connection", new()
* {
* ConnectionId = "my-connection",
* Location = "aws-us-east-1",
* FriendlyName = "👋",
* Description = "a riveting description",
* Aws = new Gcp.BigQuery.Inputs.ConnectionAwsArgs
* {
* AccessRole = new Gcp.BigQuery.Inputs.ConnectionAwsAccessRoleArgs
* {
* IamRoleId = "arn:aws:iam::999999999999:role/omnirole",
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := bigquery.NewConnection(ctx, "connection", &bigquery.ConnectionArgs{
* ConnectionId: pulumi.String("my-connection"),
* Location: pulumi.String("aws-us-east-1"),
* FriendlyName: pulumi.String("👋"),
* Description: pulumi.String("a riveting description"),
* Aws: &bigquery.ConnectionAwsArgs{
* AccessRole: &bigquery.ConnectionAwsAccessRoleArgs{
* IamRoleId: pulumi.String("arn:aws:iam::999999999999:role/omnirole"),
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.bigquery.Connection;
* import com.pulumi.gcp.bigquery.ConnectionArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionAwsArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionAwsAccessRoleArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var connection = new Connection("connection", ConnectionArgs.builder()
* .connectionId("my-connection")
* .location("aws-us-east-1")
* .friendlyName("👋")
* .description("a riveting description")
* .aws(ConnectionAwsArgs.builder()
* .accessRole(ConnectionAwsAccessRoleArgs.builder()
* .iamRoleId("arn:aws:iam::999999999999:role/omnirole")
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* connection:
* type: gcp:bigquery:Connection
* properties:
* connectionId: my-connection
* location: aws-us-east-1
* friendlyName: "\U0001F44B"
* description: a riveting description
* aws:
* accessRole:
* iamRoleId: arn:aws:iam::999999999999:role/omnirole
* ```
*
* ### Bigquery Connection Azure
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const connection = new gcp.bigquery.Connection("connection", {
* connectionId: "my-connection",
* location: "azure-eastus2",
* friendlyName: "👋",
* description: "a riveting description",
* azure: {
* customerTenantId: "customer-tenant-id",
* federatedApplicationClientId: "b43eeeee-eeee-eeee-eeee-a480155501ce",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* connection = gcp.bigquery.Connection("connection",
* connection_id="my-connection",
* location="azure-eastus2",
* friendly_name="👋",
* description="a riveting description",
* azure={
* "customer_tenant_id": "customer-tenant-id",
* "federated_application_client_id": "b43eeeee-eeee-eeee-eeee-a480155501ce",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var connection = new Gcp.BigQuery.Connection("connection", new()
* {
* ConnectionId = "my-connection",
* Location = "azure-eastus2",
* FriendlyName = "👋",
* Description = "a riveting description",
* Azure = new Gcp.BigQuery.Inputs.ConnectionAzureArgs
* {
* CustomerTenantId = "customer-tenant-id",
* FederatedApplicationClientId = "b43eeeee-eeee-eeee-eeee-a480155501ce",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := bigquery.NewConnection(ctx, "connection", &bigquery.ConnectionArgs{
* ConnectionId: pulumi.String("my-connection"),
* Location: pulumi.String("azure-eastus2"),
* FriendlyName: pulumi.String("👋"),
* Description: pulumi.String("a riveting description"),
* Azure: &bigquery.ConnectionAzureArgs{
* CustomerTenantId: pulumi.String("customer-tenant-id"),
* FederatedApplicationClientId: pulumi.String("b43eeeee-eeee-eeee-eeee-a480155501ce"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.bigquery.Connection;
* import com.pulumi.gcp.bigquery.ConnectionArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionAzureArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var connection = new Connection("connection", ConnectionArgs.builder()
* .connectionId("my-connection")
* .location("azure-eastus2")
* .friendlyName("👋")
* .description("a riveting description")
* .azure(ConnectionAzureArgs.builder()
* .customerTenantId("customer-tenant-id")
* .federatedApplicationClientId("b43eeeee-eeee-eeee-eeee-a480155501ce")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* connection:
* type: gcp:bigquery:Connection
* properties:
* connectionId: my-connection
* location: azure-eastus2
* friendlyName: "\U0001F44B"
* description: a riveting description
* azure:
* customerTenantId: customer-tenant-id
* federatedApplicationClientId: b43eeeee-eeee-eeee-eeee-a480155501ce
* ```
*
* ### Bigquery Connection Cloudspanner
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const connection = new gcp.bigquery.Connection("connection", {
* connectionId: "my-connection",
* location: "US",
* friendlyName: "👋",
* description: "a riveting description",
* cloudSpanner: {
* database: "projects/project/instances/instance/databases/database",
* databaseRole: "database_role",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* connection = gcp.bigquery.Connection("connection",
* connection_id="my-connection",
* location="US",
* friendly_name="👋",
* description="a riveting description",
* cloud_spanner={
* "database": "projects/project/instances/instance/databases/database",
* "database_role": "database_role",
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var connection = new Gcp.BigQuery.Connection("connection", new()
* {
* ConnectionId = "my-connection",
* Location = "US",
* FriendlyName = "👋",
* Description = "a riveting description",
* CloudSpanner = new Gcp.BigQuery.Inputs.ConnectionCloudSpannerArgs
* {
* Database = "projects/project/instances/instance/databases/database",
* DatabaseRole = "database_role",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := bigquery.NewConnection(ctx, "connection", &bigquery.ConnectionArgs{
* ConnectionId: pulumi.String("my-connection"),
* Location: pulumi.String("US"),
* FriendlyName: pulumi.String("👋"),
* Description: pulumi.String("a riveting description"),
* CloudSpanner: &bigquery.ConnectionCloudSpannerArgs{
* Database: pulumi.String("projects/project/instances/instance/databases/database"),
* DatabaseRole: pulumi.String("database_role"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.bigquery.Connection;
* import com.pulumi.gcp.bigquery.ConnectionArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionCloudSpannerArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var connection = new Connection("connection", ConnectionArgs.builder()
* .connectionId("my-connection")
* .location("US")
* .friendlyName("👋")
* .description("a riveting description")
* .cloudSpanner(ConnectionCloudSpannerArgs.builder()
* .database("projects/project/instances/instance/databases/database")
* .databaseRole("database_role")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* connection:
* type: gcp:bigquery:Connection
* properties:
* connectionId: my-connection
* location: US
* friendlyName: "\U0001F44B"
* description: a riveting description
* cloudSpanner:
* database: projects/project/instances/instance/databases/database
* databaseRole: database_role
* ```
*
* ### Bigquery Connection Cloudspanner Databoost
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const connection = new gcp.bigquery.Connection("connection", {
* connectionId: "my-connection",
* location: "US",
* friendlyName: "👋",
* description: "a riveting description",
* cloudSpanner: {
* database: "projects/project/instances/instance/databases/database",
* useParallelism: true,
* useDataBoost: true,
* maxParallelism: 100,
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* connection = gcp.bigquery.Connection("connection",
* connection_id="my-connection",
* location="US",
* friendly_name="👋",
* description="a riveting description",
* cloud_spanner={
* "database": "projects/project/instances/instance/databases/database",
* "use_parallelism": True,
* "use_data_boost": True,
* "max_parallelism": 100,
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var connection = new Gcp.BigQuery.Connection("connection", new()
* {
* ConnectionId = "my-connection",
* Location = "US",
* FriendlyName = "👋",
* Description = "a riveting description",
* CloudSpanner = new Gcp.BigQuery.Inputs.ConnectionCloudSpannerArgs
* {
* Database = "projects/project/instances/instance/databases/database",
* UseParallelism = true,
* UseDataBoost = true,
* MaxParallelism = 100,
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := bigquery.NewConnection(ctx, "connection", &bigquery.ConnectionArgs{
* ConnectionId: pulumi.String("my-connection"),
* Location: pulumi.String("US"),
* FriendlyName: pulumi.String("👋"),
* Description: pulumi.String("a riveting description"),
* CloudSpanner: &bigquery.ConnectionCloudSpannerArgs{
* Database: pulumi.String("projects/project/instances/instance/databases/database"),
* UseParallelism: pulumi.Bool(true),
* UseDataBoost: pulumi.Bool(true),
* MaxParallelism: pulumi.Int(100),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.bigquery.Connection;
* import com.pulumi.gcp.bigquery.ConnectionArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionCloudSpannerArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var connection = new Connection("connection", ConnectionArgs.builder()
* .connectionId("my-connection")
* .location("US")
* .friendlyName("👋")
* .description("a riveting description")
* .cloudSpanner(ConnectionCloudSpannerArgs.builder()
* .database("projects/project/instances/instance/databases/database")
* .useParallelism(true)
* .useDataBoost(true)
* .maxParallelism(100)
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* connection:
* type: gcp:bigquery:Connection
* properties:
* connectionId: my-connection
* location: US
* friendlyName: "\U0001F44B"
* description: a riveting description
* cloudSpanner:
* database: projects/project/instances/instance/databases/database
* useParallelism: true
* useDataBoost: true
* maxParallelism: 100
* ```
*
* ### Bigquery Connection Spark
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const basic = new gcp.dataproc.Cluster("basic", {
* name: "my-connection",
* region: "us-central1",
* clusterConfig: {
* softwareConfig: {
* overrideProperties: {
* "dataproc:dataproc.allow.zero.workers": "true",
* },
* },
* masterConfig: {
* numInstances: 1,
* machineType: "e2-standard-2",
* diskConfig: {
* bootDiskSizeGb: 35,
* },
* },
* },
* });
* const connection = new gcp.bigquery.Connection("connection", {
* connectionId: "my-connection",
* location: "US",
* friendlyName: "👋",
* description: "a riveting description",
* spark: {
* sparkHistoryServerConfig: {
* dataprocCluster: basic.id,
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* basic = gcp.dataproc.Cluster("basic",
* name="my-connection",
* region="us-central1",
* cluster_config={
* "software_config": {
* "override_properties": {
* "dataproc_dataproc_allow_zero_workers": "true",
* },
* },
* "master_config": {
* "num_instances": 1,
* "machine_type": "e2-standard-2",
* "disk_config": {
* "boot_disk_size_gb": 35,
* },
* },
* })
* connection = gcp.bigquery.Connection("connection",
* connection_id="my-connection",
* location="US",
* friendly_name="👋",
* description="a riveting description",
* spark={
* "spark_history_server_config": {
* "dataproc_cluster": basic.id,
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var basic = new Gcp.Dataproc.Cluster("basic", new()
* {
* Name = "my-connection",
* Region = "us-central1",
* ClusterConfig = new Gcp.Dataproc.Inputs.ClusterClusterConfigArgs
* {
* SoftwareConfig = new Gcp.Dataproc.Inputs.ClusterClusterConfigSoftwareConfigArgs
* {
* OverrideProperties =
* {
* { "dataproc:dataproc.allow.zero.workers", "true" },
* },
* },
* MasterConfig = new Gcp.Dataproc.Inputs.ClusterClusterConfigMasterConfigArgs
* {
* NumInstances = 1,
* MachineType = "e2-standard-2",
* DiskConfig = new Gcp.Dataproc.Inputs.ClusterClusterConfigMasterConfigDiskConfigArgs
* {
* BootDiskSizeGb = 35,
* },
* },
* },
* });
* var connection = new Gcp.BigQuery.Connection("connection", new()
* {
* ConnectionId = "my-connection",
* Location = "US",
* FriendlyName = "👋",
* Description = "a riveting description",
* Spark = new Gcp.BigQuery.Inputs.ConnectionSparkArgs
* {
* SparkHistoryServerConfig = new Gcp.BigQuery.Inputs.ConnectionSparkSparkHistoryServerConfigArgs
* {
* DataprocCluster = basic.Id,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/dataproc"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* basic, err := dataproc.NewCluster(ctx, "basic", &dataproc.ClusterArgs{
* Name: pulumi.String("my-connection"),
* Region: pulumi.String("us-central1"),
* ClusterConfig: &dataproc.ClusterClusterConfigArgs{
* SoftwareConfig: &dataproc.ClusterClusterConfigSoftwareConfigArgs{
* OverrideProperties: pulumi.StringMap{
* "dataproc:dataproc.allow.zero.workers": pulumi.String("true"),
* },
* },
* MasterConfig: &dataproc.ClusterClusterConfigMasterConfigArgs{
* NumInstances: pulumi.Int(1),
* MachineType: pulumi.String("e2-standard-2"),
* DiskConfig: &dataproc.ClusterClusterConfigMasterConfigDiskConfigArgs{
* BootDiskSizeGb: pulumi.Int(35),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = bigquery.NewConnection(ctx, "connection", &bigquery.ConnectionArgs{
* ConnectionId: pulumi.String("my-connection"),
* Location: pulumi.String("US"),
* FriendlyName: pulumi.String("👋"),
* Description: pulumi.String("a riveting description"),
* Spark: &bigquery.ConnectionSparkArgs{
* SparkHistoryServerConfig: &bigquery.ConnectionSparkSparkHistoryServerConfigArgs{
* DataprocCluster: basic.ID(),
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.dataproc.Cluster;
* import com.pulumi.gcp.dataproc.ClusterArgs;
* import com.pulumi.gcp.dataproc.inputs.ClusterClusterConfigArgs;
* import com.pulumi.gcp.dataproc.inputs.ClusterClusterConfigSoftwareConfigArgs;
* import com.pulumi.gcp.dataproc.inputs.ClusterClusterConfigMasterConfigArgs;
* import com.pulumi.gcp.dataproc.inputs.ClusterClusterConfigMasterConfigDiskConfigArgs;
* import com.pulumi.gcp.bigquery.Connection;
* import com.pulumi.gcp.bigquery.ConnectionArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionSparkArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionSparkSparkHistoryServerConfigArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var basic = new Cluster("basic", ClusterArgs.builder()
* .name("my-connection")
* .region("us-central1")
* .clusterConfig(ClusterClusterConfigArgs.builder()
* .softwareConfig(ClusterClusterConfigSoftwareConfigArgs.builder()
* .overrideProperties(Map.of("dataproc:dataproc.allow.zero.workers", "true"))
* .build())
* .masterConfig(ClusterClusterConfigMasterConfigArgs.builder()
* .numInstances(1)
* .machineType("e2-standard-2")
* .diskConfig(ClusterClusterConfigMasterConfigDiskConfigArgs.builder()
* .bootDiskSizeGb(35)
* .build())
* .build())
* .build())
* .build());
* var connection = new Connection("connection", ConnectionArgs.builder()
* .connectionId("my-connection")
* .location("US")
* .friendlyName("👋")
* .description("a riveting description")
* .spark(ConnectionSparkArgs.builder()
* .sparkHistoryServerConfig(ConnectionSparkSparkHistoryServerConfigArgs.builder()
* .dataprocCluster(basic.id())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* connection:
* type: gcp:bigquery:Connection
* properties:
* connectionId: my-connection
* location: US
* friendlyName: "\U0001F44B"
* description: a riveting description
* spark:
* sparkHistoryServerConfig:
* dataprocCluster: ${basic.id}
* basic:
* type: gcp:dataproc:Cluster
* properties:
* name: my-connection
* region: us-central1
* clusterConfig:
* softwareConfig:
* overrideProperties:
* dataproc:dataproc.allow.zero.workers: 'true'
* masterConfig:
* numInstances: 1
* machineType: e2-standard-2
* diskConfig:
* bootDiskSizeGb: 35
* ```
*
* ### Bigquery Connection Kms
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const instance = new gcp.sql.DatabaseInstance("instance", {
* name: "my-database-instance",
* databaseVersion: "POSTGRES_11",
* region: "us-central1",
* settings: {
* tier: "db-f1-micro",
* },
* deletionProtection: true,
* });
* const db = new gcp.sql.Database("db", {
* instance: instance.name,
* name: "db",
* });
* const user = new gcp.sql.User("user", {
* name: "user",
* instance: instance.name,
* password: "tf-test-my-password_77884",
* });
* const bqSa = gcp.bigquery.getDefaultServiceAccount({});
* const project = gcp.organizations.getProject({});
* const keySaUser = new gcp.projects.IAMMember("key_sa_user", {
* project: project.then(project => project.projectId),
* role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
* member: bqSa.then(bqSa => `serviceAccount:${bqSa.email}`),
* });
* const bq_connection_cmek = new gcp.bigquery.Connection("bq-connection-cmek", {
* friendlyName: "👋",
* description: "a riveting description",
* location: "US",
* kmsKeyName: "projects/project/locations/us-central1/keyRings/us-central1/cryptoKeys/bq-key",
* cloudSql: {
* instanceId: instance.connectionName,
* database: db.name,
* type: "POSTGRES",
* credential: {
* username: user.name,
* password: user.password,
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* instance = gcp.sql.DatabaseInstance("instance",
* name="my-database-instance",
* database_version="POSTGRES_11",
* region="us-central1",
* settings={
* "tier": "db-f1-micro",
* },
* deletion_protection=True)
* db = gcp.sql.Database("db",
* instance=instance.name,
* name="db")
* user = gcp.sql.User("user",
* name="user",
* instance=instance.name,
* password="tf-test-my-password_77884")
* bq_sa = gcp.bigquery.get_default_service_account()
* project = gcp.organizations.get_project()
* key_sa_user = gcp.projects.IAMMember("key_sa_user",
* project=project.project_id,
* role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
* member=f"serviceAccount:{bq_sa.email}")
* bq_connection_cmek = gcp.bigquery.Connection("bq-connection-cmek",
* friendly_name="👋",
* description="a riveting description",
* location="US",
* kms_key_name="projects/project/locations/us-central1/keyRings/us-central1/cryptoKeys/bq-key",
* cloud_sql={
* "instance_id": instance.connection_name,
* "database": db.name,
* "type": "POSTGRES",
* "credential": {
* "username": user.name,
* "password": user.password,
* },
* })
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var instance = new Gcp.Sql.DatabaseInstance("instance", new()
* {
* Name = "my-database-instance",
* DatabaseVersion = "POSTGRES_11",
* Region = "us-central1",
* Settings = new Gcp.Sql.Inputs.DatabaseInstanceSettingsArgs
* {
* Tier = "db-f1-micro",
* },
* DeletionProtection = true,
* });
* var db = new Gcp.Sql.Database("db", new()
* {
* Instance = instance.Name,
* Name = "db",
* });
* var user = new Gcp.Sql.User("user", new()
* {
* Name = "user",
* Instance = instance.Name,
* Password = "tf-test-my-password_77884",
* });
* var bqSa = Gcp.BigQuery.GetDefaultServiceAccount.Invoke();
* var project = Gcp.Organizations.GetProject.Invoke();
* var keySaUser = new Gcp.Projects.IAMMember("key_sa_user", new()
* {
* Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
* Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
* Member = $"serviceAccount:{bqSa.Apply(getDefaultServiceAccountResult => getDefaultServiceAccountResult.Email)}",
* });
* var bq_connection_cmek = new Gcp.BigQuery.Connection("bq-connection-cmek", new()
* {
* FriendlyName = "👋",
* Description = "a riveting description",
* Location = "US",
* KmsKeyName = "projects/project/locations/us-central1/keyRings/us-central1/cryptoKeys/bq-key",
* CloudSql = new Gcp.BigQuery.Inputs.ConnectionCloudSqlArgs
* {
* InstanceId = instance.ConnectionName,
* Database = db.Name,
* Type = "POSTGRES",
* Credential = new Gcp.BigQuery.Inputs.ConnectionCloudSqlCredentialArgs
* {
* Username = user.Name,
* Password = user.Password,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/sql"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* instance, err := sql.NewDatabaseInstance(ctx, "instance", &sql.DatabaseInstanceArgs{
* Name: pulumi.String("my-database-instance"),
* DatabaseVersion: pulumi.String("POSTGRES_11"),
* Region: pulumi.String("us-central1"),
* Settings: &sql.DatabaseInstanceSettingsArgs{
* Tier: pulumi.String("db-f1-micro"),
* },
* DeletionProtection: pulumi.Bool(true),
* })
* if err != nil {
* return err
* }
* db, err := sql.NewDatabase(ctx, "db", &sql.DatabaseArgs{
* Instance: instance.Name,
* Name: pulumi.String("db"),
* })
* if err != nil {
* return err
* }
* user, err := sql.NewUser(ctx, "user", &sql.UserArgs{
* Name: pulumi.String("user"),
* Instance: instance.Name,
* Password: pulumi.String("tf-test-my-password_77884"),
* })
* if err != nil {
* return err
* }
* bqSa, err := bigquery.GetDefaultServiceAccount(ctx, nil, nil)
* if err != nil {
* return err
* }
* project, err := organizations.LookupProject(ctx, nil, nil)
* if err != nil {
* return err
* }
* _, err = projects.NewIAMMember(ctx, "key_sa_user", &projects.IAMMemberArgs{
* Project: pulumi.String(project.ProjectId),
* Role: pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
* Member: pulumi.Sprintf("serviceAccount:%v", bqSa.Email),
* })
* if err != nil {
* return err
* }
* _, err = bigquery.NewConnection(ctx, "bq-connection-cmek", &bigquery.ConnectionArgs{
* FriendlyName: pulumi.String("👋"),
* Description: pulumi.String("a riveting description"),
* Location: pulumi.String("US"),
* KmsKeyName: pulumi.String("projects/project/locations/us-central1/keyRings/us-central1/cryptoKeys/bq-key"),
* CloudSql: &bigquery.ConnectionCloudSqlArgs{
* InstanceId: instance.ConnectionName,
* Database: db.Name,
* Type: pulumi.String("POSTGRES"),
* Credential: &bigquery.ConnectionCloudSqlCredentialArgs{
* Username: user.Name,
* Password: user.Password,
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.sql.DatabaseInstance;
* import com.pulumi.gcp.sql.DatabaseInstanceArgs;
* import com.pulumi.gcp.sql.inputs.DatabaseInstanceSettingsArgs;
* import com.pulumi.gcp.sql.Database;
* import com.pulumi.gcp.sql.DatabaseArgs;
* import com.pulumi.gcp.sql.User;
* import com.pulumi.gcp.sql.UserArgs;
* import com.pulumi.gcp.bigquery.BigqueryFunctions;
* import com.pulumi.gcp.bigquery.inputs.GetDefaultServiceAccountArgs;
* import com.pulumi.gcp.organizations.OrganizationsFunctions;
* import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
* import com.pulumi.gcp.projects.IAMMember;
* import com.pulumi.gcp.projects.IAMMemberArgs;
* import com.pulumi.gcp.bigquery.Connection;
* import com.pulumi.gcp.bigquery.ConnectionArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionCloudSqlArgs;
* import com.pulumi.gcp.bigquery.inputs.ConnectionCloudSqlCredentialArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var instance = new DatabaseInstance("instance", DatabaseInstanceArgs.builder()
* .name("my-database-instance")
* .databaseVersion("POSTGRES_11")
* .region("us-central1")
* .settings(DatabaseInstanceSettingsArgs.builder()
* .tier("db-f1-micro")
* .build())
* .deletionProtection("true")
* .build());
* var db = new Database("db", DatabaseArgs.builder()
* .instance(instance.name())
* .name("db")
* .build());
* var user = new User("user", UserArgs.builder()
* .name("user")
* .instance(instance.name())
* .password("tf-test-my-password_77884")
* .build());
* final var bqSa = BigqueryFunctions.getDefaultServiceAccount();
* final var project = OrganizationsFunctions.getProject();
* var keySaUser = new IAMMember("keySaUser", IAMMemberArgs.builder()
* .project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
* .role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
* .member(String.format("serviceAccount:%s", bqSa.applyValue(getDefaultServiceAccountResult -> getDefaultServiceAccountResult.email())))
* .build());
* var bq_connection_cmek = new Connection("bq-connection-cmek", ConnectionArgs.builder()
* .friendlyName("👋")
* .description("a riveting description")
* .location("US")
* .kmsKeyName("projects/project/locations/us-central1/keyRings/us-central1/cryptoKeys/bq-key")
* .cloudSql(ConnectionCloudSqlArgs.builder()
* .instanceId(instance.connectionName())
* .database(db.name())
* .type("POSTGRES")
* .credential(ConnectionCloudSqlCredentialArgs.builder()
* .username(user.name())
* .password(user.password())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* instance:
* type: gcp:sql:DatabaseInstance
* properties:
* name: my-database-instance
* databaseVersion: POSTGRES_11
* region: us-central1
* settings:
* tier: db-f1-micro
* deletionProtection: 'true'
* db:
* type: gcp:sql:Database
* properties:
* instance: ${instance.name}
* name: db
* user:
* type: gcp:sql:User
* properties:
* name: user
* instance: ${instance.name}
* password: tf-test-my-password_77884
* keySaUser:
* type: gcp:projects:IAMMember
* name: key_sa_user
* properties:
* project: ${project.projectId}
* role: roles/cloudkms.cryptoKeyEncrypterDecrypter
* member: serviceAccount:${bqSa.email}
* bq-connection-cmek:
* type: gcp:bigquery:Connection
* properties:
* friendlyName: "\U0001F44B"
* description: a riveting description
* location: US
* kmsKeyName: projects/project/locations/us-central1/keyRings/us-central1/cryptoKeys/bq-key
* cloudSql:
* instanceId: ${instance.connectionName}
* database: ${db.name}
* type: POSTGRES
* credential:
* username: ${user.name}
* password: ${user.password}
* variables:
* bqSa:
* fn::invoke:
* Function: gcp:bigquery:getDefaultServiceAccount
* Arguments: {}
* project:
* fn::invoke:
* Function: gcp:organizations:getProject
* Arguments: {}
* ```
*
* ## Import
* Connection can be imported using any of these accepted formats:
* * `projects/{{project}}/locations/{{location}}/connections/{{connection_id}}`
* * `{{project}}/{{location}}/{{connection_id}}`
* * `{{location}}/{{connection_id}}`
* When using the `pulumi import` command, Connection can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:bigquery/connection:Connection default projects/{{project}}/locations/{{location}}/connections/{{connection_id}}
* ```
* ```sh
* $ pulumi import gcp:bigquery/connection:Connection default {{project}}/{{location}}/{{connection_id}}
* ```
* ```sh
* $ pulumi import gcp:bigquery/connection:Connection default {{location}}/{{connection_id}}
* ```
*/
public class Connection internal constructor(
override val javaResource: com.pulumi.gcp.bigquery.Connection,
) : KotlinCustomResource(javaResource, ConnectionMapper) {
/**
* Connection properties specific to Amazon Web Services.
* Structure is documented below.
*/
public val aws: Output?
get() = javaResource.aws().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
connectionAwsToKotlin(args0)
})
}).orElse(null)
})
/**
* Container for connection properties specific to Azure.
* Structure is documented below.
*/
public val azure: Output?
get() = javaResource.azure().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
connectionAzureToKotlin(args0)
})
}).orElse(null)
})
/**
* Container for connection properties for delegation of access to GCP resources.
* Structure is documented below.
*/
public val cloudResource: Output?
get() = javaResource.cloudResource().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> connectionCloudResourceToKotlin(args0) })
}).orElse(null)
})
/**
* Connection properties specific to Cloud Spanner
* Structure is documented below.
*/
public val cloudSpanner: Output?
get() = javaResource.cloudSpanner().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
connectionCloudSpannerToKotlin(args0)
})
}).orElse(null)
})
/**
* Connection properties specific to the Cloud SQL.
* Structure is documented below.
*/
public val cloudSql: Output?
get() = javaResource.cloudSql().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
connectionCloudSqlToKotlin(args0)
})
}).orElse(null)
})
/**
* Optional connection id that should be assigned to the created connection.
*/
public val connectionId: Output
get() = javaResource.connectionId().applyValue({ args0 -> args0 })
/**
* A descriptive description for the connection
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A descriptive name for the connection
*/
public val friendlyName: Output?
get() = javaResource.friendlyName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* True if the connection has credential assigned.
*/
public val hasCredential: Output
get() = javaResource.hasCredential().applyValue({ args0 -> args0 })
/**
* Optional. The Cloud KMS key that is used for encryption.
* Example: projects/[kms_project_id]/locations/[region]/keyRings/[key_region]/cryptoKeys/[key]
*/
public val kmsKeyName: Output?
get() = javaResource.kmsKeyName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The geographic location where the connection should reside.
* Cloud SQL instance must be in the same location as the connection
* with following exceptions: Cloud SQL us-central1 maps to BigQuery US, Cloud SQL europe-west1 maps to BigQuery EU.
* Examples: US, EU, asia-northeast1, us-central1, europe-west1.
* Spanner Connections same as spanner region
* AWS allowed regions are aws-us-east-1
* Azure allowed regions are azure-eastus2
*/
public val location: Output?
get() = javaResource.location().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* The resource name of the connection in the form of:
* "projects/{project_id}/locations/{location_id}/connections/{connectionId}"
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* Container for connection properties to execute stored procedures for Apache Spark. resources.
* Structure is documented below.
*/
public val spark: Output?
get() = javaResource.spark().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
connectionSparkToKotlin(args0)
})
}).orElse(null)
})
}
public object ConnectionMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.bigquery.Connection::class == javaResource::class
override fun map(javaResource: Resource): Connection = Connection(
javaResource as
com.pulumi.gcp.bigquery.Connection,
)
}
/**
* @see [Connection].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Connection].
*/
public suspend fun connection(name: String, block: suspend ConnectionResourceBuilder.() -> Unit): Connection {
val builder = ConnectionResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Connection].
* @param name The _unique_ name of the resulting resource.
*/
public fun connection(name: String): Connection {
val builder = ConnectionResourceBuilder()
builder.name(name)
return builder.build()
}