Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Set labels of all labels-supporting resources #95

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Deployment: 6 mins
| documentai\_location | Document AI location, see https://cloud.google.com/document-ai/docs/regions | `string` | `"us"` | no |
| firestore\_location | Firestore location, see https://firebase.google.com/docs/firestore/locations | `string` | `"nam5"` | no |
| initial\_index\_json\_path | Path to the initial (placeholder) Vector Search index | `string` | `"initial-index.json"` | no |
| labels | A set of key/value label pairs to assign to the resources deployed by this blueprint. | `map(string)` | `{}` | no |
| project\_id | The Google Cloud project ID to deploy to | `string` | n/a | yes |
| region | The Google Cloud region to deploy to | `string` | `"us-central1"` | no |
| unique\_names | Whether to use unique names for resources | `bool` | `true` | no |
Expand Down
7 changes: 7 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ resource "google_storage_bucket" "main" {
location = var.region
force_destroy = true
uniform_bucket_level_access = true
labels = var.labels
}

resource "google_storage_bucket" "docs" {
Expand All @@ -71,13 +72,15 @@ resource "google_storage_bucket" "docs" {
location = var.region
force_destroy = true
uniform_bucket_level_access = true
labels = var.labels
}

#-- Cloud Function webhook --#
resource "google_cloudfunctions2_function" "webhook" {
project = module.project_services.project_id
name = local.webhook_name
location = var.region
labels = var.labels

build_config {
runtime = "python312"
Expand Down Expand Up @@ -128,6 +131,7 @@ resource "google_artifact_registry_repository" "webhook_images" {
location = var.region
repository_id = "webhook-images"
format = "DOCKER"
labels = var.labels
}

data "archive_file" "webhook_staging" {
Expand Down Expand Up @@ -155,6 +159,7 @@ resource "google_eventarc_trigger" "trigger" {
location = var.region
name = local.trigger_name
service_account = google_service_account.trigger.email
labels = var.labels

matching_criteria {
attribute = "type"
Expand Down Expand Up @@ -232,6 +237,7 @@ resource "google_vertex_ai_index" "docs" {
region = var.region
display_name = local.docs_index_name
index_update_method = "STREAM_UPDATE"
labels = var.labels
metadata {
contents_delta_uri = "gs://${google_storage_bucket.main.name}/vector-search-index"
config {
Expand All @@ -255,6 +261,7 @@ resource "google_vertex_ai_index_endpoint" "docs" {
region = var.region
display_name = "docs-index-endpoint"
public_endpoint_enabled = true
labels = var.labels
}

resource "google_storage_bucket_object" "index_initial" {
Expand Down
3 changes: 3 additions & 0 deletions metadata.display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ spec:
initial_index_json_path:
name: initial_index_json_path
title: Initial Index Json Path
labels:
name: labels
title: Labels
project_id:
name: project_id
title: Project Id
Expand Down
5 changes: 4 additions & 1 deletion metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ spec:
description: Path to the initial (placeholder) Vector Search index
varType: string
defaultValue: initial-index.json
- name: labels
description: A set of key/value label pairs to assign to the resources deployed by this blueprint.
varType: map(string)
defaultValue: {}
- name: project_id
description: The Google Cloud project ID to deploy to
varType: string
defaultValue: null
required: true
- name: region
description: The Google Cloud region to deploy to
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ variable "unique_names" {
type = bool
default = true
}

variable "labels" {
type = map(string)
default = {}
description = "A set of key/value label pairs to assign to the resources deployed by this blueprint."
}
Loading