forked from GoogleCloudPlatform/cdmc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
environment-variables.example
96 lines (76 loc) · 4.8 KB
/
environment-variables.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
# Copyright 2023 The Reg Reporting Blueprint Authors
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Set the environment variables
# These must be configured by the user
export PROJECT_ID_DATA="REPLACE WITH YOUR VALUE"
export PROJECT_ID_GOV="REPLACE WITH YOUR VALUE"
export REGION="REPLACE WITH YOUR VALUE" # eg: us-central1
# Other GCP variables
gcloud config set project ${PROJECT_ID_DATA}
export ORGANIZATION_ID="$(gcloud projects get-ancestors $PROJECT_ID_DATA | grep organization | cut -f1 -d' ')" #This method works even when we have folder structure
export GOOGLE_PROJECT=$PROJECT_ID_DATA
# Data Load variables
export PROJECT_NUMBER_DATA=$(gcloud projects describe $PROJECT_ID_DATA --format="value(projectNumber)")
export GCS_BUCKET_TPCDI=${PROJECT_NUMBER_DATA}-tpcdi-data
export PROJECT_NUMBER_GOV=$(gcloud projects describe $PROJECT_ID_GOV --format="value(projectNumber)")
export KMS_KEYRING=cmek-keyring-bigquery
export KMS_KEYNAME=cmek-bigquery-key
export KMS_KEY="projects/${PROJECT_ID_DATA}/locations/${REGION}/keyRings/${KMS_KEYRING}/cryptoKeys/${KMS_KEYNAME}"
# CloudDQ variables
export CLOUDDQ_BIGQUERY_DATASET="cloud_dq"
# Policy Tags
export AUTHENTICATED_USER="$(gcloud config list account --format 'value(core.account)')"
# CDMC Controls Cloud Run
#gcloud config set project ${PROJECT_ID_GOV} # Switch back to governance project as the service is deployed there
#export ENDPOINT="$(gcloud run services describe cdmc-reportengine --region $REGION --format='value(status.url)')"
#export REPORTENGINE_SA="cdmc-reportengine@$PROJECT_ID_GOV.iam.gserviceaccount.com" # email of your Tag creator service account for running BQ queries and creating DC tags
#gcloud config set project ${PROJECT_ID_DATA} # Back to data
# Tag Engine
export TAG_ENGINE_PROJECT=$PROJECT_ID_GOV # GCP project id for running the Tag Engine service
export TAG_ENGINE_REGION=$REGION # GCP region for running Tag Engine service
export BIGQUERY_PROJECT=$PROJECT_ID_DATA # 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=$REGION # GCP region in which data assets in BigQuery are stored, e.g. us-central1
export CLOUD_RUN_SA="cloud-run@$PROJECT_ID_GOV.iam.gserviceaccount.com" # email of your Cloud Run service account for running Tag Engine service
export TAG_CREATOR_SA="tag-creator@$PROJECT_ID_GOV.iam.gserviceaccount.com" # email of your Tag creator service account for running BQ queries and creating DC tags
# Tagging Variables
export TAG_CREATOR_SA="tag-creator@${PROJECT_ID_GOV}.iam.gserviceaccount.com"
export TAG_HISTORY_BIGQUERY_DATASET="tag_history_logs"
echo -e "\nYour environment variables have been initialised as follows:"
echo -e "\n\nKey variables:"
echo -e "\tORGANIZATION_ID :" $ORGANIZATION_ID
echo -e "\tPROJECT_ID_DATA :" $PROJECT_ID_DATA
echo -e "\tPROJECT_ID_GOV :" $PROJECT_ID_GOV
echo -e "\tPROJECT_NUMBER_DATA :" $PROJECT_NUMBER_DATA
echo -e "\tPROJECT_NUMBER_GOV :" $PROJECT_NUMBER_GOV
echo -e "\tREGION :" $REGION
echo -e "\n\nData Load:"
echo -e "\tGCS_BUCKET_TPCDI :" $GCS_BUCKET_TPCDI
echo -e "\tKMS_KEY :" $KMS_KEY
echo -e "\tKMS_KEYRING :" $KMS_KEYRING
echo -e "\tKMS_KEYNAME :" $KMS_KEYNAME
echo -e "\tKMS_KEY :" $KMS_KEY
echo -e "\n\nData Quality:"
echo -e "\tCLOUDDQ_BIGQUERY_DATASET :" $CLOUDDQ_BIGQUERY_DATASET
echo -e "\n\nTagging:"
echo -e "\tTAG_CREATOR_SA :" $TAG_CREATOR_SA
echo -e "\tTAG_HISTORY_BIGQUERY_DATASET :" $TAG_HISTORY_BIGQUERY_DATASET
echo -e "\n\nReport Engine:"
echo -e "\tGOOGLE_PROJECT :" $GOOGLE_PROJECT
#echo -e "\n\nCDMC Controls detector:"
#echo -e "\tENDPOINT :" $ENDPOINT
echo -e "\n\nTag Engine:"
echo -e "\tTAG_ENGINE_REGION :" $TAG_ENGINE_REGION
echo -e "\tTAG_ENGINE_PROJECT :" $TAG_ENGINE_PROJECT
echo -e "\tBIGQUERY_PROJECT :" $BIGQUERY_PROJECT
echo -e "\tBIGQUERY_REGION :" $BIGQUERY_REGION
echo -e "\tCLOUD_RUN_SA :" $CLOUD_RUN_SA
echo -e "\tTAG_CREATOR_SA :" $TAG_CREATOR_SA