» google_data_catalog_entry

Entry Metadata. A Data Catalog Entry resource represents another resource in Google Cloud Platform (such as a BigQuery dataset or a Pub/Sub topic) or outside of Google Cloud Platform. Clients can use the linkedResource field in the Entry resource to refer to the original resource ID of the source system.

An Entry resource contains resource details, such as its schema. An Entry can also be used to attach flexible metadata, such as a Tag.

To get more information about Entry, see:

» Example Usage - Data Catalog Entry Basic

resource "google_data_catalog_entry" "basic_entry" {
  entry_group = google_data_catalog_entry_group.entry_group.id
  entry_id = "my_entry"

  user_specified_type = "my_custom_type"
  user_specified_system = "SomethingExternal"
}

resource "google_data_catalog_entry_group" "entry_group" {
  entry_group_id = "my_group"
}

» Example Usage - Data Catalog Entry Fileset

resource "google_data_catalog_entry" "basic_entry" {
  entry_group = google_data_catalog_entry_group.entry_group.id
  entry_id = "my_entry"

  type = "FILESET"

  gcs_fileset_spec {
    file_patterns = ["gs://fake_bucket/dir/*"]
  }
}

resource "google_data_catalog_entry_group" "entry_group" {
  entry_group_id = "my_group"
}

» Example Usage - Data Catalog Entry Full

resource "google_data_catalog_entry" "basic_entry" {
  entry_group = google_data_catalog_entry_group.entry_group.id
  entry_id = "my_entry"

  user_specified_type = "my_user_specified_type"
  user_specified_system = "Something_custom"
  linked_resource = "my/linked/resource"

  display_name = "my custom type entry"
  description  = "a custom type entry for a user specified system"

  schema = <<EOF
{
  "columns": [
    {
      "column": "first_name",
      "description": "First name",
      "mode": "REQUIRED",
      "type": "STRING"
    },
    {
      "column": "last_name",
      "description": "Last name",
      "mode": "REQUIRED",
      "type": "STRING"
    },
    {
      "column": "address",
      "description": "Address",
      "mode": "REPEATED",
      "subcolumns": [
        {
          "column": "city",
          "description": "City",
          "mode": "NULLABLE",
          "type": "STRING"
        },
        {
          "column": "state",
          "description": "State",
          "mode": "NULLABLE",
          "type": "STRING"
        }
      ],
      "type": "RECORD"
    }
  ]
}
EOF
}

resource "google_data_catalog_entry_group" "entry_group" {
  entry_group_id = "my_group"
}

» Argument Reference

The following arguments are supported:

  • entry_group - (Required) The name of the entry group this entry is in.

  • entry_id - (Required) The id of the entry to create.


  • linked_resource - (Optional) The resource this metadata entry refers to. For Google Cloud Platform resources, linkedResource is the full name of the resource. For example, the linkedResource for a table resource from BigQuery is: //bigquery.googleapis.com/projects/projectId/datasets/datasetId/tables/tableId Output only when Entry is of type in the EntryType enum. For entries with userSpecifiedType, this field is optional and defaults to an empty string.

  • display_name - (Optional) Display information such as title and description. A short name to identify the entry, for example, "Analytics Data - Jan 2011".

  • description - (Optional) Entry description, which can consist of several sentences or paragraphs that describe entry contents.

  • schema - (Optional) Schema of the entry (e.g. BigQuery, GoogleSQL, Avro schema), as a json string. An entry might not have any schema attached to it. See https://cloud.google.com/data-catalog/docs/reference/rest/v1/projects.locations.entryGroups.entries#schema for what fields this schema can contain.

  • type - (Optional) The type of the entry. Only used for Entries with types in the EntryType enum. Currently, only FILESET enum value is allowed. All other entries created through Data Catalog must use userSpecifiedType. Possible values are FILESET.

  • user_specified_type - (Optional) Entry type if it does not fit any of the input-allowed values listed in EntryType enum above. When creating an entry, users should check the enum values first, if nothing matches the entry to be created, then provide a custom value, for example "my_special_type". userSpecifiedType strings must begin with a letter or underscore and can only contain letters, numbers, and underscores; are case insensitive; must be at least 1 character and at most 64 characters long.

  • user_specified_system - (Optional) This field indicates the entry's source system that Data Catalog does not integrate with. userSpecifiedSystem strings must begin with a letter or underscore and can only contain letters, numbers, and underscores; are case insensitive; must be at least 1 character and at most 64 characters long.

  • gcs_fileset_spec - (Optional) Specification that applies to a Cloud Storage fileset. This is only valid on entries of type FILESET. Structure is documented below.

The gcs_fileset_spec block supports:

  • file_patterns - (Required) Patterns to identify a set of files in Google Cloud Storage. See Cloud Storage documentation for more information. Note that bucket wildcards are currently not supported. Examples of valid filePatterns:

    • gs://bucket_name/dir/*: matches all files within bucket_name/dir directory.
    • gs://bucket_name/dir/**: matches all files in bucket_name/dir spanning all subdirectories.
    • gs://bucket_name/file*: matches files prefixed by file in bucket_name
    • gs://bucket_name/??.txt: matches files with two characters followed by .txt in bucket_name
    • gs://bucket_name/[aeiou].txt: matches files that contain a single vowel character followed by .txt in bucket_name
    • gs://bucket_name/[a-m].txt: matches files that contain a, b, ... or m followed by .txt in bucket_name
    • gs://bucket_name/a//b: matches all files in bucket_name that match a//b pattern, such as a/c/b, a/d/b
    • gs://another_bucket/a.txt: matches gs://another_bucket/a.txt
  • sample_gcs_file_specs - Sample files contained in this fileset, not all files contained in this fileset are represented here. Structure is documented below.

The sample_gcs_file_specs block contains:

» Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format {{name}}

  • name - The Data Catalog resource name of the entry in URL format. Example: projects/{project_id}/locations/{location}/entryGroups/{entryGroupId}/entries/{entryId}. Note that this Entry and its child resources may not actually be stored in the location in this name.

  • integrated_system - This field indicates the entry's source system that Data Catalog integrates with, such as BigQuery or Pub/Sub.

  • bigquery_table_spec - Specification that applies to a BigQuery table. This is only valid on entries of type TABLE. Structure is documented below.

  • bigquery_date_sharded_spec - Specification for a group of BigQuery tables with name pattern [prefix]YYYYMMDD. Context: https://cloud.google.com/bigquery/docs/partitioned-tables#partitioning_versus_sharding. Structure is documented below.

The bigquery_table_spec block contains:

  • table_source_type - The table source type.

  • view_spec - Table view specification. This field should only be populated if tableSourceType is BIGQUERY_VIEW. Structure is documented below.

  • table_spec - Spec of a BigQuery table. This field should only be populated if tableSourceType is BIGQUERY_TABLE. Structure is documented below.

The view_spec block contains:

  • view_query - The query that defines the table view.

The table_spec block contains:

  • grouped_entry - If the table is a dated shard, i.e., with name pattern [prefix]YYYYMMDD, groupedEntry is the Data Catalog resource name of the date sharded grouped entry, for example, projects/{project_id}/locations/{location}/entrygroups/{entryGroupId}/entries/{entryId}. Otherwise, groupedEntry is empty.

The bigquery_date_sharded_spec block contains:

  • dataset - The Data Catalog resource name of the dataset entry the current table belongs to, for example, projects/{project_id}/locations/{location}/entrygroups/{entryGroupId}/entries/{entryId}

  • table_prefix - The table name prefix of the shards. The name of any given shard is [tablePrefix]YYYYMMDD, for example, for shard MyTable20180101, the tablePrefix is MyTable.

  • shard_count - Total number of shards.

» Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 4 minutes.
  • update - Default is 4 minutes.
  • delete - Default is 4 minutes.

» Import

Entry can be imported using any of these accepted formats:

$ terraform import google_data_catalog_entry.default {{name}}

» User Project Overrides

This resource supports User Project Overrides.