The main purpose of this repository is to create resources needed for model serving using Google Cloud Platform (GCP) cloud functions. Notes can be found in my notes-md repository. Model inference code can be found in gcp-cloud-run-function-model-inference.
- gcloud
- terraform
- terragrunt
- terraform-docs this is required for
terraform_docs
hooks - pre-commit
- Have a Google Cloud account account and associated credentials.
-
Navigate to the environment you would like to deploy,
-
Initialize the configuration with:
terragrunt init
-
Plan your changes with:
terragrunt plan
-
If you're happy with the changes
terragrunt apply
Note
Please note that terragrunt will create a bucket for storing the remote state. Ensure the account deploying the resources has the appropriate permissions to create or connect to these resources.
Git hook scripts are very helpful for identifying simple issues before pushing any changes. Hooks will run on every commit automatically pointing out issues in the code e.g. trailing whitespace.
To help with the maintenance of these hooks, pre-commit is used, along with pre-commit-hooks.
Please following these instructions to install pre-commit
locally and ensure that you have run pre-commit install
to install the hooks for this project.
Additionally, once installed, the hooks can be updated to the latest available version with pre-commit autoupdate
.
Code formatting and documentation for variables
and outputs
is generated using pre-commit-terraform hooks that in turn uses terraform-docs that will insert/update documentation. The following markers have been added to the README.md
:
<!-- {BEGINNING|END} OF PRE-COMMIT-TERRAFORM DOCS HOOK --->
Two service accounts are created and need to be referenced within the gcp-cloud-run-function-model-inference repository. In order to retrieve these secrets to be used elsewhere, the following command can be used:
terragrunt output -raw prediction_service_account_key > prediction_service_account.json \
terragrunt output -raw github_action_service_account_key > github_action_service_account.json
Name | Version |
---|---|
terraform | >= 1.5.7, <= 1.9.0 |
~> 6.6.0 |
Name | Version |
---|---|
6.6.0 |
No modules.
Name | Description | Type | Default | Required |
---|---|---|---|---|
env_prefix | The prefix added to resources in the environment. | string |
n/a | yes |
gcp_default_labels | Labels that will be applied to all resources with a top level labels field or a labels field nested inside a top level metadata field. |
map(string) |
{} |
no |
gcp_project | The default project to manage resources in. | string |
n/a | yes |
gcp_region | The default region to manage resources in. | string |
n/a | yes |
gcp_zone | The default zone to manage resources in. Generally, this zone should be within the default region you specified. |
string |
n/a | yes |
project_name | The name of the project. | string |
n/a | yes |
Name | Description |
---|---|
gcp_project_number | The numeric identifier of the project. |
github_action_service_account_key | The GitHub service account private key in JSON format, base64 encoded. |
prediction_service_account_key | The prediction service private key in JSON format, base64 encoded. |
prediction_service_docker_registry_id | The prediction service docker registry ID. |
prediction_service_docker_registry_name | The prediction service docker registry name. |