Skip to content

Commit

Permalink
fixing last issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Timoteo committed Dec 19, 2024
1 parent 40de2a5 commit cdef7d3
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ module "gemini_insights" {
location = local.config_bigquery.dataset.gemini_insights.location
# The delete_contents_on_destroy attribute specifies whether the contents of the dataset should be deleted when the dataset is destroyed.
# In this case, the delete_contents_on_destroy attribute is set to false, which means that the contents of the dataset will not be deleted when the dataset is destroyed.
delete_contents_on_destroy = true
delete_contents_on_destroy = false
deletion_protection = true

dataset_labels = {
version = "prod",
Expand All @@ -340,7 +341,7 @@ module "gemini_insights" {
# The max_time_travel_hours attribute specifies the maximum number of hours that data in the dataset can be accessed using time travel queries.
# In this case, the maximum time travel hours is set to the value of the local file config.yaml section bigquery.dataset.gemini_insights.max_time_travel_hours configuration.
max_time_travel_hours = local.config_bigquery.dataset.gemini_insights.max_time_travel_hours
deletion_protection = false
deletion_protection = true
time_partitioning = null,
range_partitioning = null,
expiration_time = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,14 @@ resource "google_bigquery_routine" "user_behaviour_revenue_insights" {
depends_on = [
null_resource.check_gemini_model_exists
]

# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
#prevent_destroy = true
create_before_destroy = true
}
}

/*
Expand Down Expand Up @@ -1257,6 +1265,14 @@ resource "google_bigquery_routine" "invoke_backfill_user_behaviour_revenue_insig
null_resource.check_gemini_model_exists,
null_resource.create_gemini_model
]

# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
#prevent_destroy = true
create_before_destroy = true
}
}

/*
Expand Down Expand Up @@ -1700,8 +1716,9 @@ resource "null_resource" "create_gemini_model" {
# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
#ignore_changes = all
ignore_changes = all
#prevent_destroy = true
create_before_destroy = true
}

depends_on = [
Expand Down
16 changes: 13 additions & 3 deletions infrastructure/terraform/modules/feature-store/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module "project_services" {
source = "terraform-google-modules/project-factory/google//modules/project_services"
version = "17.0.0"

disable_dependent_services = true
disable_dependent_services = false
disable_services_on_destroy = false

project_id = local.feature_store_project_id
Expand Down Expand Up @@ -121,7 +121,8 @@ resource "google_bigquery_connection" "vertex_ai_connection" {
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
prevent_destroy = true
#prevent_destroy = true
create_before_destroy = true
}
}

Expand Down Expand Up @@ -152,7 +153,8 @@ resource "google_project_iam_member" "vertex_ai_connection_sa_roles" {
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
prevent_destroy = true
#prevent_destroy = true
create_before_destroy = true
}
}

Expand All @@ -165,6 +167,14 @@ resource "time_sleep" "wait_for_vertex_ai_connection_sa_role_propagation" {
depends_on = [
google_project_iam_member.vertex_ai_connection_sa_roles
]

# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
#prevent_destroy = true
create_before_destroy = true
}
}


Expand Down
2 changes: 1 addition & 1 deletion infrastructure/terraform/modules/pipelines/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module "project_services" {
source = "terraform-google-modules/project-factory/google//modules/project_services"
version = "17.0.0"

disable_dependent_services = true
disable_dependent_services = false
disable_services_on_destroy = false

project_id = local.pipeline_vars.project_id
Expand Down
64 changes: 56 additions & 8 deletions infrastructure/terraform/modules/pipelines/pipelines.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ resource "google_service_account" "service_account" {
account_id = local.pipeline_vars.service_account_id
display_name = local.pipeline_vars.service_account_id
description = "Service Account to run Vertex AI Pipelines"

# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
#prevent_destroy = true
create_before_destroy = true
}
}

# Wait for the pipelines service account to be created
Expand Down Expand Up @@ -72,6 +80,14 @@ resource "google_project_iam_member" "pipelines_sa_roles" {
"roles/compute.networkUser"
])
role = each.key

# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
#prevent_destroy = true
create_before_destroy = true
}
}

# This resource binds the service account to the required roles in the mds project
Expand All @@ -89,6 +105,14 @@ resource "google_project_iam_member" "pipelines_sa_mds_project_roles" {
"roles/bigquery.dataViewer"
])
role = each.key

# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
#prevent_destroy = true
create_before_destroy = true
}
}

# This resource creates a service account to run the dataflow jobs
Expand All @@ -97,6 +121,14 @@ resource "google_service_account" "dataflow_worker_service_account" {
account_id = local.dataflow_vars.worker_service_account_id
display_name = local.dataflow_vars.worker_service_account_id
description = "Service Account to run Dataflow jobs"

# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
#prevent_destroy = true
create_before_destroy = true
}
}

# Wait for the dataflow worker service account to be created
Expand Down Expand Up @@ -143,6 +175,14 @@ resource "google_project_iam_member" "dataflow_worker_sa_roles" {
"roles/storage.objectAdmin",
])
role = each.key

# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
#prevent_destroy = true
create_before_destroy = true
}
}

# This resource binds the service account to the required roles
Expand All @@ -157,6 +197,14 @@ resource "google_service_account_iam_member" "dataflow_sa_iam" {
service_account_id = "projects/${module.project_services.project_id}/serviceAccounts/${google_service_account.dataflow_worker_service_account.email}"
role = "roles/iam.serviceAccountUser"
member = "serviceAccount:${google_service_account.service_account.email}"

# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
#prevent_destroy = true
create_before_destroy = true
}
}

# This resource creates a Cloud Storage Bucket for the pipeline artifacts
Expand All @@ -170,12 +218,12 @@ resource "google_storage_bucket" "pipelines_bucket" {
# even if it contains objects. In this case, it's set to false, which means that the bucket will not be destroyed if it contains objects.
force_destroy = false

# The lifecycle block allows you to configure the lifecycle of the bucket.
# In this case, the ignore_changes attribute is set to all, which means that Terraform
# will ignore any changes to the bucket's lifecycle configuration. The prevent_destroy attribute is set to false, which means that the bucket can be destroyed.
# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
prevent_destroy = false ##true
#prevent_destroy = true
create_before_destroy = true
}
}

Expand All @@ -190,12 +238,12 @@ resource "google_storage_bucket" "custom_model_bucket" {
# even if it contains objects. In this case, it's set to false, which means that the bucket will not be destroyed if it contains objects.
force_destroy = false

# The lifecycle block allows you to configure the lifecycle of the bucket.
# In this case, the ignore_changes attribute is set to all, which means that Terraform
# will ignore any changes to the bucket's lifecycle configuration. The prevent_destroy attribute is set to false, which means that the bucket can be destroyed.
# The lifecycle block is used to configure the lifecycle of the table. In this case, the ignore_changes attribute is set to all, which means that Terraform will ignore
# any changes to the table and will not attempt to update the table. The prevent_destroy attribute is set to true, which means that Terraform will prevent the table from being destroyed.
lifecycle {
ignore_changes = all
prevent_destroy = false ##true
#prevent_destroy = true
create_before_destroy = true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
},
{
"numeric": {
"column_name": "recife_favorite_past_5_day",
"column_name": "recipe_favorite_past_5_day",
"invalid_values_allowed": true
}
},
Expand Down
2 changes: 1 addition & 1 deletion sql/query/create_gemini_model.sqlx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
-- Your supervised tuning computations also occur in the europe-west4 region, because that's where TPU resources are located.

-- Create a {{endpoint_name}} model using a remote connection to {{region}}.{{connection_name}}
CREATE OR REPLACE MODEL `{{project_id}}.{{dataset}}.{{model_name}}`
CREATE MODEL IF NOT EXISTS `{{project_id}}.{{dataset}}.{{model_name}}`
REMOTE WITH CONNECTION `{{project_id}}.{{region}}.{{connection_name}}`
OPTIONS (ENDPOINT = '{{endpoint_name}}');

0 comments on commit cdef7d3

Please sign in to comment.