Prompt

I'm building a startup stack with GitHub Actions, Terraform, and containers. How should I handle secrets?

Technology / Cybersecurity2 observationsLast seen Nov 7, 2026

Latest observation

Nov 7, 2026OpenAI APIWeb search: off

A good rule of thumb: keep secrets out of GitHub, out of Terraform state, and out of container images.

For a startup stack with GitHub Actions, Terraform, and containers, the cleanest approach is:

1) Use a real secrets manager

Use one central place for runtime secrets, such as:

  • AWS Secrets Manager / SSM Parameter Store
  • GCP Secret Manager
  • Azure Key Vault
  • HashiCorp Vault if you want cloud-neutral control

Store things like:

  • DB passwords
  • API keys
  • OAuth client secrets
  • signing keys
  • webhook secrets

2) Let GitHub Actions handle only CI/CD credentials

GitHub Actions should usually store only:

  • short-lived cloud auth credentials, or better
  • OIDC-based federation to your cloud provider

Prefer GitHub Actions OIDC over long-lived cloud access keys in GitHub Secrets.
That way, Actions can assume a role with temporary credentials instead of storing static keys.

Good pattern

  • GitHub Actions authenticates to AWS/GCP/Azure via OIDC
  • Pipeline deploys infra/app
  • App reads secrets from cloud secrets manager at runtime

3) Keep Terraform from owning secret values

Terraform is great for infrastructure, but don’t put sensitive secret material directly into Terraform variables if you can avoid it.

Avoid

  • hardcoding secrets in .tf files
  • passing secret values through Terraform and letting them end up in state
  • storing secret values in outputs

Terraform state can contain sensitive values even if marked sensitive = true in UI/output. That flag hides values in logs, but does not remove them from state.

Better patterns

Use Terraform to:

  • create secret containers/resources
  • set IAM policies/permissions
  • configure secret references

But have the secret value injected separately, for example:

  • manually via a secure admin process
  • from CI at deploy time using ephemeral auth
  • from your cloud’s secret manager outside Terraform
  • via external data sources only if you fully understand the state implications

4) Inject secrets at runtime, not build time

Don’t bake secrets into Docker images or build args.

Avoid

  • ARG API_KEY=...
  • ENV API_KEY=... in Dockerfile
  • copying .env into images

Prefer

  • container reads secrets from environment at runtime
  • mounted secret files
  • secret manager integration from your platform

Examples:

  • ECS task secrets from AWS Secrets Manager
  • Kubernetes secrets via External Secrets Operator / CSI driver
  • Cloud Run / App Service / etc. native secret integration

5) Use GitHub Secrets only for non-cloud-sensitive items or bootstrap

GitHub Secrets is fine for:

  • small bootstrap values
  • third-party service tokens
  • temporary migration credentials
  • webhook signing secrets for CI workflows

But if possible:

  • prefer OIDC for cloud access
  • prefer external secrets manager for app runtime secrets

6) Separate secret classes

Treat these differently:

CI/CD secrets

Used by GitHub Actions to deploy.

  • Prefer OIDC
  • If static secret is unavoidable, rotate often

Application runtime secrets

Used by your app in production.

  • Store in secret manager
  • Fetch at boot/runtime
  • Rotate independently

Local development secrets

Used by developers locally.

  • .env files in .gitignore
  • use direnv, dotenv, or a local secret manager
  • never commit them

7) Protect Terraform state

Since state may contain sensitive data:

  • store state in a remote backend
  • enable encryption at rest
  • restrict access tightly
  • version and lock state appropriately
  • avoid sharing state broadly in your org

For example:

  • AWS S3 backend with SSE-KMS + DynamoDB lock table
  • Terraform Cloud/Enterprise with workspace permissions

8) Rotate and audit

Have a process for:

  • rotating secrets regularly
  • revoking compromised credentials
  • auditing access logs in GitHub, cloud provider, and secret manager
  • scanning repos for accidentally committed secrets

Use tools like:

  • GitHub secret scanning
  • trufflehog
  • gitleaks

Recommended startup-friendly setup

If you want a pragmatic default:

  1. GitHub Actions with OIDC
  2. Terraform remote state in encrypted storage
  3. Cloud secret manager for app secrets
  4. Containers pull secrets at runtime
  5. No secrets in Docker images or Terraform variables
  6. Use GitHub Secrets only where OIDC can’t work

Simple mental model

  • GitHub Actions: authenticate to cloud using OIDC
  • Terraform: provision infra, policies, secret containers
  • Secret manager: store actual secret values
  • Containers: retrieve secrets at runtime

If you want, I can also give you:

  • a reference architecture diagram
  • a GitHub Actions + Terraform + AWS example
  • or a recommended secret handling pattern for Kubernetes vs ECS vs Cloud Run

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (2 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.