Skip to main content
skill CX Codex

infisical-terraform — Claude Code skill: Infisical secrets in HCL

Walks your agent through the Infisical Terraform provider: provider auth, ephemeral secrets that stay out of state, and OIDC for Terraform Cloud.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Infisical/ai-skills --skill infisical-terraform -a claude-code
Open on GitHub

What infisical-terraform does

This skill covers the Infisical Terraform provider — writing HCL resources and data sources, reading secrets, and wiring up authentication. It ships three references: provider setup, resources and data sources, and Terraform Cloud OIDC. The agent pulls in the right one when you ask about HCL, ephemeral resources, or project roles.

The rule it keeps repeating: credentials belong in a nested auth attribute, either auth = { universal = { client_id, client_secret } } or auth = { oidc = { identity_id, token_environment_variable_name } }. Put client_id or client_secret straight on the provider "infisical" block and the plan fails — that argument isn't supported. The legacy service_token is the one exception and does sit at the top level.

For secrets it points you at ephemeral resources (Terraform 1.10+), so values never land in state. The key on ephemeral "infisical_secret" is name; there is no secret_key argument. Any output carrying an ephemeral value needs ephemeral = true too. Auth means Universal Auth or OIDC, since service tokens are legacy. On self-hosted Infisical set the host attribute on the provider block — there's no site-URL environment variable. The provider source is infisical/infisical from the Terraform Registry.

What it helps with

  • set up the Infisical provider in Terraform without botching the auth block
  • keep secrets out of the terraform state file with ephemeral resources
  • connect Terraform Cloud to Infisical over OIDC
  • define project roles and access approval policies in HCL
  • tell an ephemeral resource apart from a data source

Example prompts for the agent

  • Help me configure the Infisical provider in Terraform with Universal Auth — show the provider block with the nested auth attribute.
  • How do I keep secrets out of terraform state? I want to use ephemeral "infisical_secret" with name, workspace_id and env_slug.
  • Set up Terraform Cloud with Infisical over OIDC: what does the machine identity need and how do I write auth = { oidc = ... }?

How to install infisical-terraform

1Skills CLI (Vercel)

npx skills add Infisical/ai-skills --skill infisical-terraform -a claude-code

2Manually: put the files in place

~/.claude/skills/infisical-terraform/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/infisical-terraform/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about infisical-terraform

How do I install infisical-terraform in Claude?

Run npx skills add Infisical/ai-skills --skill infisical-terraform -a claude-code. The skill lands in ~/.claude/skills/infisical-terraform/SKILL.md.

What does infisical-terraform do?

It gives the agent guidance on the Infisical Terraform provider: HCL configuration, ephemeral secrets, data source patterns, project roles, and OIDC for Terraform Cloud.

How is it different from infisical-setup or infisical-api?

It handles managing Infisical resources and reading secrets from HCL. Getting secrets into a running app is infisical-setup; raw REST calls are infisical-api.

Source text

SKILL.md · MIT
---
name: infisical-terraform
description: |
  Expert guidance for the Infisical Terraform Provider. Covers HCL resource configuration, ephemeral secrets management, data source patterns, project role permissions, and OIDC authentication for Terraform Cloud. Use for secret injection via IaC, Machine Identity setup, access approval policies, and cloud-native integration patterns. Not for getting secrets into a running app (infisical-setup) or raw REST calls (infisical-api).
triggers:
  - terraform
  - HCL
  - infisical provider
  - ephemeral resource
  - terraform state secrets
  - terraform cloud OIDC
  - infisical secrets management
  - infisical resource
---

# Infisical Terraform Provider

Help users confidently integrate Infisical secret management with their Terraform infrastructure.

## Not this skill

| If the user wants... | Use |
|----------------------|-----|
| To get secrets into a running app, container, or pipeline | `infisical-setup` |
| Raw REST API calls rather than HCL | `infisical-api` |
| To push secrets to a third-party service | `infisical-secret-syncs` |
| On-demand ephemeral database credentials | `infisical-dynamic-secrets` |
| Roles and permission model design | `infisical-access-control` |
| To deploy a Gateway or Relay via Terraform | `infisical-gateway` |
| To deploy Infisical itself | `infisical-self-host` |

This skill is about the **Infisical Terraform provider** — managing Infisical resources and reading
secrets from HCL. It is not about using Terraform generally.

## What users typically ask for

- "How do I use Infisical with Terraform?" — Provider setup and auth
- "How do I prevent secrets in my Terraform state?" — Ephemeral resources
- "How do I set up Terraform Cloud with Infisical?" — OIDC integration
- "How do I configure project roles and permissions?" — Role definitions
- "What's the difference between ephemeral and data sources?" — Resource patterns

## Quick routing

- **Provider authentication, configuration, env vars** → [Provider Setup](/references/provider-setup.md)
- **HCL resources: infisical_secret, data sources, project roles, access approval** → [Resources & Data Sources](/references/resources-and-data-sources.md)
- **Terraform Cloud OIDC integration, machine identity setup** → [Terraform Cloud OIDC](/references/terraform-cloud-oidc.md)

## Key principles to uphold

1. **Credentials go inside a nested `auth` attribute**: the provider takes
   `auth = { universal = { client_id, client_secret } }` or
   `auth = { oidc = { identity_id, token_environment_variable_name } }`. Never put
   `client_id`, `client_secret`, or `identity_id` directly on the `provider "infisical"` block —
   that is an unsupported argument and fails at plan time. (Legacy `service_token` is the one
   exception and does sit at the top level.)
2. **The ephemeral secret's key is `name`**: `ephemeral "infisical_secret"` takes
   `name`, `workspace_id`, `env_slug`, and optional `folder_path`. There is no `secret_key`
   argument.
3. **Ephemeral over state**: Always recommend `ephemeral` resources (Terraform 1.10+) for secrets—values never land in state files. An output carrying an ephemeral value must itself be marked `ephemeral = true`.
4. **Machine Identity auth**: Universal Auth or OIDC; never Service Tokens (legacy).
5. **Permissions v2 format**: Use `permissions_v2` (subject/action structure); deprecate `permissions` (v1).
6. **OIDC for Terraform Cloud**: This is the recommended production pattern.
7. **Provider source**: `infisical/infisical` from Terraform Registry—not community providers.
8. **Folder path defaults**: `folder_path = "/"` if omitted.
9. **Self-hosted needs `host`**: set the `host` attribute on the provider block; there is no site-URL environment variable.

## When to send users to references

- Auth confusion or env var setup → provider-setup.md
- Building HCL for secrets, roles, approval policies → resources-and-data-sources.md
- TFC + Infisical step-by-step → terraform-cloud-oidc.md

© Infisical · MIT · Infisical/ai-skills

Similar skills

Everything for DevOps and infrastructure →

From the same set3

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor