blob: 10cc0ea09bec17df5c55e044b2ffbfe54c251b08 [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Dataform"
description: |-
A resource represents a Dataform Git repository
---
# google_dataform_repository
A resource represents a Dataform Git repository
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.
To get more information about Repository, see:
* [API documentation](https://cloud.google.com/dataform/reference/rest/v1beta1/projects.locations.repositories)
* How-to Guides
* [Official Documentation](https://cloud.google.com/dataform/docs/)
## Example Usage - Dataform Repository
```hcl
resource "google_secret_manager_secret" "secret" {
provider = google-beta
secret_id = "my-secret"
replication {
auto {}
}
}
resource "google_secret_manager_secret_version" "secret_version" {
provider = google-beta
secret = google_secret_manager_secret.secret.id
secret_data = "secret-data"
}
resource "google_kms_key_ring" "keyring" {
provider = google-beta
name = "example-key-ring"
location = "us-central1"
}
resource "google_kms_crypto_key" "example_key" {
provider = google-beta
name = "example-crypto-key-name"
key_ring = google_kms_key_ring.keyring.id
}
resource "google_kms_crypto_key_iam_binding" "crypto_key_binding" {
provider = google-beta
crypto_key_id = google_kms_crypto_key.example_key.id
role = "roles/cloudkms.cryptoKeyEncrypterDecrypter"
members = [
"serviceAccount:service-${data.google_project.project.number}@gcp-sa-dataform.iam.gserviceaccount.com",
]
}
resource "google_dataform_repository" "dataform_repository" {
provider = google-beta
name = "dataform_repository"
display_name = "dataform_repository"
npmrc_environment_variables_secret_version = google_secret_manager_secret_version.secret_version.id
kms_key_name = google_kms_crypto_key.example_key.id
labels = {
label_foo1 = "label-bar1"
}
git_remote_settings {
url = "https://github.com/OWNER/REPOSITORY.git"
default_branch = "main"
authentication_token_secret_version = google_secret_manager_secret_version.secret_version.id
}
workspace_compilation_overrides {
default_database = "database"
schema_suffix = "_suffix"
table_prefix = "prefix_"
}
depends_on = [
google_kms_crypto_key_iam_binding.crypto_key_binding
]
}
```
## Argument Reference
The following arguments are supported:
* `name` -
(Required)
The repository's name.
- - -
* `git_remote_settings` -
(Optional)
Optional. If set, configures this repository to be linked to a Git remote.
Structure is [documented below](#nested_git_remote_settings).
* `workspace_compilation_overrides` -
(Optional)
If set, fields of workspaceCompilationOverrides override the default compilation settings that are specified in dataform.json when creating workspace-scoped compilation results.
Structure is [documented below](#nested_workspace_compilation_overrides).
* `service_account` -
(Optional)
The service account to run workflow invocations under.
* `npmrc_environment_variables_secret_version` -
(Optional)
Optional. The name of the Secret Manager secret version to be used to interpolate variables into the .npmrc file for package installation operations. Must be in the format projects/*/secrets/*/versions/*. The file itself must be in a JSON format.
* `display_name` -
(Optional)
Optional. The repository's user-friendly name.
* `kms_key_name` -
(Optional)
Optional. The reference to a KMS encryption key. If provided, it will be used to encrypt user data in the repository and all child resources.
It is not possible to add or update the encryption key after the repository is created. Example projects/[kms_project_id]/locations/[region]/keyRings/[key_region]/cryptoKeys/[key]
* `labels` -
(Optional)
Optional. Repository user labels.
An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
**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.
* `region` -
(Optional)
A reference to the region
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
<a name="nested_git_remote_settings"></a>The `git_remote_settings` block supports:
* `url` -
(Required)
The Git remote's URL.
* `default_branch` -
(Required)
The Git remote's default branch name.
* `authentication_token_secret_version` -
(Optional)
The name of the Secret Manager secret version to use as an authentication token for Git operations. This secret is for assigning with HTTPS only(for SSH use `ssh_authentication_config`). Must be in the format projects/*/secrets/*/versions/*.
* `ssh_authentication_config` -
(Optional)
Authentication fields for remote uris using SSH protocol.
Structure is [documented below](#nested_ssh_authentication_config).
* `token_status` -
(Output)
Indicates the status of the Git access token. https://cloud.google.com/dataform/reference/rest/v1beta1/projects.locations.repositories#TokenStatus
<a name="nested_ssh_authentication_config"></a>The `ssh_authentication_config` block supports:
* `user_private_key_secret_version` -
(Required)
The name of the Secret Manager secret version to use as a ssh private key for Git operations. Must be in the format projects/*/secrets/*/versions/*.
* `host_public_key` -
(Required)
Content of a public SSH key to verify an identity of a remote Git host.
<a name="nested_workspace_compilation_overrides"></a>The `workspace_compilation_overrides` block supports:
* `default_database` -
(Optional)
The default database (Google Cloud project ID).
* `schema_suffix` -
(Optional)
The suffix that should be appended to all schema (BigQuery dataset ID) names.
* `table_prefix` -
(Optional)
The prefix that should be prepended to all table names.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{region}}/repositories/{{name}}`
* `terraform_labels` -
The combination of labels configured directly on the resource
and default labels configured on the provider.
* `effective_labels` -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
Repository can be imported using any of these accepted formats:
* `projects/{{project}}/locations/{{region}}/repositories/{{name}}`
* `{{project}}/{{region}}/{{name}}`
* `{{region}}/{{name}}`
* `{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Repository using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/locations/{{region}}/repositories/{{name}}"
to = google_dataform_repository.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Repository can be imported using one of the formats above. For example:
```
$ terraform import google_dataform_repository.default projects/{{project}}/locations/{{region}}/repositories/{{name}}
$ terraform import google_dataform_repository.default {{project}}/{{region}}/{{name}}
$ terraform import google_dataform_repository.default {{region}}/{{name}}
$ terraform import google_dataform_repository.default {{name}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).