2020-05-02 08:33:48 -07:00
/ * *
2022-01-01 06:52:31 -08:00
* Copyright 2022 Google LLC
2020-05-02 08:33:48 -07:00
*
* Licensed under the Apache License , Version 2 . 0 ( the " License " ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an " AS IS " BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
* /
2020-11-21 00:45:56 -08:00
variable " access " {
description = " Map of access rules with role and identity type. Keys are arbitrary and must match those in the `access_identities` variable, types are `domain`, `group`, `special_group`, `user`, `view`. "
2020-05-03 06:10:36 -07:00
type = map ( object ( {
role = string
type = string
} ) )
default = { }
2020-11-21 00:45:56 -08:00
validation {
condition = can ( [
for k , v in var . access :
index ( [ " domain " , " group " , " special_group " , " user " , " view " ] , v . type )
] )
error_message = " Access type must be one of 'domain', 'group', 'special_group', 'user', 'view'. "
}
2020-05-02 08:33:48 -07:00
}
2020-11-21 00:45:56 -08:00
variable " access_identities " {
description = " Map of access identities used for basic access roles. View identities have the format 'project_id|dataset_id|table_id'. "
type = map ( string )
default = { }
2020-05-03 06:10:36 -07:00
}
2023-06-30 09:44:57 -07:00
variable " authorized_datasets " {
description = " An array of datasets to be authorized on the dataset. "
type = list ( object ( {
dataset_id = string ,
project_id = string ,
} ) )
default = [ ]
}
variable " authorized_routines " {
description = " An array of authorized routine to be authorized on the dataset. "
type = list ( object ( {
project_id = string ,
dataset_id = string ,
routine_id = string
} ) )
default = [ ]
}
variable " authorized_views " {
description = " An array of views to be authorized on the dataset. "
type = list ( object ( {
dataset_id = string ,
project_id = string ,
table_id = string # this is the view id, but we keep table_id to stay consistent as the resource
} ) )
default = [ ]
}
2020-05-03 06:10:36 -07:00
variable " dataset_access " {
description = " Set access in the dataset resource instead of using separate resources. "
type = bool
default = false
2020-05-02 08:33:48 -07:00
}
2021-10-19 12:09:16 -07:00
variable " description " {
description = " Optional description. "
type = string
default = " Terraform managed. "
}
2020-05-02 08:33:48 -07:00
variable " encryption_key " {
description = " Self link of the KMS key that will be used to protect destination table. "
type = string
default = null
}
2021-10-08 09:26:04 -07:00
variable " friendly_name " {
description = " Dataset friendly name. "
type = string
default = null
}
2020-11-21 00:45:56 -08:00
variable " iam " {
description = " IAM bindings in {ROLE => [MEMBERS]} format. Mutually exclusive with the access_* variables used for basic roles. "
type = map ( list ( string ) )
default = { }
}
2021-10-08 09:26:04 -07:00
variable " id " {
description = " Dataset id. "
type = string
}
2020-05-02 08:33:48 -07:00
variable " labels " {
description = " Dataset labels. "
type = map ( string )
default = { }
}
variable " location " {
description = " Dataset location. "
type = string
default = " EU "
}
2023-10-04 05:25:56 -07:00
variable " materialized_views " {
description = " Materialized views definitions. "
type = map ( object ( {
query = string
2023-10-13 08:02:47 -07:00
allow_non_incremental_definition = optional ( bool )
2023-10-04 05:25:56 -07:00
deletion_protection = optional ( bool )
description = optional ( string , " Terraform managed. " )
2023-10-13 08:02:47 -07:00
enable_refresh = optional ( bool )
2023-10-04 05:25:56 -07:00
friendly_name = optional ( string )
labels = optional ( map ( string ) , { } )
refresh_interval_ms = optional ( bool )
2023-11-30 05:33:50 -08:00
require_partition_filter = optional ( bool )
2023-10-04 05:25:56 -07:00
options = optional ( object ( {
clustering = optional ( list ( string ) )
expiration_time = optional ( number )
} ) , { } )
partitioning = optional ( object ( {
field = optional ( string )
range = optional ( object ( {
end = number
interval = number
start = number
} ) )
time = optional ( object ( {
2023-11-30 05:33:50 -08:00
type = string
expiration_ms = optional ( number )
field = optional ( string )
2023-10-04 05:25:56 -07:00
} ) )
} ) )
} ) )
default = { }
}
2020-05-02 08:33:48 -07:00
variable " options " {
description = " Dataset options. "
type = object ( {
2023-04-05 07:22:52 -07:00
default_collation = optional ( string )
default_table_expiration_ms = optional ( number )
default_partition_expiration_ms = optional ( number )
2023-02-13 23:43:15 -08:00
delete_contents_on_destroy = optional ( bool , false )
2023-04-05 07:22:52 -07:00
is_case_insensitive = optional ( bool )
2023-02-13 23:43:15 -08:00
max_time_travel_hours = optional ( number , 168 )
2023-10-02 10:37:40 -07:00
storage_billing_model = optional ( string )
2020-05-02 08:33:48 -07:00
} )
2023-02-13 23:43:15 -08:00
default = { }
2020-05-02 08:33:48 -07:00
}
variable " project_id " {
description = " Id of the project where datasets will be created. "
type = string
}
variable " tables " {
description = " Table definitions. Options and partitioning default to null. Partitioning can only use `range` or `time`, set the unused one to null. "
type = map ( object ( {
2023-11-30 05:33:50 -08:00
deletion_protection = optional ( bool )
description = optional ( string , " Terraform managed. " )
friendly_name = optional ( string )
labels = optional ( map ( string ) , { } )
require_partition_filter = optional ( bool )
schema = optional ( string )
external_data_configuration = optional ( object ( {
autodetect = bool
source_uris = list ( string )
avro_logical_types = optional ( bool )
compression = optional ( string )
connection_id = optional ( string )
file_set_spec_type = optional ( string )
ignore_unknown_values = optional ( bool )
metadata_cache_mode = optional ( string )
object_metadata = optional ( string )
json_options_encoding = optional ( string )
reference_file_schema_uri = optional ( string )
schema = optional ( string )
source_format = optional ( string )
max_bad_records = optional ( number )
csv_options = optional ( object ( {
quote = string
allow_jagged_rows = optional ( bool )
allow_quoted_newlines = optional ( bool )
encoding = optional ( string )
field_delimiter = optional ( string )
skip_leading_rows = optional ( number )
} ) )
google_sheets_options = optional ( object ( {
range = optional ( string )
skip_leading_rows = optional ( number )
} ) )
hive_partitioning_options = optional ( object ( {
mode = optional ( string )
require_partition_filter = optional ( bool )
source_uri_prefix = optional ( string )
} ) )
parquet_options = optional ( object ( {
enum_as_string = optional ( bool )
enable_list_inference = optional ( bool )
} ) )
} ) )
2023-08-06 02:25:45 -07:00
options = optional ( object ( {
clustering = optional ( list ( string ) )
encryption_key = optional ( string )
expiration_time = optional ( number )
2023-11-30 05:33:50 -08:00
max_staleness = optional ( string )
2023-08-06 02:25:45 -07:00
} ) , { } )
partitioning = optional ( object ( {
field = optional ( string )
range = optional ( object ( {
2020-05-02 08:33:48 -07:00
end = number
interval = number
start = number
2023-08-06 02:25:45 -07:00
} ) )
time = optional ( object ( {
2023-11-30 05:33:50 -08:00
type = string
expiration_ms = optional ( number )
field = optional ( string )
} ) )
} ) )
table_constraints = optional ( object ( {
primary_key_columns = optional ( list ( string ) )
foreign_keys = optional ( object ( {
referenced_table = object ( {
project_id = string
dataset_id = string
table_id = string
} )
column_references = object ( {
referencing_column = string
referenced_column = string
} )
name = optional ( string )
2023-08-06 02:25:45 -07:00
} ) )
} ) )
2020-05-02 08:33:48 -07:00
} ) )
default = { }
}
variable " views " {
description = " View definitions. "
type = map ( object ( {
2021-06-01 09:36:53 -07:00
query = string
2023-08-06 02:25:45 -07:00
deletion_protection = optional ( bool )
description = optional ( string , " Terraform managed. " )
friendly_name = optional ( string )
labels = optional ( map ( string ) , { } )
use_legacy_sql = optional ( bool )
2020-05-02 08:33:48 -07:00
} ) )
default = { }
}