Secrets Manager

For truly sensitive values such as API keys, database credentials and tokens, the gothic.SecretsManager(...) builder pulls the value from the deploy target's secret manager: AWS Secrets Manager or GCP Secret Manager. Like gothic.Env and gothic.SSMParam, it produces an EnvValue, so it drops straight into any stage's ENV map.

On AWS, pass the Secrets Manager path or ARN. Secrets are often JSON objects, so chain .Get("jsonKey") and Gothic decodes the secret and injects just that one field into your environment variable, never the whole blob:

Stages: map[string]gothic.Stage{
	"dev": {
		ENV: map[string]gothic.EnvValue{
			// Whole secret as a plain string:
			"API_KEY": gothic.SecretsManager("/myapp/dev/api-key"),
			// Pull one field out of a JSON secret with .Get:
			"DB_PASSWORD": gothic.SecretsManager("/myapp/dev/db").Get("password"),
		},
	},
},

On the GCP target, gothic.SecretsManager("my-app-dev-api-key") names a secret in the deploy project's Secret Manager. Cloud Run reads the latest version at runtime, so the value never enters gothic.config.go or the OpenTofu state, and the deploy grants the runtime service account roles/secretmanager.secretAccessor on the secret. Pass the secret name only: a full path and a version are AWS forms that fail loudly here, and .Get(...) is rejected because Cloud Run injects the whole secret, so decode the JSON in your app instead. gothic.SSMParam stays AWS-only.

Security Note: create the secret in your provider's secret manager before deploying. Gothic never creates it, and the value never enters gothic.config.go or the OpenTofu state.

The same .Get("jsonKey") trick also works on gothic.SSMParam when a parameter stores JSON. On AWS, reach for Secrets Manager when you want rotation and fine-grained IAM on the secret itself, and Parameter Store for plain config.

Your config is fully wired. Want to run your own Go code around a deploy? Meet the lifecycle hooks!