Skip to content

Commit e831628

Browse files
deps(go): Bump github.com/hairyhenderson/go-fsimpl to v0.4.0 and document support for gcp+sm URLs
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
1 parent 94ce42f commit e831628

File tree

3 files changed

+177
-165
lines changed

3 files changed

+177
-165
lines changed

docs/content/datasources.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Gomplate supports a number of datasources, each specified with a particular URL
6363
| [File](#using-file-datasources) | `file` | Files can be read in any of the [supported formats](#mime-types), including by piping through standard input (`Stdin`). [Directories](#directory-datasources) are also supported. |
6464
| [Git](#using-git-datasources) | `git`, `git+file`, `git+http`, `git+https`, `git+ssh` | Files can be read from a local or remote git repository, at specific branches or tags. [Directory semantics](#directory-datasources) are also supported. |
6565
| [GCP Compute Instance Metadata](#using-gcpmeta-datasources) | `gcp+meta` | Provides access to the [GCP VM Metadata Service][], including instance and project metadata. |
66+
| [GCP Secret Manager](#using-gcpsm-datasources) | `gcp+sm` | [GCP Secret Manager][] stores named secrets; each read returns one secret’s latest payload (often text or JSON). |
6667
| [Google Cloud Storage](#using-google-cloud-storage-gs-datasources) | `gs` | [Google Cloud Storage][] is the object storage service available on GCP, comparable to AWS S3. |
6768
| [HTTP](#using-http-datasources) | `http`, `https` | Data can be sourced from HTTP/HTTPS sites in many different formats. Arbitrary HTTP headers can be set with the [`--datasource-header`/`-H`][] flag |
6869
| [Merged Datasources](#using-merge-datasources) | `merge` | Merge two or more datasources together to produce the final value - useful for resolving defaults. Uses [`coll.Merge`][] for merging. |
@@ -627,6 +628,45 @@ $ gomplate -d meta=gcp+meta:/// -i 'IP: {{ include "meta" "instance/network-inte
627628
IP: 10.128.0.2
628629
```
629630

631+
## Using `gcp+sm` datasources
632+
633+
The `gcp+sm://` scheme provides access to [GCP Secret Manager][]. Each secret holds a payload (commonly a string or JSON document). Accessing a datasource reads the **latest** enabled version of that secret.
634+
635+
### URL Considerations
636+
637+
The _scheme_ and _path_ URL components are used by this datasource.
638+
639+
- the _scheme_ must be `gcp+sm`
640+
- the _path_ must identify the secret using Secret Manager’s resource form: `projects/PROJECT_ID/secrets/SECRET_ID` (for example `gcp+sm:///projects/my-project/secrets/my-secret`)
641+
642+
[Directory](#directory-datasources) semantics are not supported.
643+
644+
### Authentication
645+
646+
The Secret Manager client uses [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials) (for example `gcloud auth application-default login`, a service account key via `GOOGLE_APPLICATION_CREDENTIALS`, or credentials from the metadata server on GCE, GKE, or Cloud Run).
647+
648+
See Google Cloud’s [authentication overview](https://docs.cloud.google.com/docs/authentication/getting-started) for details.
649+
650+
### Output
651+
652+
The output will be the secret payload, parsed based on the discovered [MIME type](#mime-types).
653+
654+
### Examples
655+
656+
Given a secret `my-secret` in project `my-project` whose payload is JSON `{"foo":"bar","baz":"qux"}`:
657+
658+
```console
659+
$ gomplate -c cfg=gcp+sm:///projects/my-project/secrets/my-secret -i 'Hello {{ .cfg.foo }}'
660+
Hello bar
661+
```
662+
663+
Reading a secret as a datasource (non-JSON or when you want the raw body):
664+
665+
```console
666+
$ gomplate -d pw=gcp+sm:///projects/my-project/secrets/db-password -i '{{ include "pw" }}'
667+
hunter2
668+
```
669+
630670
## Using `http` datasources
631671

632672
To access datasources from HTTP sites or APIs, simply use a `http` or `https` URL:
@@ -835,6 +875,7 @@ The file `/tmp/vault-aws-nonce` will be created if it didn't already exist, and
835875
[AWS SMP]: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html
836876
[AWS Secrets Manager]: https://aws.amazon.com/secrets-manager
837877
[GCP VM Metadata Service]: https://docs.cloud.google.com/compute/docs/metadata/overview
878+
[GCP Secret Manager]: https://cloud.google.com/secret-manager
838879
[`gcp.Meta`]: ../functions/gcp/#gcpmeta
839880
[HashiCorp Consul]: https://consul.io
840881
[HashiCorp Vault]: https://vaultproject.io

go.mod

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/hairyhenderson/gomplate/v5
22

3-
go 1.25.6
3+
go 1.25.8
44

55
toolchain go1.26.1
66

@@ -19,15 +19,15 @@ require (
1919
github.com/google/uuid v1.6.0
2020
github.com/gosimple/slug v1.15.0
2121
github.com/hack-pad/hackpadfs v0.2.4
22-
github.com/hairyhenderson/go-fsimpl v0.3.4
22+
github.com/hairyhenderson/go-fsimpl v0.4.0
2323
github.com/hairyhenderson/toml v0.4.2-0.20210923231440-40456b8e66cf
2424
github.com/hairyhenderson/xignore v0.3.3-0.20230403012150-95fe86932830 // iofs-port branch
2525
github.com/hashicorp/go-sockaddr v1.0.7
26-
github.com/hashicorp/vault/api v1.22.0
26+
github.com/hashicorp/vault/api v1.23.0
2727
github.com/hashicorp/vault/api/auth/aws v0.11.0
2828
github.com/invopop/jsonschema v0.13.0
2929
github.com/itchyny/gojq v0.12.18
30-
github.com/johannesboyne/gofakes3 v0.0.0-20250106100439-5c39aecd6999
30+
github.com/johannesboyne/gofakes3 v0.0.0-20260208201424-4c385a1f6a73
3131
github.com/joho/godotenv v1.5.1
3232
github.com/lmittmann/tint v1.1.3
3333
github.com/openwall/yescrypt-go v1.0.0
@@ -37,7 +37,7 @@ require (
3737
github.com/ugorji/go/codec v1.3.1
3838
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
3939
golang.org/x/crypto v0.49.0
40-
golang.org/x/exp v0.0.0-20250808145144-a408d31f581a // indirect
40+
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa // indirect
4141
golang.org/x/sys v0.42.0
4242
golang.org/x/term v0.41.0
4343
golang.org/x/text v0.35.0
@@ -52,12 +52,13 @@ require github.com/hairyhenderson/yaml v0.0.0-20220618171115-2d35fca545ce
5252
require (
5353
cel.dev/expr v0.25.1 // indirect
5454
cloud.google.com/go v0.123.0 // indirect
55-
cloud.google.com/go/auth v0.18.1 // indirect
55+
cloud.google.com/go/auth v0.18.2 // indirect
5656
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
5757
cloud.google.com/go/compute/metadata v0.9.0 // indirect
5858
cloud.google.com/go/iam v1.5.3 // indirect
5959
cloud.google.com/go/monitoring v1.24.3 // indirect
60-
cloud.google.com/go/storage v1.59.2 // indirect
60+
cloud.google.com/go/secretmanager v1.16.0 // indirect
61+
cloud.google.com/go/storage v1.60.0 // indirect
6162
dario.cat/mergo v1.0.1 // indirect
6263
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 // indirect
6364
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 // indirect
@@ -67,27 +68,27 @@ require (
6768
github.com/Azure/go-autorest/autorest/to v0.4.1 // indirect
6869
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect
6970
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 // indirect
70-
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.54.0 // indirect
71-
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.54.0 // indirect
71+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.55.0 // indirect
72+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.55.0 // indirect
7273
github.com/Microsoft/go-winio v0.6.2 // indirect
7374
github.com/ProtonMail/go-crypto v1.1.6 // indirect
7475
github.com/armon/go-metrics v0.4.1 // indirect
75-
github.com/aws/aws-sdk-go v1.55.7 // indirect
76-
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 // indirect
76+
github.com/aws/aws-sdk-go v1.55.8 // indirect
77+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect
7778
github.com/aws/aws-sdk-go-v2/credentials v1.19.12 // indirect
78-
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.3 // indirect
79+
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.20.12 // indirect
7980
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.20 // indirect
8081
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.20 // indirect
8182
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect
82-
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.17 // indirect
83+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.21 // indirect
8384
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect
84-
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.8 // indirect
85+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.12 // indirect
8586
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.20 // indirect
86-
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.17 // indirect
87-
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.0 // indirect
88-
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.41.1 // indirect
87+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.20 // indirect
88+
github.com/aws/aws-sdk-go-v2/service/s3 v1.97.2 // indirect
89+
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.41.4 // indirect
8990
github.com/aws/aws-sdk-go-v2/service/signin v1.0.8 // indirect
90-
github.com/aws/aws-sdk-go-v2/service/ssm v1.67.8 // indirect
91+
github.com/aws/aws-sdk-go-v2/service/ssm v1.68.3 // indirect
9192
github.com/aws/aws-sdk-go-v2/service/sso v1.30.13 // indirect
9293
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.17 // indirect
9394
github.com/aws/smithy-go v1.24.2 // indirect
@@ -108,8 +109,8 @@ require (
108109
github.com/fatih/color v1.18.0 // indirect
109110
github.com/felixge/httpsnoop v1.0.4 // indirect
110111
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
111-
github.com/go-git/go-billy/v5 v5.7.0 // indirect
112-
github.com/go-git/go-git/v5 v5.16.5 // indirect
112+
github.com/go-git/go-billy/v5 v5.8.0 // indirect
113+
github.com/go-git/go-git/v5 v5.17.0 // indirect
113114
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
114115
github.com/go-logr/logr v1.4.3 // indirect
115116
github.com/go-logr/stdr v1.2.2 // indirect
@@ -119,10 +120,10 @@ require (
119120
github.com/google/go-cmp v0.7.0 // indirect
120121
github.com/google/s2a-go v0.1.9 // indirect
121122
github.com/google/wire v0.7.0 // indirect
122-
github.com/googleapis/enterprise-certificate-proxy v0.3.11 // indirect
123-
github.com/googleapis/gax-go/v2 v2.16.0 // indirect
123+
github.com/googleapis/enterprise-certificate-proxy v0.3.14 // indirect
124+
github.com/googleapis/gax-go/v2 v2.19.0 // indirect
124125
github.com/gosimple/unidecode v1.0.1 // indirect
125-
github.com/hashicorp/consul/api v1.33.2 // indirect
126+
github.com/hashicorp/consul/api v1.33.5 // indirect
126127
github.com/hashicorp/errwrap v1.1.0 // indirect
127128
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
128129
github.com/hashicorp/go-hclog v1.6.3 // indirect
@@ -138,8 +139,8 @@ require (
138139
github.com/hashicorp/golang-lru v1.0.2 // indirect
139140
github.com/hashicorp/hcl v1.0.1-vault-7 // indirect
140141
github.com/hashicorp/serf v0.10.2 // indirect
141-
github.com/hashicorp/vault/api/auth/approle v0.11.0 // indirect
142-
github.com/hashicorp/vault/api/auth/userpass v0.11.0 // indirect
142+
github.com/hashicorp/vault/api/auth/approle v0.12.0 // indirect
143+
github.com/hashicorp/vault/api/auth/userpass v0.12.0 // indirect
143144
github.com/inconshreveable/mousetrap v1.1.0 // indirect
144145
github.com/itchyny/timefmt-go v0.1.7 // indirect
145146
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
@@ -170,25 +171,25 @@ require (
170171
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
171172
go.opentelemetry.io/contrib/detectors/gcp v1.39.0 // indirect
172173
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
173-
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect
174-
go.opentelemetry.io/otel v1.40.0 // indirect
175-
go.opentelemetry.io/otel/metric v1.40.0 // indirect
176-
go.opentelemetry.io/otel/sdk v1.40.0 // indirect
177-
go.opentelemetry.io/otel/sdk/metric v1.40.0 // indirect
178-
go.opentelemetry.io/otel/trace v1.40.0 // indirect
174+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
175+
go.opentelemetry.io/otel v1.42.0 // indirect
176+
go.opentelemetry.io/otel/metric v1.42.0 // indirect
177+
go.opentelemetry.io/otel/sdk v1.42.0 // indirect
178+
go.opentelemetry.io/otel/sdk/metric v1.42.0 // indirect
179+
go.opentelemetry.io/otel/trace v1.42.0 // indirect
179180
go.shabbyrobe.org/gocovmerge v0.0.0-20230507111327-fa4f82cfbf4d // indirect
180181
go.yaml.in/yaml/v3 v3.0.4 // indirect
181-
gocloud.dev v0.44.0 // indirect
182-
golang.org/x/net v0.51.0 // indirect
183-
golang.org/x/oauth2 v0.35.0 // indirect
182+
gocloud.dev v0.45.0 // indirect
183+
golang.org/x/net v0.52.0 // indirect
184+
golang.org/x/oauth2 v0.36.0 // indirect
184185
golang.org/x/sync v0.20.0 // indirect
185-
golang.org/x/time v0.14.0 // indirect
186+
golang.org/x/time v0.15.0 // indirect
186187
golang.org/x/tools v0.42.0 // indirect
187188
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
188-
google.golang.org/api v0.264.0 // indirect
189-
google.golang.org/genproto v0.0.0-20251202230838-ff82c1b0f217 // indirect
190-
google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect
191-
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
189+
google.golang.org/api v0.272.0 // indirect
190+
google.golang.org/genproto v0.0.0-20260316180232-0b37fe3546d5 // indirect
191+
google.golang.org/genproto/googleapis/api v0.0.0-20260316180232-0b37fe3546d5 // indirect
192+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260316180232-0b37fe3546d5 // indirect
192193
google.golang.org/grpc v1.79.3 // indirect
193194
google.golang.org/protobuf v1.36.11 // indirect
194195
gopkg.in/warnings.v0 v0.1.2 // indirect

0 commit comments

Comments
 (0)