github.com/hairyhenderson/gomplate/v4@v4.0.0-pre-2.0.20240520121557-362f058f0c93/docs-src/content/functions/gcp.yml (about) 1 ns: gcp 2 preamble: | 3 The functions in the `gcp` namespace interface with various Google Cloud Platform 4 APIs to make it possible for a template to render differently based on the GCP 5 environment and metadata. 6 7 ### Configuring GCP 8 9 A number of environment variables can be used to control how gomplate communicates 10 with GCP APIs. 11 12 | Environment Variable | Description | 13 | -------------------- | ----------- | 14 | `GCP_META_ENDPOINT` | _(Default `http://metadata.google.internal`)_ Sets the base address of the instance metadata service. | 15 | `GCP_TIMEOUT` | _(Default `500`)_ Adjusts timeout for API requests, in milliseconds. | 16 funcs: 17 - name: gcp.Meta 18 released: v3.8.0 19 description: | 20 Queries GCP [Instance Metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata) for information. 21 22 For times when running outside GCP, or when the metadata API can't be reached, a `default` value can be provided. 23 pipeline: false 24 arguments: 25 - name: key 26 required: true 27 description: the metadata key to query 28 - name: default 29 required: false 30 description: the default value 31 examples: 32 - | 33 $ echo '{{gcp.Meta "id"}}' | gomplate 34 1334999446930701104 35 - | 36 $ echo '{{gcp.Meta "network-interfaces/0/ip"}}' | gomplate 37 10.128.0.23