From f74d11a30e10543046f7561a7fe75e7b4af0ac54 Mon Sep 17 00:00:00 2001 From: Shirley Cohen Date: Sat, 21 Oct 2023 21:08:00 -0500 Subject: [PATCH 1/2] delete terraform.tfstate --- .../external_load_balancer/terraform.tfstate | 1263 ----------------- 1 file changed, 1263 deletions(-) delete mode 100644 deploy/external_load_balancer/terraform.tfstate diff --git a/deploy/external_load_balancer/terraform.tfstate b/deploy/external_load_balancer/terraform.tfstate deleted file mode 100644 index fbaeb9a..0000000 --- a/deploy/external_load_balancer/terraform.tfstate +++ /dev/null @@ -1,1263 +0,0 @@ -{ - "version": 4, - "terraform_version": "1.5.7", - "serial": 1029, - "lineage": "24816029-c9b4-a548-89b8-08550760d14b", - "outputs": { - "external_ip": { - "value": "34.36.3.44", - "type": "string" - } - }, - "resources": [ - { - "mode": "data", - "type": "google_iam_policy", - "name": "noauth", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "audit_config": null, - "binding": [ - { - "condition": [], - "members": [ - "allUsers" - ], - "role": "roles/run.invoker" - } - ], - "id": "3450855414", - "policy_data": "{\"bindings\":[{\"members\":[\"allUsers\"],\"role\":\"roles/run.invoker\"}]}" - }, - "sensitive_attributes": [] - } - ] - }, - { - "mode": "managed", - "type": "google_artifact_registry_repository", - "name": "image_registry", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "create_time": "2023-09-18T18:18:55.731695Z", - "description": "", - "docker_config": [], - "format": "DOCKER", - "id": "projects/tag-engine-develop/locations/us-central1/repositories/cloud-run-source-deploy", - "kms_key_name": "", - "labels": null, - "location": "us-central1", - "maven_config": [], - "mode": "STANDARD_REPOSITORY", - "name": "cloud-run-source-deploy", - "project": "tag-engine-develop", - "remote_repository_config": [], - "repository_id": "cloud-run-source-deploy", - "timeouts": null, - "update_time": "2023-09-18T18:18:55.731695Z", - "virtual_repository_config": [] - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_cloud_run_service_iam_policy", - "name": "noauth", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [] - }, - { - "mode": "managed", - "type": "google_cloud_run_v2_service", - "name": "api_service", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [] - }, - { - "mode": "managed", - "type": "google_cloud_run_v2_service", - "name": "ui_service", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [] - }, - { - "mode": "managed", - "type": "google_cloud_tasks_queue", - "name": "injector_queue", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [] - }, - { - "mode": "managed", - "type": "google_cloud_tasks_queue", - "name": "work_queue", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [] - }, - { - "mode": "managed", - "type": "google_compute_region_network_endpoint_group", - "name": "default", - "provider": "provider[\"registry.terraform.io/hashicorp/google-beta\"]", - "instances": [] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "BigQuerySchemaUpdate", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi0a/HE=", - "id": "tag-engine-develop/projects/tag-engine-develop/roles/BigQuerySchemaUpdate", - "members": [ - "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "projects/tag-engine-develop/roles/BigQuerySchemaUpdate" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "PolicyTagReader", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi4ZiHA=", - "id": "tag-engine-develop/projects/tag-engine-develop/roles/PolicyTagReader", - "members": [ - "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "projects/tag-engine-develop/roles/PolicyTagReader" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "dataEditor", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi5ffl4=", - "id": "tag-engine-develop/roles/bigquery.dataEditor", - "members": [ - "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/bigquery.dataEditor" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "enqueuer", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpixVhvE=", - "id": "tag-engine-develop/roles/cloudtasks.enqueuer", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/cloudtasks.enqueuer" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "indexAdmin", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi63ARA=", - "id": "tag-engine-develop/roles/datastore.indexAdmin", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/datastore.indexAdmin" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "invoker", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi4ZiHA=", - "id": "tag-engine-develop/roles/run.invoker", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/run.invoker" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "jobUser", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpixVhvE=", - "id": "tag-engine-develop/roles/bigquery.jobUser", - "members": [ - "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/bigquery.jobUser" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "log_writer", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi3cQ10=", - "id": "tag-engine-develop/roles/logging.logWriter", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/logging.logWriter" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "loggingViewer", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi2d+50=", - "id": "tag-engine-develop/roles/logging.viewer", - "members": [ - "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/logging.viewer" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "metadataViewer", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi0a/HE=", - "id": "tag-engine-develop/roles/bigquery.metadataViewer", - "members": [ - "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/bigquery.metadataViewer" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "repo_admin", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpiyZ57Q=", - "id": "tag-engine-develop/roles/artifactregistry.repoAdmin", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/artifactregistry.repoAdmin" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "storage_object_get", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpizbNhk=", - "id": "tag-engine-develop/roles/storage.objectViewer", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/storage.objectViewer" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "tagEditor", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi5ffl4=", - "id": "tag-engine-develop/roles/datacatalog.tagEditor", - "members": [ - "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/datacatalog.tagEditor" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "tagTemplateUser", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi63ARA=", - "id": "tag-engine-develop/roles/datacatalog.tagTemplateUser", - "members": [ - "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/datacatalog.tagTemplateUser" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "tagTemplateViewer", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi63ARA=", - "id": "tag-engine-develop/roles/datacatalog.tagTemplateViewer", - "members": [ - "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/datacatalog.tagTemplateViewer" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "taskRunner", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi4ZiHA=", - "id": "tag-engine-develop/roles/cloudtasks.taskRunner", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/cloudtasks.taskRunner" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "user", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpixVhvE=", - "id": "tag-engine-develop/roles/datastore.user", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/datastore.user" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_binding", - "name": "viewer", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi5ffl4=", - "id": "tag-engine-develop/roles/datacatalog.viewer", - "members": [ - "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com" - ], - "project": "tag-engine-develop", - "role": "roles/datacatalog.viewer" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_custom_role", - "name": "bigquery_schema_update", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "deleted": false, - "description": "Custom role for updating the schema of a BigQuery table with policy tags", - "id": "projects/tag-engine-develop/roles/BigQuerySchemaUpdate", - "name": "projects/tag-engine-develop/roles/BigQuerySchemaUpdate", - "permissions": [ - "bigquery.tables.setCategory" - ], - "project": "tag-engine-develop", - "role_id": "BigQuerySchemaUpdate", - "stage": "GA", - "title": "BigQuery Schema Update" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_custom_role", - "name": "policy_tag_reader", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "deleted": false, - "description": "Read Policy Tag Taxonomy", - "id": "projects/tag-engine-develop/roles/PolicyTagReader", - "name": "projects/tag-engine-develop/roles/PolicyTagReader", - "permissions": [ - "datacatalog.taxonomies.get", - "datacatalog.taxonomies.list" - ], - "project": "tag-engine-develop", - "role_id": "PolicyTagReader", - "stage": "GA", - "title": "BigQuery Policy Tag Reader" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_iam_member", - "name": "member-role", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "index_key": "scohen@gcp.solutions", - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi70qJg=", - "id": "tag-engine-develop/roles/iap.httpsResourceAccessor/user:scohen@gcp.solutions", - "member": "user:scohen@gcp.solutions", - "project": "tag-engine-develop", - "role": "roles/iap.httpsResourceAccessor" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "module.lb-http.google_compute_global_address.default", - "null_resource.create_iap_sa" - ] - }, - { - "index_key": "shirley.cohen@gmail.com", - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi70qJg=", - "id": "tag-engine-develop/roles/iap.httpsResourceAccessor/user:shirley.cohen@gmail.com", - "member": "user:shirley.cohen@gmail.com", - "project": "tag-engine-develop", - "role": "roles/iap.httpsResourceAccessor" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "module.lb-http.google_compute_global_address.default", - "null_resource.create_iap_sa" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_project_service", - "name": "tag_engine_project", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "index_key": 0, - "schema_version": 0, - "attributes": { - "disable_dependent_services": true, - "disable_on_destroy": true, - "id": "tag-engine-develop/cloudresourcemanager.googleapis.com", - "project": "tag-engine-develop", - "service": "cloudresourcemanager.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": 1, - "schema_version": 0, - "attributes": { - "disable_dependent_services": true, - "disable_on_destroy": true, - "id": "tag-engine-develop/iam.googleapis.com", - "project": "tag-engine-develop", - "service": "iam.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": 2, - "schema_version": 0, - "attributes": { - "disable_dependent_services": true, - "disable_on_destroy": true, - "id": "tag-engine-develop/cloudresourcemanager.googleapis.com", - "project": "tag-engine-develop", - "service": "cloudresourcemanager.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": 3, - "schema_version": 0, - "attributes": { - "disable_dependent_services": true, - "disable_on_destroy": true, - "id": "tag-engine-develop/cloudbuild.googleapis.com", - "project": "tag-engine-develop", - "service": "cloudbuild.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": 4, - "schema_version": 0, - "attributes": { - "disable_dependent_services": true, - "disable_on_destroy": true, - "id": "tag-engine-develop/artifactregistry.googleapis.com", - "project": "tag-engine-develop", - "service": "artifactregistry.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": 5, - "schema_version": 0, - "attributes": { - "disable_dependent_services": true, - "disable_on_destroy": true, - "id": "tag-engine-develop/vpcaccess.googleapis.com", - "project": "tag-engine-develop", - "service": "vpcaccess.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": 6, - "schema_version": 0, - "attributes": { - "disable_dependent_services": true, - "disable_on_destroy": true, - "id": "tag-engine-develop/cloudtasks.googleapis.com", - "project": "tag-engine-develop", - "service": "cloudtasks.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": 7, - "schema_version": 0, - "attributes": { - "disable_dependent_services": true, - "disable_on_destroy": true, - "id": "tag-engine-develop/firestore.googleapis.com", - "project": "tag-engine-develop", - "service": "firestore.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": 8, - "schema_version": 0, - "attributes": { - "disable_dependent_services": true, - "disable_on_destroy": true, - "id": "tag-engine-develop/datacatalog.googleapis.com", - "project": "tag-engine-develop", - "service": "datacatalog.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - }, - { - "index_key": 9, - "schema_version": 0, - "attributes": { - "disable_dependent_services": true, - "disable_on_destroy": true, - "id": "tag-engine-develop/iap.googleapis.com", - "project": "tag-engine-develop", - "service": "iap.googleapis.com", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInJlYWQiOjYwMDAwMDAwMDAwMCwidXBkYXRlIjoxMjAwMDAwMDAwMDAwfX0=" - } - ] - }, - { - "mode": "managed", - "type": "google_service_account_iam_binding", - "name": "serviceAccountTokenCreator_tag_creator_sa", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpi5UYDo=", - "id": "projects/tag-engine-develop/serviceAccounts/tag-creator@tag-engine-develop.iam.gserviceaccount.com/roles/iam.serviceAccountTokenCreator", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "role": "roles/iam.serviceAccountTokenCreator", - "service_account_id": "projects/tag-engine-develop/serviceAccounts/tag-creator@tag-engine-develop.iam.gserviceaccount.com" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_service_account_iam_binding", - "name": "serviceAccountUser_tag_creator_sa", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpiyTstg=", - "id": "projects/tag-engine-develop/serviceAccounts/tag-creator@tag-engine-develop.iam.gserviceaccount.com/roles/iam.serviceAccountUser", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "role": "roles/iam.serviceAccountUser", - "service_account_id": "projects/tag-engine-develop/serviceAccounts/tag-creator@tag-engine-develop.iam.gserviceaccount.com" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_service_account_iam_binding", - "name": "serviceAccountUser_tag_engine_sa", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "condition": [], - "etag": "BwYFpitfiZ4=", - "id": "projects/tag-engine-develop/serviceAccounts/tag-engine@tag-engine-develop.iam.gserviceaccount.com/roles/iam.serviceAccountUser", - "members": [ - "serviceAccount:tag-engine@tag-engine-develop.iam.gserviceaccount.com" - ], - "role": "roles/iam.serviceAccountUser", - "service_account_id": "projects/tag-engine-develop/serviceAccounts/tag-engine@tag-engine-develop.iam.gserviceaccount.com" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "google_vpc_access_connector", - "name": "connector", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "connected_projects": [ - "tag-engine-develop" - ], - "id": "projects/tag-engine-develop/locations/us-central1/connectors/vpc-con", - "ip_cidr_range": "10.8.0.0/28", - "machine_type": "e2-micro", - "max_instances": 3, - "max_throughput": 300, - "min_instances": 2, - "min_throughput": 200, - "name": "vpc-con", - "network": "default", - "project": "tag-engine-develop", - "region": "us-central1", - "self_link": "projects/tag-engine-develop/locations/us-central1/connectors/vpc-con", - "state": "READY", - "subnet": [], - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDB9fQ==" - } - ] - }, - { - "mode": "managed", - "type": "null_resource", - "name": "build_api_image", - "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", - "instances": [ - { - "status": "tainted", - "schema_version": 0, - "attributes": { - "id": "3506868834926284281", - "triggers": { - "full_image_path": "us-central1-docker.pkg.dev/tag-engine-develop/cloud-run-source-deploy/tag-engine-api", - "project_id": "tag-engine-develop", - "region": "us-central1" - } - }, - "sensitive_attributes": [], - "dependencies": [ - "google_artifact_registry_repository.image_registry", - "google_project_iam_binding.log_writer", - "google_project_iam_binding.repo_admin", - "google_project_iam_binding.storage_object_get", - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "null_resource", - "name": "build_ui_image", - "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", - "instances": [ - { - "status": "tainted", - "schema_version": 0, - "attributes": { - "id": "428836800933208460", - "triggers": { - "full_image_path": "us-central1-docker.pkg.dev/tag-engine-develop/cloud-run-source-deploy/tag-engine-ui", - "project_id": "tag-engine-develop", - "region": "us-central1" - } - }, - "sensitive_attributes": [], - "dependencies": [ - "google_artifact_registry_repository.image_registry", - "google_project_iam_binding.log_writer", - "google_project_iam_binding.repo_admin", - "google_project_iam_binding.storage_object_get", - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "null_resource", - "name": "create_iap_sa", - "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "id": "528263991954606764", - "triggers": null - }, - "sensitive_attributes": [], - "dependencies": [ - "module.lb-http.google_compute_global_address.default" - ] - } - ] - }, - { - "mode": "managed", - "type": "null_resource", - "name": "firestore_indexes", - "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "id": "7474207779695593581", - "triggers": null - }, - "sensitive_attributes": [], - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - }, - { - "mode": "managed", - "type": "null_resource", - "name": "set_env_var", - "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", - "instances": [] - }, - { - "mode": "managed", - "type": "null_resource", - "name": "update_dns", - "provider": "provider[\"registry.terraform.io/hashicorp/null\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "id": "2397421846555348034", - "triggers": null - }, - "sensitive_attributes": [], - "dependencies": [ - "module.lb-http.google_compute_global_address.default" - ] - } - ] - }, - { - "module": "module.lb-http", - "mode": "managed", - "type": "google_compute_global_address", - "name": "default", - "provider": "provider[\"registry.terraform.io/hashicorp/google-beta\"]", - "instances": [ - { - "index_key": 0, - "schema_version": 0, - "attributes": { - "address": "34.36.3.44", - "address_type": "EXTERNAL", - "creation_timestamp": "2023-09-18T11:18:30.731-07:00", - "description": "", - "id": "projects/tag-engine-develop/global/addresses/tag-engine-lb-address", - "ip_version": "", - "label_fingerprint": "42WmSpB8rSM=", - "labels": null, - "name": "tag-engine-lb-address", - "network": "", - "prefix_length": 0, - "project": "tag-engine-develop", - "purpose": "", - "self_link": "https://www.googleapis.com/compute/v1/projects/tag-engine-develop/global/addresses/tag-engine-lb-address", - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19" - } - ] - }, - { - "module": "module.lb-http", - "mode": "managed", - "type": "google_compute_global_forwarding_rule", - "name": "http", - "provider": "provider[\"registry.terraform.io/hashicorp/google-beta\"]", - "instances": [] - }, - { - "module": "module.lb-http", - "mode": "managed", - "type": "google_compute_global_forwarding_rule", - "name": "https", - "provider": "provider[\"registry.terraform.io/hashicorp/google-beta\"]", - "instances": [] - }, - { - "module": "module.lb-http", - "mode": "managed", - "type": "google_compute_managed_ssl_certificate", - "name": "default", - "provider": "provider[\"registry.terraform.io/hashicorp/google-beta\"]", - "instances": [ - { - "index_key": 0, - "schema_version": 0, - "attributes": { - "certificate_id": 9078346602328173209, - "creation_timestamp": "2023-09-18T11:18:30.665-07:00", - "description": "", - "expire_time": "", - "id": "projects/tag-engine-develop/global/sslCertificates/tag-engine-lb-cert", - "managed": [ - { - "domains": [ - "tagengine.dev" - ] - } - ], - "name": "tag-engine-lb-cert", - "project": "tag-engine-develop", - "self_link": "https://www.googleapis.com/compute/v1/projects/tag-engine-develop/global/sslCertificates/tag-engine-lb-cert", - "subject_alternative_names": [], - "timeouts": null, - "type": "MANAGED" - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxODAwMDAwMDAwMDAwLCJkZWxldGUiOjE4MDAwMDAwMDAwMDB9fQ==", - "dependencies": [ - "module.lb-http.random_id.certificate" - ], - "create_before_destroy": true - } - ] - }, - { - "module": "module.lb-http", - "mode": "managed", - "type": "google_compute_ssl_certificate", - "name": "default", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [] - }, - { - "module": "module.lb-http", - "mode": "managed", - "type": "google_compute_target_http_proxy", - "name": "default", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [] - }, - { - "module": "module.lb-http", - "mode": "managed", - "type": "google_compute_target_https_proxy", - "name": "default", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [] - }, - { - "module": "module.lb-http", - "mode": "managed", - "type": "google_compute_url_map", - "name": "default", - "provider": "provider[\"registry.terraform.io/hashicorp/google-beta\"]", - "instances": [] - }, - { - "module": "module.lb-http", - "mode": "managed", - "type": "google_compute_url_map", - "name": "https_redirect", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "index_key": 0, - "schema_version": 0, - "attributes": { - "creation_timestamp": "2023-09-18T11:18:23.848-07:00", - "default_route_action": [], - "default_service": "", - "default_url_redirect": [ - { - "host_redirect": "", - "https_redirect": true, - "path_redirect": "", - "prefix_redirect": "", - "redirect_response_code": "MOVED_PERMANENTLY_DEFAULT", - "strip_query": false - } - ], - "description": "", - "fingerprint": "Gpv0BWJXrCU=", - "header_action": [], - "host_rule": [], - "id": "projects/tag-engine-develop/global/urlMaps/tag-engine-lb-https-redirect", - "map_id": 69615938343086720, - "name": "tag-engine-lb-https-redirect", - "path_matcher": [], - "project": "tag-engine-develop", - "self_link": "https://www.googleapis.com/compute/v1/projects/tag-engine-develop/global/urlMaps/tag-engine-lb-https-redirect", - "test": [], - "timeouts": null - }, - "sensitive_attributes": [], - "private": "eyJlMmJmYjczMC1lY2FhLTExZTYtOGY4OC0zNDM2M2JjN2M0YzAiOnsiY3JlYXRlIjoxMjAwMDAwMDAwMDAwLCJkZWxldGUiOjEyMDAwMDAwMDAwMDAsInVwZGF0ZSI6MTIwMDAwMDAwMDAwMH19" - } - ] - }, - { - "module": "module.lb-http", - "mode": "managed", - "type": "random_id", - "name": "certificate", - "provider": "provider[\"registry.terraform.io/hashicorp/random\"]", - "instances": [] - }, - { - "module": "module.storage_bucket-iam-bindings", - "mode": "managed", - "type": "google_storage_bucket_iam_member", - "name": "storage_bucket_iam_additive", - "provider": "provider[\"registry.terraform.io/hashicorp/google\"]", - "instances": [ - { - "index_key": "default--roles/storage.legacyBucketReader--serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com", - "schema_version": 0, - "attributes": { - "bucket": "b/tag-imports", - "condition": [], - "etag": "CAw=", - "id": "b/tag-imports/roles/storage.legacyBucketReader/serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com", - "member": "serviceAccount:tag-creator@tag-engine-develop.iam.gserviceaccount.com", - "role": "roles/storage.legacyBucketReader" - }, - "sensitive_attributes": [], - "private": "bnVsbA==", - "dependencies": [ - "google_project_service.tag_engine_project" - ] - } - ] - } - ], - "check_results": null -} From eec7348bbcc80a22d7464c0f97746a6a10dff4d0 Mon Sep 17 00:00:00 2001 From: Shirley Cohen Date: Sun, 22 Oct 2023 12:10:05 -0500 Subject: [PATCH 2/2] added checks for client secret file, updated deployment with higher mem for cloud run and 1 retry for task queue --- README.md | 4 +- deploy/external_load_balancer/cloud_run.tf | 22 +- deploy/external_load_balancer/iam_bindings.tf | 2 +- deploy/external_load_balancer/task_queues.tf | 2 +- deploy/without_load_balancer/cloud_run.tf | 24 +- deploy/without_load_balancer/iam_bindings.tf | 2 +- deploy/without_load_balancer/task_queues.tf | 2 +- docs/manual_deployment.md | 334 ++++++++++-------- main.py | 27 +- 9 files changed, 241 insertions(+), 178 deletions(-) diff --git a/README.md b/README.md index 2bc8f6b..22cf805 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,7 @@ This README is organized into four parts:
Tag Engine v2 comes with two Cloud Run services. One service is for the API (`tag-engine-api`) and the other is for the UI (`tag-engine-ui`). -The Cloud Run API service uses Bearer token headers for authentication. - -The Cloud Run UI service uses OAuth for authentication. It also uses the OAuth client's credentials (`client_secret.json`) for impersonation. +Both services use access tokens for authorization. The API service expects the client to pass in an access token when calling the API functions whereas the UI service uses OAuth to authorize the client from the front end. The client secret file is required for the OAuth flow. Follow the 6 steps below to deploy Tag Engine v2 with Terraform and without a load balancer. diff --git a/deploy/external_load_balancer/cloud_run.tf b/deploy/external_load_balancer/cloud_run.tf index 054976c..548a052 100644 --- a/deploy/external_load_balancer/cloud_run.tf +++ b/deploy/external_load_balancer/cloud_run.tf @@ -57,8 +57,15 @@ resource "google_cloud_run_v2_service" "api_service" { } containers { - image = null_resource.build_api_image.triggers.full_image_path - } + image = null_resource.build_api_image.triggers.full_image_path + + resources { + limits = { + memory = "1024Mi" + } + cpu_idle = true + } + } } depends_on = [null_resource.build_api_image] } @@ -126,9 +133,16 @@ resource "google_cloud_run_v2_service" "ui_service" { } containers { - - image = null_resource.build_ui_image.triggers.full_image_path + image = null_resource.build_ui_image.triggers.full_image_path + + resources { + limits = { + memory = "1024Mi" + } + cpu_idle = true + } } + vpc_access { connector = google_vpc_access_connector.connector.id egress = "PRIVATE_RANGES_ONLY" diff --git a/deploy/external_load_balancer/iam_bindings.tf b/deploy/external_load_balancer/iam_bindings.tf index ae25fd6..9189491 100644 --- a/deploy/external_load_balancer/iam_bindings.tf +++ b/deploy/external_load_balancer/iam_bindings.tf @@ -148,7 +148,7 @@ resource "google_project_iam_binding" "PolicyTagReader" { } resource "google_project_iam_binding" "BigQuerySchemaUpdate" { - project = var.tag_engine_project + project = var.bigquery_project role = "projects/${var.bigquery_project}/roles/BigQuerySchemaUpdate" members = ["serviceAccount:${var.tag_creator_sa}"] depends_on = [google_project_service.tag_engine_project] diff --git a/deploy/external_load_balancer/task_queues.tf b/deploy/external_load_balancer/task_queues.tf index a44ce0b..10bf9b3 100644 --- a/deploy/external_load_balancer/task_queues.tf +++ b/deploy/external_load_balancer/task_queues.tf @@ -33,7 +33,7 @@ resource "google_cloud_tasks_queue" "work_queue" { } retry_config { - max_attempts = 1 + max_attempts = 2 } stackdriver_logging_config { diff --git a/deploy/without_load_balancer/cloud_run.tf b/deploy/without_load_balancer/cloud_run.tf index f653f8e..20aa2ee 100644 --- a/deploy/without_load_balancer/cloud_run.tf +++ b/deploy/without_load_balancer/cloud_run.tf @@ -6,7 +6,6 @@ resource "google_artifact_registry_repository" "image_registry" { depends_on = [google_project_service.tag_engine_project] } - # ************************************************************ # # Create the Cloud Run API service # ************************************************************ # @@ -57,8 +56,15 @@ resource "google_cloud_run_v2_service" "api_service" { } containers { - image = null_resource.build_api_image.triggers.full_image_path - } + image = null_resource.build_api_image.triggers.full_image_path + + resources { + limits = { + memory = "1024Mi" + } + cpu_idle = true + } + } } depends_on = [null_resource.build_api_image] } @@ -118,9 +124,15 @@ resource "google_cloud_run_v2_service" "ui_service" { } containers { - - image = null_resource.build_ui_image.triggers.full_image_path - } + image = null_resource.build_ui_image.triggers.full_image_path + + resources { + limits = { + memory = "1024Mi" + } + cpu_idle = true + } + } } depends_on = [null_resource.build_ui_image] } diff --git a/deploy/without_load_balancer/iam_bindings.tf b/deploy/without_load_balancer/iam_bindings.tf index ae25fd6..9189491 100644 --- a/deploy/without_load_balancer/iam_bindings.tf +++ b/deploy/without_load_balancer/iam_bindings.tf @@ -148,7 +148,7 @@ resource "google_project_iam_binding" "PolicyTagReader" { } resource "google_project_iam_binding" "BigQuerySchemaUpdate" { - project = var.tag_engine_project + project = var.bigquery_project role = "projects/${var.bigquery_project}/roles/BigQuerySchemaUpdate" members = ["serviceAccount:${var.tag_creator_sa}"] depends_on = [google_project_service.tag_engine_project] diff --git a/deploy/without_load_balancer/task_queues.tf b/deploy/without_load_balancer/task_queues.tf index a44ce0b..10bf9b3 100644 --- a/deploy/without_load_balancer/task_queues.tf +++ b/deploy/without_load_balancer/task_queues.tf @@ -33,7 +33,7 @@ resource "google_cloud_tasks_queue" "work_queue" { } retry_config { - max_attempts = 1 + max_attempts = 2 } stackdriver_logging_config { diff --git a/docs/manual_deployment.md b/docs/manual_deployment.md index 625ff57..8ed57b5 100644 --- a/docs/manual_deployment.md +++ b/docs/manual_deployment.md @@ -10,16 +10,16 @@ This procedure deploys the Tag Engine v2 components by hand. The steps are carri 2. Define 6 environment variables which will be used throughout the deployment: -``` -export TAG_ENGINE_PROJECT="" # GCP project id for running the Tag Engine service -export TAG_ENGINE_REGION="" # GCP region for running Tag Engine service, e.g. us-central1 + ``` + export TAG_ENGINE_PROJECT="" # GCP project id for running the Tag Engine service + export TAG_ENGINE_REGION="" # GCP region for running Tag Engine service, e.g. us-central1 -export BIGQUERY_PROJECT="" # GCP project used by BigQuery data assets, can be equal to TAG_ENGINE_PROJECT. This variable is only used for setting IAM permissions in steps 10 and 11 -export BIGQUERY_REGION="" # GCP region in which data assets in BigQuery are stored, e.g. us-central1 + export BIGQUERY_PROJECT="" # GCP project used by BigQuery data assets, can be equal to TAG_ENGINE_PROJECT. This variable is only used for setting IAM permissions in steps 10 and 11 + export BIGQUERY_REGION="" # GCP region in which data assets in BigQuery are stored, e.g. us-central1 -export TAG_ENGINE_SA="@.iam.gserviceaccount.com" # email of your Cloud Run service account for running Tag Engine service -export TAG_CREATOR_SA="@.iam.gserviceaccount.com" # email of your Tag creator service account for running BQ queries and creating DC tags -``` + export TAG_ENGINE_SA="@.iam.gserviceaccount.com" # email of your Cloud Run service account for running Tag Engine service + export TAG_CREATOR_SA="@.iam.gserviceaccount.com" # email of your Tag creator service account for running BQ queries and creating DC tags + ``` The key benefit of decoupling `TAG_ENGINE_SA` from `TAG_CREATOR_SA` is to limit the scope of what a Tag Engine client is allowed to tag. More specifically, when a client submits a request to Tag Engine, Tag Engine checks to see if they are authorized to use `TAG_CREATOR_SA` before processing their request. A Tag Engine client can either be a user identity or a service account. @@ -39,15 +39,15 @@ If multiple teams want to share an instance of Tag Engine and they own different 4. Open `tagengine.ini` and set the following variables in this file. The first five should be equal to the environment variables you previously set in step 2: -``` -TAG_ENGINE_PROJECT -TAG_ENGINE_REGION -BIGQUERY_REGION -CLOUD_RUN_ACCOUNT -TAG_CREATOR_ACCOUNT -OAUTH_CLIENT_CREDENTIALS -ENABLE_AUTH -``` + ``` + TAG_ENGINE_PROJECT + TAG_ENGINE_REGION + BIGQUERY_REGION + CLOUD_RUN_ACCOUNT + TAG_CREATOR_ACCOUNT + OAUTH_CLIENT_CREDENTIALS + ENABLE_AUTH + ``` A couple of notes: @@ -60,28 +60,28 @@ ENABLE_AUTH 5. Enable the required Google Cloud APIs in your project: -`gcloud config set project $TAG_ENGINE_PROJECT` - -``` -gcloud services enable iam.googleapis.com -gcloud services enable cloudresourcemanager.googleapis.com -gcloud services enable firestore.googleapis.com -gcloud services enable cloudtasks.googleapis.com -gcloud services enable datacatalog.googleapis.com -gcloud services enable artifactregistry.googleapis.com -gcloud services enable cloudbuild.googleapis.com -``` + `gcloud config set project $TAG_ENGINE_PROJECT` + + ``` + gcloud services enable iam.googleapis.com + gcloud services enable cloudresourcemanager.googleapis.com + gcloud services enable firestore.googleapis.com + gcloud services enable cloudtasks.googleapis.com + gcloud services enable datacatalog.googleapis.com + gcloud services enable artifactregistry.googleapis.com + gcloud services enable cloudbuild.googleapis.com + ```
6. Create two task queues, the first one is used to queue the tag request, the second is used to queue the individual work items: -``` -gcloud tasks queues create tag-engine-injector-queue \ - --location=$TAG_ENGINE_REGION --max-attempts=1 --max-concurrent-dispatches=100 + ``` + gcloud tasks queues create tag-engine-injector-queue \ + --location=$TAG_ENGINE_REGION --max-attempts=1 --max-concurrent-dispatches=100 -gcloud tasks queues create tag-engine-work-queue \ - --location=$TAG_ENGINE_REGION --max-attempts=1 --max-concurrent-dispatches=100 -``` + gcloud tasks queues create tag-engine-work-queue \ + --location=$TAG_ENGINE_REGION --max-attempts=1 --max-concurrent-dispatches=100 + ```
7. Create two custom IAM roles which are required by `SENSITIVE_COLUMN_CONFIG`, a configuration type that creates policy tags on sensitive columns: @@ -104,91 +104,91 @@ gcloud iam roles create PolicyTagReader \ 8. Grant the required IAM roles and policy bindings for the accounts `TAG_ENGINE_SA` and `TAG_CREATOR_SA`: -``` -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_ENGINE_SA \ - --role=roles/cloudtasks.enqueuer + ``` + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_ENGINE_SA \ + --role=roles/cloudtasks.enqueuer -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_ENGINE_SA \ - --role=roles/cloudtasks.taskRunner + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_ENGINE_SA \ + --role=roles/cloudtasks.taskRunner -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_ENGINE_SA \ - --role=roles/datastore.user + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_ENGINE_SA \ + --role=roles/datastore.user -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_ENGINE_SA \ - --role=roles/datastore.indexAdmin + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_ENGINE_SA \ + --role=roles/datastore.indexAdmin -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_ENGINE_SA \ - --role=roles/run.invoker -``` - -``` -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_CREATOR_SA \ - --role=roles/datacatalog.tagEditor - -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_CREATOR_SA \ - --role=roles/datacatalog.tagTemplateUser + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_ENGINE_SA \ + --role=roles/run.invoker + ``` + + ``` + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_CREATOR_SA \ + --role=roles/datacatalog.tagEditor + + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_CREATOR_SA \ + --role=roles/datacatalog.tagTemplateUser -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_CREATOR_SA \ - --role=roles/datacatalog.tagTemplateViewer + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_CREATOR_SA \ + --role=roles/datacatalog.tagTemplateViewer -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_CREATOR_SA \ - --role=roles/datacatalog.viewer + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_CREATOR_SA \ + --role=roles/datacatalog.viewer -gcloud projects add-iam-policy-binding $BIGQUERY_PROJECT \ - --member=serviceAccount:$TAG_CREATOR_SA \ - --role=roles/bigquery.dataEditor + gcloud projects add-iam-policy-binding $BIGQUERY_PROJECT \ + --member=serviceAccount:$TAG_CREATOR_SA \ + --role=roles/bigquery.dataEditor -gcloud projects add-iam-policy-binding $BIGQUERY_PROJECT \ - --member=serviceAccount:$TAG_CREATOR_SA \ - --role=roles/bigquery.jobUser - -gcloud projects add-iam-policy-binding $BIGQUERY_PROJECT \ - --member=serviceAccount:$TAG_CREATOR_SA \ - --role=roles/bigquery.metadataViewer - -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_CREATOR_SA \ - --role=roles/logging.viewer - -gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ - --member=serviceAccount:$TAG_CREATOR_SA \ - --role=projects/$TAG_ENGINE_PROJECT/roles/PolicyTagReader - -gcloud projects add-iam-policy-binding $BIGQUERY_PROJECT \ - --member=serviceAccount:$TAG_CREATOR_SA \ - --role=projects/$BIGQUERY_PROJECT/roles/BigQuerySchemaUpdate -``` - -``` -gcloud iam service-accounts add-iam-policy-binding $TAG_ENGINE_SA \ - --member=serviceAccount:$TAG_ENGINE_SA --role roles/iam.serviceAccountUser + gcloud projects add-iam-policy-binding $BIGQUERY_PROJECT \ + --member=serviceAccount:$TAG_CREATOR_SA \ + --role=roles/bigquery.jobUser + + gcloud projects add-iam-policy-binding $BIGQUERY_PROJECT \ + --member=serviceAccount:$TAG_CREATOR_SA \ + --role=roles/bigquery.metadataViewer + + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_CREATOR_SA \ + --role=roles/logging.viewer + + gcloud projects add-iam-policy-binding $TAG_ENGINE_PROJECT \ + --member=serviceAccount:$TAG_CREATOR_SA \ + --role=projects/$TAG_ENGINE_PROJECT/roles/PolicyTagReader + + gcloud projects add-iam-policy-binding $BIGQUERY_PROJECT \ + --member=serviceAccount:$TAG_CREATOR_SA \ + --role=projects/$BIGQUERY_PROJECT/roles/BigQuerySchemaUpdate + ``` + + ``` + gcloud iam service-accounts add-iam-policy-binding $TAG_ENGINE_SA \ + --member=serviceAccount:$TAG_ENGINE_SA --role roles/iam.serviceAccountUser -gcloud iam service-accounts add-iam-policy-binding $TAG_CREATOR_SA \ - --member=serviceAccount:$TAG_ENGINE_SA --role=roles/iam.serviceAccountUser + gcloud iam service-accounts add-iam-policy-binding $TAG_CREATOR_SA \ + --member=serviceAccount:$TAG_ENGINE_SA --role=roles/iam.serviceAccountUser -gcloud iam service-accounts add-iam-policy-binding $TAG_CREATOR_SA \ - --member=serviceAccount:$TAG_ENGINE_SA --role=roles/iam.serviceAccountTokenCreator -``` + gcloud iam service-accounts add-iam-policy-binding $TAG_CREATOR_SA \ + --member=serviceAccount:$TAG_ENGINE_SA --role=roles/iam.serviceAccountTokenCreator + ``` Note: If you plan to create tags from CSV files, you also need to ensure that `TAG_CREATOR_SA` has the `storage.buckets.get` permission on the GCS bucket where the CSV files are stored. To do that, you can create a custom role with this permission or assign the `storage.legacyBucketReader` role: -``` -gcloud storage buckets add-iam-policy-binding gs:// \ - --member=serviceAccount:$TAG_CREATOR_SA' \ - --role=roles/storage.legacyBucketReader -``` + ``` + gcloud storage buckets add-iam-policy-binding gs:// \ + --member=serviceAccount:$TAG_CREATOR_SA' \ + --role=roles/storage.legacyBucketReader + ```
@@ -209,55 +209,75 @@ gcloud alpha firestore databases create --project=$TAG_ENGINE_PROJECT --location First, you must download a private key for your `$TAG_ENGINE_SA`: -``` -gcloud iam service-accounts keys create private_key.json --iam-account=$TAG_ENGINE_SA -export GOOGLE_APPLICATION_CREDENTIALS="private_key.json" -``` + ``` + gcloud iam service-accounts keys create private_key.json --iam-account=$TAG_ENGINE_SA + export GOOGLE_APPLICATION_CREDENTIALS="private_key.json" + ``` Second, create the composite indexes which are needed for serving multiple read requests: -``` -cd deploy -python create_indexes.py $TAG_ENGINE_PROJECT -cd .. -``` + ``` + pip install google-cloud-firestore + cd deploy/external_load_balancer + python create_indexes.py $TAG_ENGINE_PROJECT + cd .. + ``` - Note: the above script is expected to run for 10-12 minutes. As the indexes get created, you will see them show up in the Firestore console. There should be 36 indexes in total.

+ Note: the above script is expected to run for 10-12 minutes. As the indexes get created, you will see them show up in the Firestore console. There should be about 36 indexes.

- 11. Build and deploy the Cloud Run services: - There is one Cloud Run service for the API and one Cloud Run service for the UI. They are both built from the same code base. + There is one service in Cloud Run for the API (tag-engine-api) and another service in Cloud Run for the UI (tag-engine-ui). They are both built from the same code base. The next two commands require `gcloud beta`. You can install `gcloud beta` by running `gcloud components install beta`. -``` -gcloud beta run deploy tag-engine-api \ - --source . \ - --platform managed \ - --region $TAG_ENGINE_REGION \ - --no-allow-unauthenticated \ - --ingress=all \ - --service-account=$TAG_ENGINE_SA -``` - - The next command requires a VPC access connector. This is used to send requests to your VPC network from Cloud Run using internal DNS and internal IP addresses as opposed to going through the public internet. To create a connector, consult [this page](https://cloud.google.com/vpc/docs/configure-serverless-vpc-access#gcloud). - -``` -gcloud beta run deploy tag-engine-ui \ - --source . \ - --platform managed \ - --region $TAG_ENGINE_REGION \ - --allow-unauthenticated \ - --ingress=internal-and-cloud-load-balancing \ - --port=8080 \ - --min-instances=0 \ - --max-instances=5 \ - --service-account=$TAG_ENGINE_SA \ - --vpc-connector=projects/$TAG_ENGINE_PROJECT/locations/$TAG_ENGINE_REGION/connectors/$VPC_CONNECTOR \ - --vpc-egress=private-ranges-only -``` + ``` + gcloud beta run deploy tag-engine-api \ + --source . \ + --platform managed \ + --region $TAG_ENGINE_REGION \ + --no-allow-unauthenticated \ + --ingress=all \ + --memory=1024Mi \ + --service-account=$TAG_ENGINE_SA + ``` + + To deploy the UI service without IAP: + + ``` + gcloud beta run deploy tag-engine-ui \ + --source . \ + --platform managed \ + --region $TAG_ENGINE_REGION \ + --allow-unauthenticated \ + --ingress=all \ + --memory=1024Mi \ + --service-account=$TAG_ENGINE_SA + + ``` + + To deploy the UI service behind IAP: + + Note: This option requires an external load balancer and VPC access connector. + + Create a VPC access connector before running the next command. This connector is used to send requests to your VPC network from Cloud Run using internal DNS and internal IP addresses as opposed to going through the public internet. To create a connector, consult [this page](https://cloud.google.com/vpc/docs/configure-serverless-vpc-access#gcloud). + + ``` + gcloud beta run deploy tag-engine-ui \ + --source . \ + --platform managed \ + --region $TAG_ENGINE_REGION \ + --allow-unauthenticated \ + --ingress=internal-and-cloud-load-balancing \ + --port=8080 \ + --min-instances=0 \ + --max-instances=5 \ + --memory=1024Mi, + --service-account=$TAG_ENGINE_SA \ + --vpc-connector=projects/$TAG_ENGINE_PROJECT/locations/$TAG_ENGINE_REGION/connectors/$VPC_CONNECTOR \ + --vpc-egress=private-ranges-only + ```
@@ -265,30 +285,34 @@ gcloud beta run deploy tag-engine-ui \ If you are deploying the API, run: -``` -export API_SERVICE_URL=`gcloud run services describe tag-engine-api --format="value(status.url)"` -gcloud run services update tag-engine-api --set-env-vars SERVICE_URL=$API_SERVICE_URL -``` + ``` + export API_SERVICE_URL=`gcloud run services describe tag-engine-api --format="value(status.url)"` + gcloud run services update tag-engine-api --set-env-vars SERVICE_URL=$API_SERVICE_URL + ``` If you are deploying the UI, run: -``` -export UI_SERVICE_URL=`gcloud run services describe tag-engine-ui --format="value(status.url)"` -gcloud run services update tag-engine-ui --set-env-vars SERVICE_URL=$UI_SERVICE_URL -``` + ``` + export UI_SERVICE_URL=`gcloud run services describe tag-engine-ui --format="value(status.url)"` + gcloud run services update tag-engine-ui --set-env-vars SERVICE_URL=$UI_SERVICE_URL + ```
-13. Put an HTTP Load Balancer in front of the UI Cloud Run service: +13. Put an HTTP External Load Balancer in front of the UI Cloud Run service: - Note: This step is only required if you are deploying the UI. + If you are deploying the UI service in Cloud Run without a load balancer, skip this step. + + The benefit of fronting the UI with a load balancer is to be able to secure access with IAP (Note: IAP is in addition to OAuth). + + You cannot attach IAP directly to a Cloud Run service, you need to go through a load balancer. - - Create an application load balancer that accepts incoming HTTPS requests - - Attach the frontend of the load balancer to your Tag Engine domain - - Create a [serverless network endpoint group](https://cloud.google.com/load-balancing/docs/negs/serverless-neg-concepts) (or NEG) that references the Tag Engine UI Cloud Run service (tag-engine-ui) + - Create an external application load balancer that accepts incoming HTTPS requests + - Attach the frontend of the load balancer to your custom domain for Tag Engine + - Create a [serverless network endpoint group](https://cloud.google.com/load-balancing/docs/negs/serverless-neg-concepts) (or NEG) that references the Tag Engine UI Cloud Run service (tag-engine-ui) - Attach the backend of the load balancer to the NEG - Once the load balancer is up, use its IP address to create an `A record` in Cloud DNS. + Once the external load balancer is up, use its IP address to create an `A record` in Cloud DNS. Open IAP and confirm that it is connected to your load balancer's backend. Inside IAP, grant the `IAP-secured Web App User` role to the user identities who are allowed to access the Tag Engine UI. diff --git a/main.py b/main.py index d735bd9..4f82e05 100644 --- a/main.py +++ b/main.py @@ -56,13 +56,29 @@ def check_service_url(): return -1 check_service_url() -##################### INIT GLOBAL VARIABLES ################################## -print('enable_auth variable:', config['DEFAULT']['ENABLE_AUTH'].lower()) +##################### CHECK CLIENT SECRET ##################### + if config['DEFAULT']['ENABLE_AUTH'].lower() == 'true' or config['DEFAULT']['ENABLE_AUTH'] == 1: ENABLE_AUTH = True + print('Info: ENABLE_AUTH = True') else: ENABLE_AUTH = False + print('Info: ENABLE_AUTH = False. This option is only supported in API mode as the client secret is needed to obtain an access token from the UI.') + +def check_client_secret(): + if 'OAUTH_CLIENT_CREDENTIALS' in config['DEFAULT']: + OAUTH_CLIENT_CREDENTIALS = config['DEFAULT']['OAUTH_CLIENT_CREDENTIALS'].strip() + else: + if 'tag-engine-ui-' in os.environ['SERVICE_URL']: + print('Fatal Error: The Tag Engine UI requires the OAUTH_CLIENT_CREDENTIALS variable to be set. Please set it in tagengine.ini.') + return -1 + else: + print('Info: running in API mode without the client secret file') + +check_client_secret() + +##################### INIT GLOBAL VARIABLES ################################## TAG_ENGINE_PROJECT = config['DEFAULT']['TAG_ENGINE_PROJECT'].strip() TAG_ENGINE_REGION = config['DEFAULT']['TAG_ENGINE_REGION'].strip() @@ -80,8 +96,7 @@ def check_service_url(): tm = taskm.TaskManager(TAG_ENGINE_SA, TAG_ENGINE_PROJECT, TAG_ENGINE_REGION, WORK_QUEUE, RUN_TASK_HANDLER) SCOPES = ['openid', 'https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/userinfo.email'] -OAUTH_CLIENT_CREDENTIALS = config['DEFAULT']['OAUTH_CLIENT_CREDENTIALS'].strip() - + USER_AGENT = 'cloud-solutions/datacatalog-tag-engine-v2' store = tesh.TagEngineStoreHandler() @@ -3779,13 +3794,13 @@ def _run_task(): @app.route("/version", methods=['GET']) def version(): - return "Welcome to Tag Engine version 2.1.2" + return "Welcome to Tag Engine version 2.1.2\n" ####################### TEST METHOD #################################### @app.route("/ping", methods=['GET']) def ping(): - return "Tag Engine is alive" + return "Tag Engine is alive\n" #[END ping] @app.errorhandler(500)