Envrionment for working with GCP VCFs
-
Ensure Python 3.6+ is installed on your system
-
Create a GCP project
-
Create a service account for running the VCFs
-
Create a JSON key for the service account
-
Add the service account to the project Owner or Viewer role
-
In
.vscode/launch.json
fill in theCREDENTIAL_KEY
,CREDENTIAL_ID
andPROJECT_ID
for the service account. Be sure to escape the JSON. Avoid using online tools to do this due to the sensitive nature of what you are escaping. The resultingenv
map will resemble:{ "CREDENTIAL_ID" : "[email protected]", "CREDENTIAL_KEY": "{\"type\":\"service_account\",\"project_id\":\"your-project\",\"private_key_id\":\"...}", "PROJECT_ID" : "your-project" }
-
In
init.sh
(Mac/Linux)/init.ps1
(Windows) replace YOUR_BITBUCKET_USER with the name of your Cloud Academy BitBucket user -
Run
init.sh
(Mac/Linux)/init.ps1
(Windows) to set up the environment- Enter your Cloud Academy BitBucket password/app password when prompted.
-
Add the following line to
.gitignore
to avoid committing any sensitive information:.vscode/
-
Develop and debug functions using the
Current File (Integrated Terminal)
configuration (press F5 with the file open)If you see any errors with importing modules, ensure VS Code is configured to use the venv Python by checking the lower-left status bar in VS Code:
- Run
init.sh
(Mac/Linux)/init.ps1
(Windows) to set up the virtual environment again. (only thevenv/
directory is impacted by this operation)