published on Wednesday, Jul 29, 2026 by Pulumi
published on Wednesday, Jul 29, 2026 by Pulumi
Represents a BigQuery Query Template within a Data Exchange. This resource defines a reusable SQL routine (e.g., a TVF) that can be shared or executed via the Data Exchange.
Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources.
To get more information about QueryTemplate, see:
- API documentation
- How-to Guides
Example Usage
Bigquery Analyticshub Querytemplate Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const me = gcp.organizations.getClientOpenIdUserInfo({});
const querytemplate = new gcp.bigqueryanalyticshub.DataExchange("querytemplate", {
displayName: "My Audience Data Exchange",
dataExchangeId: "my_data_exchange",
description: "example of query template",
location: "us",
sharingEnvironmentConfig: {
dcrExchangeConfig: {},
},
});
const querytemplateQueryTemplate = new gcp.bigqueryanalyticshub.QueryTemplate("querytemplate", {
location: "us",
dataExchangeId: querytemplate.dataExchangeId,
queryTemplateId: "my_query_template",
displayName: "my_query_template",
description: "example of query template",
primaryContact: me.then(me => me.email),
documentation: "This TVF takes a table t1 as input and returns all columns. Useful for basic data pass-through.",
routine: {
routineType: "TABLE_VALUED_FUNCTION",
definitionBody: "my_query_template() as (select * from t1)",
},
submit: false,
});
import pulumi
import pulumi_gcp as gcp
me = gcp.organizations.get_client_open_id_user_info()
querytemplate = gcp.bigqueryanalyticshub.DataExchange("querytemplate",
display_name="My Audience Data Exchange",
data_exchange_id="my_data_exchange",
description="example of query template",
location="us",
sharing_environment_config={
"dcr_exchange_config": {},
})
querytemplate_query_template = gcp.bigqueryanalyticshub.QueryTemplate("querytemplate",
location="us",
data_exchange_id=querytemplate.data_exchange_id,
query_template_id="my_query_template",
display_name="my_query_template",
description="example of query template",
primary_contact=me.email,
documentation="This TVF takes a table t1 as input and returns all columns. Useful for basic data pass-through.",
routine={
"routine_type": "TABLE_VALUED_FUNCTION",
"definition_body": "my_query_template() as (select * from t1)",
},
submit=False)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/bigqueryanalyticshub"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
me, err := organizations.GetClientOpenIdUserInfo(ctx, map[string]interface{}{}, nil)
if err != nil {
return err
}
querytemplate, err := bigqueryanalyticshub.NewDataExchange(ctx, "querytemplate", &bigqueryanalyticshub.DataExchangeArgs{
DisplayName: pulumi.String("My Audience Data Exchange"),
DataExchangeId: pulumi.String("my_data_exchange"),
Description: pulumi.String("example of query template"),
Location: pulumi.String("us"),
SharingEnvironmentConfig: &bigqueryanalyticshub.DataExchangeSharingEnvironmentConfigArgs{
DcrExchangeConfig: &bigqueryanalyticshub.DataExchangeSharingEnvironmentConfigDcrExchangeConfigArgs{},
},
})
if err != nil {
return err
}
_, err = bigqueryanalyticshub.NewQueryTemplate(ctx, "querytemplate", &bigqueryanalyticshub.QueryTemplateArgs{
Location: pulumi.String("us"),
DataExchangeId: querytemplate.DataExchangeId,
QueryTemplateId: pulumi.String("my_query_template"),
DisplayName: pulumi.String("my_query_template"),
Description: pulumi.String("example of query template"),
PrimaryContact: pulumi.String(me.Email),
Documentation: pulumi.String("This TVF takes a table t1 as input and returns all columns. Useful for basic data pass-through."),
Routine: &bigqueryanalyticshub.QueryTemplateRoutineArgs{
RoutineType: pulumi.String("TABLE_VALUED_FUNCTION"),
DefinitionBody: pulumi.String("my_query_template() as (select * from t1)"),
},
Submit: pulumi.Bool(false),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var me = Gcp.Organizations.GetClientOpenIdUserInfo.Invoke();
var querytemplate = new Gcp.BigQueryAnalyticsHub.DataExchange("querytemplate", new()
{
DisplayName = "My Audience Data Exchange",
DataExchangeId = "my_data_exchange",
Description = "example of query template",
Location = "us",
SharingEnvironmentConfig = new Gcp.BigQueryAnalyticsHub.Inputs.DataExchangeSharingEnvironmentConfigArgs
{
DcrExchangeConfig = null,
},
});
var querytemplateQueryTemplate = new Gcp.BigQueryAnalyticsHub.QueryTemplate("querytemplate", new()
{
Location = "us",
DataExchangeId = querytemplate.DataExchangeId,
QueryTemplateId = "my_query_template",
DisplayName = "my_query_template",
Description = "example of query template",
PrimaryContact = me.Apply(getClientOpenIdUserInfoResult => getClientOpenIdUserInfoResult.Email),
Documentation = "This TVF takes a table t1 as input and returns all columns. Useful for basic data pass-through.",
Routine = new Gcp.BigQueryAnalyticsHub.Inputs.QueryTemplateRoutineArgs
{
RoutineType = "TABLE_VALUED_FUNCTION",
DefinitionBody = "my_query_template() as (select * from t1)",
},
Submit = false,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.bigqueryanalyticshub.DataExchange;
import com.pulumi.gcp.bigqueryanalyticshub.DataExchangeArgs;
import com.pulumi.gcp.bigqueryanalyticshub.inputs.DataExchangeSharingEnvironmentConfigArgs;
import com.pulumi.gcp.bigqueryanalyticshub.inputs.DataExchangeSharingEnvironmentConfigDcrExchangeConfigArgs;
import com.pulumi.gcp.bigqueryanalyticshub.QueryTemplate;
import com.pulumi.gcp.bigqueryanalyticshub.QueryTemplateArgs;
import com.pulumi.gcp.bigqueryanalyticshub.inputs.QueryTemplateRoutineArgs;
import java.util.ArrayList;
import java.util.Arrays;
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) {
final var me = OrganizationsFunctions.getClientOpenIdUserInfo(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
var querytemplate = new DataExchange("querytemplate", DataExchangeArgs.builder()
.displayName("My Audience Data Exchange")
.dataExchangeId("my_data_exchange")
.description("example of query template")
.location("us")
.sharingEnvironmentConfig(DataExchangeSharingEnvironmentConfigArgs.builder()
.dcrExchangeConfig(DataExchangeSharingEnvironmentConfigDcrExchangeConfigArgs.builder()
.build())
.build())
.build());
var querytemplateQueryTemplate = new QueryTemplate("querytemplateQueryTemplate", QueryTemplateArgs.builder()
.location("us")
.dataExchangeId(querytemplate.dataExchangeId())
.queryTemplateId("my_query_template")
.displayName("my_query_template")
.description("example of query template")
.primaryContact(me.email())
.documentation("This TVF takes a table t1 as input and returns all columns. Useful for basic data pass-through.")
.routine(QueryTemplateRoutineArgs.builder()
.routineType("TABLE_VALUED_FUNCTION")
.definitionBody("my_query_template() as (select * from t1)")
.build())
.submit(false)
.build());
}
}
resources:
querytemplate:
type: gcp:bigqueryanalyticshub:DataExchange
properties:
displayName: My Audience Data Exchange
dataExchangeId: my_data_exchange
description: example of query template
location: us
sharingEnvironmentConfig:
dcrExchangeConfig: {}
querytemplateQueryTemplate:
type: gcp:bigqueryanalyticshub:QueryTemplate
name: querytemplate
properties:
location: us
dataExchangeId: ${querytemplate.dataExchangeId}
queryTemplateId: my_query_template
displayName: my_query_template
description: example of query template
primaryContact: ${me.email}
documentation: This TVF takes a table t1 as input and returns all columns. Useful for basic data pass-through.
routine:
routineType: TABLE_VALUED_FUNCTION
definitionBody: my_query_template() as (select * from t1)
submit: false
variables:
me:
fn::invoke:
function: gcp:organizations:getClientOpenIdUserInfo
arguments: {}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
data "gcp_organizations_getclientopeniduserinfo" "me" {
}
resource "gcp_bigqueryanalyticshub_dataexchange" "querytemplate" {
display_name = "My Audience Data Exchange"
data_exchange_id = "my_data_exchange"
description = "example of query template"
location = "us"
sharing_environment_config = {
dcr_exchange_config = {}
}
}
resource "gcp_bigqueryanalyticshub_querytemplate" "querytemplate" {
location = "us"
data_exchange_id = gcp_bigqueryanalyticshub_dataexchange.querytemplate.data_exchange_id
query_template_id = "my_query_template"
display_name = "my_query_template"
description = "example of query template"
primary_contact = data.gcp_organizations_getclientopeniduserinfo.me.email
documentation = "This TVF takes a table t1 as input and returns all columns. Useful for basic data pass-through."
routine = {
routine_type = "TABLE_VALUED_FUNCTION"
definition_body = "my_query_template() as (select * from t1)"
}
submit = false
}
Create QueryTemplate Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new QueryTemplate(name: string, args: QueryTemplateArgs, opts?: CustomResourceOptions);@overload
def QueryTemplate(resource_name: str,
args: QueryTemplateArgs,
opts: Optional[ResourceOptions] = None)
@overload
def QueryTemplate(resource_name: str,
opts: Optional[ResourceOptions] = None,
data_exchange_id: Optional[str] = None,
display_name: Optional[str] = None,
location: Optional[str] = None,
query_template_id: Optional[str] = None,
deletion_policy: Optional[str] = None,
description: Optional[str] = None,
documentation: Optional[str] = None,
primary_contact: Optional[str] = None,
project: Optional[str] = None,
routine: Optional[QueryTemplateRoutineArgs] = None,
submit: Optional[bool] = None)func NewQueryTemplate(ctx *Context, name string, args QueryTemplateArgs, opts ...ResourceOption) (*QueryTemplate, error)public QueryTemplate(string name, QueryTemplateArgs args, CustomResourceOptions? opts = null)
public QueryTemplate(String name, QueryTemplateArgs args)
public QueryTemplate(String name, QueryTemplateArgs args, CustomResourceOptions options)
type: gcp:bigqueryanalyticshub:QueryTemplate
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "gcp_bigqueryanalyticshub_query_template" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args QueryTemplateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args QueryTemplateArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args QueryTemplateArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args QueryTemplateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args QueryTemplateArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var queryTemplateResource = new Gcp.BigQueryAnalyticsHub.QueryTemplate("queryTemplateResource", new()
{
DataExchangeId = "string",
DisplayName = "string",
Location = "string",
QueryTemplateId = "string",
DeletionPolicy = "string",
Description = "string",
Documentation = "string",
PrimaryContact = "string",
Project = "string",
Routine = new Gcp.BigQueryAnalyticsHub.Inputs.QueryTemplateRoutineArgs
{
DefinitionBody = "string",
RoutineType = "string",
},
Submit = false,
});
example, err := bigqueryanalyticshub.NewQueryTemplate(ctx, "queryTemplateResource", &bigqueryanalyticshub.QueryTemplateArgs{
DataExchangeId: pulumi.String("string"),
DisplayName: pulumi.String("string"),
Location: pulumi.String("string"),
QueryTemplateId: pulumi.String("string"),
DeletionPolicy: pulumi.String("string"),
Description: pulumi.String("string"),
Documentation: pulumi.String("string"),
PrimaryContact: pulumi.String("string"),
Project: pulumi.String("string"),
Routine: &bigqueryanalyticshub.QueryTemplateRoutineArgs{
DefinitionBody: pulumi.String("string"),
RoutineType: pulumi.String("string"),
},
Submit: pulumi.Bool(false),
})
resource "gcp_bigqueryanalyticshub_query_template" "queryTemplateResource" {
lifecycle {
create_before_destroy = true
}
data_exchange_id = "string"
display_name = "string"
location = "string"
query_template_id = "string"
deletion_policy = "string"
description = "string"
documentation = "string"
primary_contact = "string"
project = "string"
routine = {
definition_body = "string"
routine_type = "string"
}
submit = false
}
var queryTemplateResource = new QueryTemplate("queryTemplateResource", QueryTemplateArgs.builder()
.dataExchangeId("string")
.displayName("string")
.location("string")
.queryTemplateId("string")
.deletionPolicy("string")
.description("string")
.documentation("string")
.primaryContact("string")
.project("string")
.routine(QueryTemplateRoutineArgs.builder()
.definitionBody("string")
.routineType("string")
.build())
.submit(false)
.build());
query_template_resource = gcp.bigqueryanalyticshub.QueryTemplate("queryTemplateResource",
data_exchange_id="string",
display_name="string",
location="string",
query_template_id="string",
deletion_policy="string",
description="string",
documentation="string",
primary_contact="string",
project="string",
routine={
"definition_body": "string",
"routine_type": "string",
},
submit=False)
const queryTemplateResource = new gcp.bigqueryanalyticshub.QueryTemplate("queryTemplateResource", {
dataExchangeId: "string",
displayName: "string",
location: "string",
queryTemplateId: "string",
deletionPolicy: "string",
description: "string",
documentation: "string",
primaryContact: "string",
project: "string",
routine: {
definitionBody: "string",
routineType: "string",
},
submit: false,
});
type: gcp:bigqueryanalyticshub:QueryTemplate
properties:
dataExchangeId: string
deletionPolicy: string
description: string
displayName: string
documentation: string
location: string
primaryContact: string
project: string
queryTemplateId: string
routine:
definitionBody: string
routineType: string
submit: false
QueryTemplate Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The QueryTemplate resource accepts the following input properties:
- Data
Exchange stringId - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- Display
Name string - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- Location string
- The name of the location this data exchange query template.
- Query
Template stringId - Unique QueryTemplate ID.
- Deletion
Policy string - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- Description string
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- Documentation string
- Documentation describing the QueryTemplate.
- Primary
Contact string - Email or URL of the primary point of contact of the QueryTemplate.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Routine
Query
Template Routine - The routine associated with the QueryTemplate. Structure is documented below.
- Submit bool
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action.
- Data
Exchange stringId - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- Display
Name string - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- Location string
- The name of the location this data exchange query template.
- Query
Template stringId - Unique QueryTemplate ID.
- Deletion
Policy string - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- Description string
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- Documentation string
- Documentation describing the QueryTemplate.
- Primary
Contact string - Email or URL of the primary point of contact of the QueryTemplate.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Routine
Query
Template Routine Args - The routine associated with the QueryTemplate. Structure is documented below.
- Submit bool
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action.
- data_
exchange_ stringid - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- display_
name string - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- location string
- The name of the location this data exchange query template.
- query_
template_ stringid - Unique QueryTemplate ID.
- deletion_
policy string - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- description string
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- documentation string
- Documentation describing the QueryTemplate.
- primary_
contact string - Email or URL of the primary point of contact of the QueryTemplate.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- routine object
- The routine associated with the QueryTemplate. Structure is documented below.
- submit bool
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action.
- data
Exchange StringId - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- display
Name String - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- location String
- The name of the location this data exchange query template.
- query
Template StringId - Unique QueryTemplate ID.
- deletion
Policy String - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- description String
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- documentation String
- Documentation describing the QueryTemplate.
- primary
Contact String - Email or URL of the primary point of contact of the QueryTemplate.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- routine
Query
Template Routine - The routine associated with the QueryTemplate. Structure is documented below.
- submit Boolean
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action.
- data
Exchange stringId - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- display
Name string - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- location string
- The name of the location this data exchange query template.
- query
Template stringId - Unique QueryTemplate ID.
- deletion
Policy string - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- description string
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- documentation string
- Documentation describing the QueryTemplate.
- primary
Contact string - Email or URL of the primary point of contact of the QueryTemplate.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- routine
Query
Template Routine - The routine associated with the QueryTemplate. Structure is documented below.
- submit boolean
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action.
- data_
exchange_ strid - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- display_
name str - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- location str
- The name of the location this data exchange query template.
- query_
template_ strid - Unique QueryTemplate ID.
- deletion_
policy str - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- description str
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- documentation str
- Documentation describing the QueryTemplate.
- primary_
contact str - Email or URL of the primary point of contact of the QueryTemplate.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- routine
Query
Template Routine Args - The routine associated with the QueryTemplate. Structure is documented below.
- submit bool
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action.
- data
Exchange StringId - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- display
Name String - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- location String
- The name of the location this data exchange query template.
- query
Template StringId - Unique QueryTemplate ID.
- deletion
Policy String - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- description String
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- documentation String
- Documentation describing the QueryTemplate.
- primary
Contact String - Email or URL of the primary point of contact of the QueryTemplate.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- routine Property Map
- The routine associated with the QueryTemplate. Structure is documented below.
- submit Boolean
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action.
Outputs
All input properties are implicitly available as output properties. Additionally, the QueryTemplate resource produces the following output properties:
- Create
Time string - Timestamp when the QueryTemplate was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - State string
- The QueryTemplate lifecycle state.
- Update
Time string - Timestamp when the QueryTemplate was last modified.
- Create
Time string - Timestamp when the QueryTemplate was created.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - State string
- The QueryTemplate lifecycle state.
- Update
Time string - Timestamp when the QueryTemplate was last modified.
- create_
time string - Timestamp when the QueryTemplate was created.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - state string
- The QueryTemplate lifecycle state.
- update_
time string - Timestamp when the QueryTemplate was last modified.
- create
Time String - Timestamp when the QueryTemplate was created.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - state String
- The QueryTemplate lifecycle state.
- update
Time String - Timestamp when the QueryTemplate was last modified.
- create
Time string - Timestamp when the QueryTemplate was created.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - state string
- The QueryTemplate lifecycle state.
- update
Time string - Timestamp when the QueryTemplate was last modified.
- create_
time str - Timestamp when the QueryTemplate was created.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - state str
- The QueryTemplate lifecycle state.
- update_
time str - Timestamp when the QueryTemplate was last modified.
- create
Time String - Timestamp when the QueryTemplate was created.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - state String
- The QueryTemplate lifecycle state.
- update
Time String - Timestamp when the QueryTemplate was last modified.
Look up Existing QueryTemplate Resource
Get an existing QueryTemplate resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: QueryTemplateState, opts?: CustomResourceOptions): QueryTemplate@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
create_time: Optional[str] = None,
data_exchange_id: Optional[str] = None,
deletion_policy: Optional[str] = None,
description: Optional[str] = None,
display_name: Optional[str] = None,
documentation: Optional[str] = None,
location: Optional[str] = None,
name: Optional[str] = None,
primary_contact: Optional[str] = None,
project: Optional[str] = None,
query_template_id: Optional[str] = None,
routine: Optional[QueryTemplateRoutineArgs] = None,
state: Optional[str] = None,
submit: Optional[bool] = None,
update_time: Optional[str] = None) -> QueryTemplatefunc GetQueryTemplate(ctx *Context, name string, id IDInput, state *QueryTemplateState, opts ...ResourceOption) (*QueryTemplate, error)public static QueryTemplate Get(string name, Input<string> id, QueryTemplateState? state, CustomResourceOptions? opts = null)public static QueryTemplate get(String name, Output<String> id, QueryTemplateState state, CustomResourceOptions options)resources: _: type: gcp:bigqueryanalyticshub:QueryTemplate get: id: ${id}import {
to = gcp_bigqueryanalyticshub_query_template.example
id = "${id}"
}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Create
Time string - Timestamp when the QueryTemplate was created.
- Data
Exchange stringId - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- Deletion
Policy string - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- Description string
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- Display
Name string - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- Documentation string
- Documentation describing the QueryTemplate.
- Location string
- The name of the location this data exchange query template.
- Name string
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - Primary
Contact string - Email or URL of the primary point of contact of the QueryTemplate.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Query
Template stringId - Unique QueryTemplate ID.
- Routine
Query
Template Routine - The routine associated with the QueryTemplate. Structure is documented below.
- State string
- The QueryTemplate lifecycle state.
- Submit bool
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action. - Update
Time string - Timestamp when the QueryTemplate was last modified.
- Create
Time string - Timestamp when the QueryTemplate was created.
- Data
Exchange stringId - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- Deletion
Policy string - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- Description string
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- Display
Name string - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- Documentation string
- Documentation describing the QueryTemplate.
- Location string
- The name of the location this data exchange query template.
- Name string
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - Primary
Contact string - Email or URL of the primary point of contact of the QueryTemplate.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Query
Template stringId - Unique QueryTemplate ID.
- Routine
Query
Template Routine Args - The routine associated with the QueryTemplate. Structure is documented below.
- State string
- The QueryTemplate lifecycle state.
- Submit bool
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action. - Update
Time string - Timestamp when the QueryTemplate was last modified.
- create_
time string - Timestamp when the QueryTemplate was created.
- data_
exchange_ stringid - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- deletion_
policy string - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- description string
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- display_
name string - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- documentation string
- Documentation describing the QueryTemplate.
- location string
- The name of the location this data exchange query template.
- name string
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - primary_
contact string - Email or URL of the primary point of contact of the QueryTemplate.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- query_
template_ stringid - Unique QueryTemplate ID.
- routine object
- The routine associated with the QueryTemplate. Structure is documented below.
- state string
- The QueryTemplate lifecycle state.
- submit bool
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action. - update_
time string - Timestamp when the QueryTemplate was last modified.
- create
Time String - Timestamp when the QueryTemplate was created.
- data
Exchange StringId - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- deletion
Policy String - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- description String
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- display
Name String - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- documentation String
- Documentation describing the QueryTemplate.
- location String
- The name of the location this data exchange query template.
- name String
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - primary
Contact String - Email or URL of the primary point of contact of the QueryTemplate.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- query
Template StringId - Unique QueryTemplate ID.
- routine
Query
Template Routine - The routine associated with the QueryTemplate. Structure is documented below.
- state String
- The QueryTemplate lifecycle state.
- submit Boolean
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action. - update
Time String - Timestamp when the QueryTemplate was last modified.
- create
Time string - Timestamp when the QueryTemplate was created.
- data
Exchange stringId - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- deletion
Policy string - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- description string
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- display
Name string - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- documentation string
- Documentation describing the QueryTemplate.
- location string
- The name of the location this data exchange query template.
- name string
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - primary
Contact string - Email or URL of the primary point of contact of the QueryTemplate.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- query
Template stringId - Unique QueryTemplate ID.
- routine
Query
Template Routine - The routine associated with the QueryTemplate. Structure is documented below.
- state string
- The QueryTemplate lifecycle state.
- submit boolean
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action. - update
Time string - Timestamp when the QueryTemplate was last modified.
- create_
time str - Timestamp when the QueryTemplate was created.
- data_
exchange_ strid - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- deletion_
policy str - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- description str
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- display_
name str - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- documentation str
- Documentation describing the QueryTemplate.
- location str
- The name of the location this data exchange query template.
- name str
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - primary_
contact str - Email or URL of the primary point of contact of the QueryTemplate.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- query_
template_ strid - Unique QueryTemplate ID.
- routine
Query
Template Routine Args - The routine associated with the QueryTemplate. Structure is documented below.
- state str
- The QueryTemplate lifecycle state.
- submit bool
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action. - update_
time str - Timestamp when the QueryTemplate was last modified.
- create
Time String - Timestamp when the QueryTemplate was created.
- data
Exchange StringId - The ID of the data exchange. Must contain only Unicode letters, numbers (0-9), underscores (_). Should not use characters that require URL-escaping, or characters outside of ASCII, spaces.
- deletion
Policy String - Sets the policy for deleting the QueryTemplate. Defaults to
DELETE_IF_DRAFTED.ABANDON: Untracks the resource from Terraform state but leaves it intact in BigQuery.DELETE: Deletes the QueryTemplate from BigQuery.DELETE_IF_DRAFTED: Deletes the QueryTemplate only if it is in aDRAFTEDstate; otherwise, it abandons it.PREVENT: Prevents deletion of the QueryTemplate.
- description String
- Short description of the QueryTemplate. The description must not contain Unicode non-characters and C0 and C1 control codes except tabs, new lines, carriage returns, and page breaks. Default value is an empty string. Max length: 2000 bytes.
- display
Name String - Human-readable display name of the QueryTemplate. The display name must contain only Unicode letters, numbers (0-9), underscores (_), dashes (-), spaces ( ), ampersands (&) and can't start or end with spaces. Default value is an empty string.
- documentation String
- Documentation describing the QueryTemplate.
- location String
- The name of the location this data exchange query template.
- name String
- The resource name of the QueryTemplate. e.g.
projects/myproject/locations/us/dataExchanges/123/queryTemplates/456 - primary
Contact String - Email or URL of the primary point of contact of the QueryTemplate.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- query
Template StringId - Unique QueryTemplate ID.
- routine Property Map
- The routine associated with the QueryTemplate. Structure is documented below.
- state String
- The QueryTemplate lifecycle state.
- submit Boolean
- If set to
true, the QueryTemplate will be submitted for approval and cannot be updated afterwards. This is a one-time action. - update
Time String - Timestamp when the QueryTemplate was last modified.
Supporting Types
QueryTemplateRoutine, QueryTemplateRoutineArgs
- Definition
Body string - SQL query logic.
- Routine
Type string - Type of routine (e.g., TABLE_VALUED_FUNCTION).
Possible values are:
TABLE_VALUED_FUNCTION.
- Definition
Body string - SQL query logic.
- Routine
Type string - Type of routine (e.g., TABLE_VALUED_FUNCTION).
Possible values are:
TABLE_VALUED_FUNCTION.
- definition_
body string - SQL query logic.
- routine_
type string - Type of routine (e.g., TABLE_VALUED_FUNCTION).
Possible values are:
TABLE_VALUED_FUNCTION.
- definition
Body String - SQL query logic.
- routine
Type String - Type of routine (e.g., TABLE_VALUED_FUNCTION).
Possible values are:
TABLE_VALUED_FUNCTION.
- definition
Body string - SQL query logic.
- routine
Type string - Type of routine (e.g., TABLE_VALUED_FUNCTION).
Possible values are:
TABLE_VALUED_FUNCTION.
- definition_
body str - SQL query logic.
- routine_
type str - Type of routine (e.g., TABLE_VALUED_FUNCTION).
Possible values are:
TABLE_VALUED_FUNCTION.
- definition
Body String - SQL query logic.
- routine
Type String - Type of routine (e.g., TABLE_VALUED_FUNCTION).
Possible values are:
TABLE_VALUED_FUNCTION.
Import
QueryTemplate can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/dataExchanges/{{data_exchange_id}}/queryTemplates/{{query_template_id}}{{project}}/{{location}}/{{data_exchange_id}}/{{query_template_id}}{{location}}/{{data_exchange_id}}/{{query_template_id}}
When using the pulumi import command, QueryTemplate can be imported using one of the formats above. For example:
$ pulumi import gcp:bigqueryanalyticshub/queryTemplate:QueryTemplate default projects/{{project}}/locations/{{location}}/dataExchanges/{{data_exchange_id}}/queryTemplates/{{query_template_id}}
$ pulumi import gcp:bigqueryanalyticshub/queryTemplate:QueryTemplate default {{project}}/{{location}}/{{data_exchange_id}}/{{query_template_id}}
$ pulumi import gcp:bigqueryanalyticshub/queryTemplate:QueryTemplate default {{location}}/{{data_exchange_id}}/{{query_template_id}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.
published on Wednesday, Jul 29, 2026 by Pulumi