UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

704 lines (703 loc) • 28.6 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Creates a table resource in a dataset for Google BigQuery. For more information see * [the official documentation](https://cloud.google.com/bigquery/docs/) and * [API](https://cloud.google.com/bigquery/docs/reference/rest/v2/tables). * * > **Note**: On newer versions of the provider, you must explicitly set `deletion_protection=false` * (and run `pulumi update` to write the field to state) in order to destroy an instance. * It is recommended to not set this field (or set it to true) until you're ready to destroy. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.bigquery.Dataset("default", { * datasetId: "foo", * friendlyName: "test", * description: "This is a test description", * location: "EU", * defaultTableExpirationMs: 3600000, * labels: { * env: "default", * }, * }); * const defaultTable = new gcp.bigquery.Table("default", { * datasetId: _default.datasetId, * tableId: "bar", * timePartitioning: { * type: "DAY", * }, * labels: { * env: "default", * }, * schema: `[ * { * "name": "permalink", * "type": "STRING", * "mode": "NULLABLE", * "description": "The Permalink" * }, * { * "name": "state", * "type": "STRING", * "mode": "NULLABLE", * "description": "State where the head office is located" * } * ] * `, * }); * const sheet = new gcp.bigquery.Table("sheet", { * datasetId: _default.datasetId, * tableId: "sheet", * externalDataConfiguration: { * autodetect: true, * sourceFormat: "GOOGLE_SHEETS", * googleSheetsOptions: { * skipLeadingRows: 1, * }, * sourceUris: ["https://docs.google.com/spreadsheets/d/123456789012345"], * }, * }); * ``` * * ## Import * * BigQuery tables can be imported using any of these accepted formats: * * * `projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}}` * * * `{{project}}/{{dataset_id}}/{{table_id}}` * * * `{{dataset_id}}/{{table_id}}` * * When using the `pulumi import` command, BigQuery tables can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:bigquery/table:Table default projects/{{project}}/datasets/{{dataset_id}}/tables/{{table_id}} * ``` * * ```sh * $ pulumi import gcp:bigquery/table:Table default {{project}}/{{dataset_id}}/{{table_id}} * ``` * * ```sh * $ pulumi import gcp:bigquery/table:Table default {{dataset_id}}/{{table_id}} * ``` */ export declare class Table extends pulumi.CustomResource { /** * Get an existing Table 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?: TableState, opts?: pulumi.CustomResourceOptions): Table; /** * Returns true if the given object is an instance of Table. 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 Table; /** * Specifies the configuration of a BigLake managed table. Structure is documented below */ readonly biglakeConfiguration: pulumi.Output<outputs.bigquery.TableBiglakeConfiguration | undefined>; /** * Specifies column names to use for data clustering. * Up to four top-level columns are allowed, and should be specified in * descending priority order. */ readonly clusterings: pulumi.Output<string[] | undefined>; /** * The time when this table was created, in milliseconds since the epoch. */ readonly creationTime: pulumi.Output<number>; /** * The dataset ID to create the table in. * Changing this forces a new resource to be created. */ readonly datasetId: pulumi.Output<string>; /** * Whether or not to allow the provider to destroy the instance. Unless this field is set to false * in state, a `=destroy` or `=update` that would delete the instance will fail. */ readonly deletionProtection: pulumi.Output<boolean | undefined>; /** * The field description. */ readonly description: pulumi.Output<string | undefined>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. * * * <a name="schema"></a>`schema` - (Optional) A JSON schema for the table. * * ~>**NOTE:** Because this field expects a JSON string, any changes to the * string will create a diff, even if the JSON itself hasn't changed. * If the API returns a different value for the same schema, e.g. it * switched the order of values or replaced a field data type (`STRUCT` with * `RECORD`, `DECIMAL` with `NUMERIC`, etc.), we currently cannot suppress * the recurring diff this causes. As a workaround, we recommend using the * schema as returned by the API. * * ~>**NOTE:** If you use `externalDataConfiguration` * documented below and do **not** set * `external_data_configuration.connection_id`, schemas must be specified * with `external_data_configuration.schema`. Otherwise, schemas must be * specified with this top-level field. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * Specifies how the table should be encrypted. * If left blank, the table will be encrypted with a Google-managed key; that process * is transparent to the user. Structure is documented below. */ readonly encryptionConfiguration: pulumi.Output<outputs.bigquery.TableEncryptionConfiguration | undefined>; /** * A hash of the resource. */ readonly etag: pulumi.Output<string>; /** * The time when this table expires, in * milliseconds since the epoch. If not present, the table will persist * indefinitely. Expired tables will be deleted and their storage * reclaimed. */ readonly expirationTime: pulumi.Output<number>; /** * Options defining open source * compatible table. Structure is documented below. */ readonly externalCatalogTableOptions: pulumi.Output<outputs.bigquery.TableExternalCatalogTableOptions | undefined>; /** * Describes the data format, * location, and other properties of a table stored outside of BigQuery. * By defining these properties, the data source can then be queried as * if it were a standard BigQuery table. Structure is documented below. */ readonly externalDataConfiguration: pulumi.Output<outputs.bigquery.TableExternalDataConfiguration | undefined>; /** * A descriptive name for the table. */ readonly friendlyName: pulumi.Output<string | undefined>; /** * (Output-only) A list of autogenerated schema fields. */ readonly generatedSchemaColumns: pulumi.Output<string>; readonly ignoreAutoGeneratedSchema: pulumi.Output<boolean | undefined>; /** * A list of fields which should be ignored for each column in schema. * **NOTE:** Right now only `dataPolicies` field is supported. We might support others in the future. */ readonly ignoreSchemaChanges: pulumi.Output<string[] | undefined>; /** * A mapping of labels to assign to the resource. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field 'effective_labels' for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The time when this table was last modified, in milliseconds since the epoch. */ readonly lastModifiedTime: pulumi.Output<number>; /** * The geographic location where the table resides. This value is inherited from the dataset. */ readonly location: pulumi.Output<string>; /** * If specified, configures this table as a materialized view. * Structure is documented below. */ readonly materializedView: pulumi.Output<outputs.bigquery.TableMaterializedView | undefined>; /** * The maximum staleness of data that could be * returned when the table (or stale MV) is queried. Staleness encoded as a * string encoding of [SQL IntervalValue * type](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#interval_type). */ readonly maxStaleness: pulumi.Output<string>; /** * The size of this table in bytes, excluding any data in the streaming buffer. */ readonly numBytes: pulumi.Output<number>; /** * The number of bytes in the table that are considered "long-term storage". */ readonly numLongTermBytes: pulumi.Output<number>; /** * The number of rows of data in this table, excluding any data in the streaming buffer. */ readonly numRows: pulumi.Output<number>; /** * The ID of the project in which the resource belongs. If it * is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The combination of labels configured directly on the resource and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * If specified, configures range-based * partitioning for this table. Structure is documented below. */ readonly rangePartitioning: pulumi.Output<outputs.bigquery.TableRangePartitioning | undefined>; /** * If set to true, queries over this table * require a partition filter that can be used for partition elimination to be * specified. */ readonly requirePartitionFilter: pulumi.Output<boolean | undefined>; /** * The tags attached to this table. Tag keys are * globally unique. Tag key is expected to be in the namespaced format, for * example "123456789012/environment" where 123456789012 is the ID of the * parent organization or project resource for this tag key. Tag value is * expected to be the short name, for example "Production". See [Tag definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) * for more details. */ readonly resourceTags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * A JSON schema for the table. */ readonly schema: pulumi.Output<string>; /** * Specifies metadata of the foreign data * type definition in field schema. Structure is documented below. */ readonly schemaForeignTypeInfo: pulumi.Output<outputs.bigquery.TableSchemaForeignTypeInfo | undefined>; /** * The URI of the created resource. */ readonly selfLink: pulumi.Output<string>; /** * Defines the primary key and foreign keys. * Structure is documented below. */ readonly tableConstraints: pulumi.Output<outputs.bigquery.TableTableConstraints | undefined>; /** * A unique ID for the resource. * Changing this forces a new resource to be created. */ readonly tableId: pulumi.Output<string>; /** * View sets the optional parameter "view": Specifies the view that determines which table information is returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned. Possible values: TABLE_METADATA_VIEW_UNSPECIFIED, BASIC, STORAGE_STATS, FULL */ readonly tableMetadataView: pulumi.Output<string | undefined>; /** * Replication info of a table created * using "AS REPLICA" DDL like: * `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF srcMv`. * Structure is documented below. */ readonly tableReplicationInfo: pulumi.Output<outputs.bigquery.TableTableReplicationInfo | undefined>; /** * If specified, configures time-based * partitioning for this table. Structure is documented below. */ readonly timePartitioning: pulumi.Output<outputs.bigquery.TableTimePartitioning | undefined>; /** * Describes the table type. */ readonly type: pulumi.Output<string>; /** * If specified, configures this table as a view. * Structure is documented below. */ readonly view: pulumi.Output<outputs.bigquery.TableView | undefined>; /** * Create a Table 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: TableArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Table resources. */ export interface TableState { /** * Specifies the configuration of a BigLake managed table. Structure is documented below */ biglakeConfiguration?: pulumi.Input<inputs.bigquery.TableBiglakeConfiguration>; /** * Specifies column names to use for data clustering. * Up to four top-level columns are allowed, and should be specified in * descending priority order. */ clusterings?: pulumi.Input<pulumi.Input<string>[]>; /** * The time when this table was created, in milliseconds since the epoch. */ creationTime?: pulumi.Input<number>; /** * The dataset ID to create the table in. * Changing this forces a new resource to be created. */ datasetId?: pulumi.Input<string>; /** * Whether or not to allow the provider to destroy the instance. Unless this field is set to false * in state, a `=destroy` or `=update` that would delete the instance will fail. */ deletionProtection?: pulumi.Input<boolean>; /** * The field description. */ description?: pulumi.Input<string>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. * * * <a name="schema"></a>`schema` - (Optional) A JSON schema for the table. * * ~>**NOTE:** Because this field expects a JSON string, any changes to the * string will create a diff, even if the JSON itself hasn't changed. * If the API returns a different value for the same schema, e.g. it * switched the order of values or replaced a field data type (`STRUCT` with * `RECORD`, `DECIMAL` with `NUMERIC`, etc.), we currently cannot suppress * the recurring diff this causes. As a workaround, we recommend using the * schema as returned by the API. * * ~>**NOTE:** If you use `externalDataConfiguration` * documented below and do **not** set * `external_data_configuration.connection_id`, schemas must be specified * with `external_data_configuration.schema`. Otherwise, schemas must be * specified with this top-level field. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Specifies how the table should be encrypted. * If left blank, the table will be encrypted with a Google-managed key; that process * is transparent to the user. Structure is documented below. */ encryptionConfiguration?: pulumi.Input<inputs.bigquery.TableEncryptionConfiguration>; /** * A hash of the resource. */ etag?: pulumi.Input<string>; /** * The time when this table expires, in * milliseconds since the epoch. If not present, the table will persist * indefinitely. Expired tables will be deleted and their storage * reclaimed. */ expirationTime?: pulumi.Input<number>; /** * Options defining open source * compatible table. Structure is documented below. */ externalCatalogTableOptions?: pulumi.Input<inputs.bigquery.TableExternalCatalogTableOptions>; /** * Describes the data format, * location, and other properties of a table stored outside of BigQuery. * By defining these properties, the data source can then be queried as * if it were a standard BigQuery table. Structure is documented below. */ externalDataConfiguration?: pulumi.Input<inputs.bigquery.TableExternalDataConfiguration>; /** * A descriptive name for the table. */ friendlyName?: pulumi.Input<string>; /** * (Output-only) A list of autogenerated schema fields. */ generatedSchemaColumns?: pulumi.Input<string>; ignoreAutoGeneratedSchema?: pulumi.Input<boolean>; /** * A list of fields which should be ignored for each column in schema. * **NOTE:** Right now only `dataPolicies` field is supported. We might support others in the future. */ ignoreSchemaChanges?: pulumi.Input<pulumi.Input<string>[]>; /** * A mapping of labels to assign to the resource. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field 'effective_labels' for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The time when this table was last modified, in milliseconds since the epoch. */ lastModifiedTime?: pulumi.Input<number>; /** * The geographic location where the table resides. This value is inherited from the dataset. */ location?: pulumi.Input<string>; /** * If specified, configures this table as a materialized view. * Structure is documented below. */ materializedView?: pulumi.Input<inputs.bigquery.TableMaterializedView>; /** * The maximum staleness of data that could be * returned when the table (or stale MV) is queried. Staleness encoded as a * string encoding of [SQL IntervalValue * type](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#interval_type). */ maxStaleness?: pulumi.Input<string>; /** * The size of this table in bytes, excluding any data in the streaming buffer. */ numBytes?: pulumi.Input<number>; /** * The number of bytes in the table that are considered "long-term storage". */ numLongTermBytes?: pulumi.Input<number>; /** * The number of rows of data in this table, excluding any data in the streaming buffer. */ numRows?: pulumi.Input<number>; /** * The ID of the project in which the resource belongs. If it * is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The combination of labels configured directly on the resource and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * If specified, configures range-based * partitioning for this table. Structure is documented below. */ rangePartitioning?: pulumi.Input<inputs.bigquery.TableRangePartitioning>; /** * If set to true, queries over this table * require a partition filter that can be used for partition elimination to be * specified. */ requirePartitionFilter?: pulumi.Input<boolean>; /** * The tags attached to this table. Tag keys are * globally unique. Tag key is expected to be in the namespaced format, for * example "123456789012/environment" where 123456789012 is the ID of the * parent organization or project resource for this tag key. Tag value is * expected to be the short name, for example "Production". See [Tag definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) * for more details. */ resourceTags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * A JSON schema for the table. */ schema?: pulumi.Input<string>; /** * Specifies metadata of the foreign data * type definition in field schema. Structure is documented below. */ schemaForeignTypeInfo?: pulumi.Input<inputs.bigquery.TableSchemaForeignTypeInfo>; /** * The URI of the created resource. */ selfLink?: pulumi.Input<string>; /** * Defines the primary key and foreign keys. * Structure is documented below. */ tableConstraints?: pulumi.Input<inputs.bigquery.TableTableConstraints>; /** * A unique ID for the resource. * Changing this forces a new resource to be created. */ tableId?: pulumi.Input<string>; /** * View sets the optional parameter "view": Specifies the view that determines which table information is returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned. Possible values: TABLE_METADATA_VIEW_UNSPECIFIED, BASIC, STORAGE_STATS, FULL */ tableMetadataView?: pulumi.Input<string>; /** * Replication info of a table created * using "AS REPLICA" DDL like: * `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF srcMv`. * Structure is documented below. */ tableReplicationInfo?: pulumi.Input<inputs.bigquery.TableTableReplicationInfo>; /** * If specified, configures time-based * partitioning for this table. Structure is documented below. */ timePartitioning?: pulumi.Input<inputs.bigquery.TableTimePartitioning>; /** * Describes the table type. */ type?: pulumi.Input<string>; /** * If specified, configures this table as a view. * Structure is documented below. */ view?: pulumi.Input<inputs.bigquery.TableView>; } /** * The set of arguments for constructing a Table resource. */ export interface TableArgs { /** * Specifies the configuration of a BigLake managed table. Structure is documented below */ biglakeConfiguration?: pulumi.Input<inputs.bigquery.TableBiglakeConfiguration>; /** * Specifies column names to use for data clustering. * Up to four top-level columns are allowed, and should be specified in * descending priority order. */ clusterings?: pulumi.Input<pulumi.Input<string>[]>; /** * The dataset ID to create the table in. * Changing this forces a new resource to be created. */ datasetId: pulumi.Input<string>; /** * Whether or not to allow the provider to destroy the instance. Unless this field is set to false * in state, a `=destroy` or `=update` that would delete the instance will fail. */ deletionProtection?: pulumi.Input<boolean>; /** * The field description. */ description?: pulumi.Input<string>; /** * Specifies how the table should be encrypted. * If left blank, the table will be encrypted with a Google-managed key; that process * is transparent to the user. Structure is documented below. */ encryptionConfiguration?: pulumi.Input<inputs.bigquery.TableEncryptionConfiguration>; /** * The time when this table expires, in * milliseconds since the epoch. If not present, the table will persist * indefinitely. Expired tables will be deleted and their storage * reclaimed. */ expirationTime?: pulumi.Input<number>; /** * Options defining open source * compatible table. Structure is documented below. */ externalCatalogTableOptions?: pulumi.Input<inputs.bigquery.TableExternalCatalogTableOptions>; /** * Describes the data format, * location, and other properties of a table stored outside of BigQuery. * By defining these properties, the data source can then be queried as * if it were a standard BigQuery table. Structure is documented below. */ externalDataConfiguration?: pulumi.Input<inputs.bigquery.TableExternalDataConfiguration>; /** * A descriptive name for the table. */ friendlyName?: pulumi.Input<string>; ignoreAutoGeneratedSchema?: pulumi.Input<boolean>; /** * A list of fields which should be ignored for each column in schema. * **NOTE:** Right now only `dataPolicies` field is supported. We might support others in the future. */ ignoreSchemaChanges?: pulumi.Input<pulumi.Input<string>[]>; /** * A mapping of labels to assign to the resource. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field 'effective_labels' for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * If specified, configures this table as a materialized view. * Structure is documented below. */ materializedView?: pulumi.Input<inputs.bigquery.TableMaterializedView>; /** * The maximum staleness of data that could be * returned when the table (or stale MV) is queried. Staleness encoded as a * string encoding of [SQL IntervalValue * type](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#interval_type). */ maxStaleness?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. If it * is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * If specified, configures range-based * partitioning for this table. Structure is documented below. */ rangePartitioning?: pulumi.Input<inputs.bigquery.TableRangePartitioning>; /** * If set to true, queries over this table * require a partition filter that can be used for partition elimination to be * specified. */ requirePartitionFilter?: pulumi.Input<boolean>; /** * The tags attached to this table. Tag keys are * globally unique. Tag key is expected to be in the namespaced format, for * example "123456789012/environment" where 123456789012 is the ID of the * parent organization or project resource for this tag key. Tag value is * expected to be the short name, for example "Production". See [Tag definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) * for more details. */ resourceTags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * A JSON schema for the table. */ schema?: pulumi.Input<string>; /** * Specifies metadata of the foreign data * type definition in field schema. Structure is documented below. */ schemaForeignTypeInfo?: pulumi.Input<inputs.bigquery.TableSchemaForeignTypeInfo>; /** * Defines the primary key and foreign keys. * Structure is documented below. */ tableConstraints?: pulumi.Input<inputs.bigquery.TableTableConstraints>; /** * A unique ID for the resource. * Changing this forces a new resource to be created. */ tableId: pulumi.Input<string>; /** * View sets the optional parameter "view": Specifies the view that determines which table information is returned. By default, basic table information and storage statistics (STORAGE_STATS) are returned. Possible values: TABLE_METADATA_VIEW_UNSPECIFIED, BASIC, STORAGE_STATS, FULL */ tableMetadataView?: pulumi.Input<string>; /** * Replication info of a table created * using "AS REPLICA" DDL like: * `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF srcMv`. * Structure is documented below. */ tableReplicationInfo?: pulumi.Input<inputs.bigquery.TableTableReplicationInfo>; /** * If specified, configures time-based * partitioning for this table. Structure is documented below. */ timePartitioning?: pulumi.Input<inputs.bigquery.TableTimePartitioning>; /** * If specified, configures this table as a view. * Structure is documented below. */ view?: pulumi.Input<inputs.bigquery.TableView>; }