Google Cloud Provider Overview
The officially supported Nitric Google Cloud Platform (GCP) Provider.
provider: nitric/gcp@latest
See the Overview page for general information on Nitric Pulumi providers.
The Google Cloud provider is supported by the Nitric SDKs and CLI by default. However, credentials for a Google Cloud account will be required when using the up command from the CLI.
Google Cloud Credentials
Authorize gcloud
to access the Cloud Platform with Google user credentials:
gcloud auth application-default login
Google CLI Installation
Installing the Google Cloud CLI assists with credentials setup. You can install it using these summarized instructions, for more options see the Google docs.
Download & install the latest CLI release.
Create Billing Account
For Google Cloud to allow deployments, a billing account must be created and attached to the project you deploy to.
Importing Existing Resources
The Nitric team is working to expand the list of resources that can be imported. Currently, only the following resources are supported:
Only resources in the same GCP project as specified by gcp-project-id are currently supported.
Secrets
To import a secret, you will need to know the secret's unique name. You can find the name of a secret in the Google Cloud Secret Manager in the browser or by using the gcloud CLI.
First, add the secret to your project as you usually would if it wasn't imported. Then add the secret to the import
section of your stack file. Here's an example of how to import a secret:
import { secret } from "@nitric/sdkconst mySecret = secret("credentials").allow("access");
import:secrets:credentials: existing-secret
Need to import another resource type or have another question? Chat with us on Discord or open an issue on GitHub.
Stack Configuration
# The provider to use and it's published version# See releases:# https://github.com/nitrictech/nitric/tagsprovider: nitric/gcp@latest# The target GCP region to deploy to# See available regions:# https://cloud.google.com/run/docs/locationsregion: my-gcp-stack-region# ID of the google cloud project to deploy intogcp-project-id: my-gcp-project-id# All configuration below is optional# The timezone that deployed schedules will run with# Format is in tz identifiers:# https://en.wikipedia.org/wiki/List_of_tz_database_time_zonesschedule-timezone: Australia/Sydney# Import existing GCP Resources# Currently only secrets are supported# Available since v1.4.0import:# A map of nitric names to GCP Secret Manager namessecrets: # Available since v1.4.0# NOTE: Imported secrets must exist in the same project as specified by gcp-project-id# In typescript this would import the provided secret reference for a secret declared as# const mySecret = secret('my-secret');my-secret: existing-secret# Apply configuration to nitric APIsapis:# Target an API by its nitric namemy-api:# provide domains to be used for the apidescription: An Azure API# Configure your deployed servicesconfig:# How services without a type will be deployeddefault:# configure services to deploy to Google Cloud Runcloudrun:# set 512MB of RAM# See cloudrun configuration docs here:# https://cloud.google.com/run/docs/configuring/memory-limitsmemory: 512# set a timeout of 15 seconds# https://cloud.google.com/run/docs/configuring/request-timeouttimeout: 15# The maximum number of instances to scale down to# https://cloud.google.com/run/docs/configuring/min-instancesmin-instances: 0# The maximum number of instances to scale up to# https://cloud.google.com/run/docs/configuring/max-instancesmax-instances: 10# Number of concurrent requests that each instance can handle# https://cloud.google.com/run/docs/configuring/concurrencyconcurrency: 80# Additional deployment types# You can target these types by setting a `type` in your project configurationbig-service:cloudrun:memory: 1024timeout: 60min-instances: 2max-instances: 100concurrency: 1000