Omniscio

OmniscioGuidesPermission rulesCloud CLIs

Claude Code permissions for terraform, kubectl and aws

A cloud CLI is the one place where an approved command can change production. The block allows the commands that read cloud state and the two that write only your working directory, asks before anything that changes infrastructure, and refuses the two destroy forms Claude usually writes.

Checked on November 27, 2026 against the Claude Code 2.1.332 documentation. By the Omniscio team. Updated .

The block

{
  "permissions": {
    "allow": [
      "Bash(terraform init *)",
      "Bash(terraform validate)",
      "Bash(terraform fmt *)",
      "Bash(terraform plan *)",
      "Bash(kubectl get *)",
      "Bash(kubectl describe *)",
      "Bash(kubectl logs *)",
      "Bash(aws s3 ls *)",
      "Bash(aws sts get-caller-identity)"
    ],
    "ask": [
      "Bash(terraform apply *)",
      "Bash(kubectl apply *)",
      "Bash(kubectl delete *)",
      "Bash(helm upgrade *)"
    ],
    "deny": [
      "Bash(terraform destroy *)",
      "Bash(kubectl delete namespace *)"
    ]
  }
}

The allow list is the read half of the tools, plus init and fmt, which write only local files. The ask list is every verb that changes a cluster or a state file. The deny list is the two destroy forms people write by hand, where a prompt is not enough.

Deny is evaluated first, so terraform destroy stays refused even though a broader rule would match it. A compound command needs every part allowed for the whole line to run, so terraform plan && terraform apply stops at the apply.

What each rule matches

The rules, and the commands each one reaches.
RuleMatchesDoes not match
Bash(terraform init *)terraform init, terraform init -upgradeterraform initx, because the space is part of the rule
Bash(terraform fmt *)terraform fmt, terraform fmt -recursiveterraform format
Bash(terraform plan *)terraform plan, terraform plan -out=tf.plan, terraform plan -var-file=prod.tfvarsterraform apply
Bash(terraform validate)That exact commandterraform validate -json, which needs its own rule
Bash(kubectl get *)kubectl get pods, kubectl get -n prod svckubectl getx, because the space is part of the rule
Bash(kubectl describe *)kubectl describe pod api-0, and bare kubectl describekubectl describex, because the space is part of the rule
Bash(kubectl logs *)kubectl logs api-0, kubectl logs -f api-0kubectl log, which is not a command
Bash(kubectl apply *)kubectl apply -f app.yaml, and bare kubectl applykubectl applyx, because the space is part of the rule
Bash(kubectl delete *)kubectl delete pod api-0, kubectl delete -f app.yamlA delete written as kubectl -n prod delete pod api-0, where the namespace flag comes first
Bash(helm upgrade *)helm upgrade api ./chart, and bare helm upgradehelm install api ./chart, which needs its own rule
Bash(aws s3 ls *)aws s3 ls, aws s3 ls s3://bucketaws s3 rm s3://bucket/key
Bash(aws sts get-caller-identity)That exact command, which reports the account and role in useaws sts assume-role, a different subcommand
Bash(terraform destroy *)terraform destroy, terraform destroy -auto-approveterraform apply, which is the ask list
Bash(kubectl delete namespace *)kubectl delete namespace stagingkubectl delete ns staging, and kubectl -n prod delete namespace staging

A command word in the wrong place changes the rule that matches. kubectl -n prod delete pod puts the namespace before the verb, so Bash(kubectl delete *) does not match it and the mode decides. Write a rule for each ordering you actually use, or keep the global flags after the verb. One more thing the allow list covers: kubectl get * also approves kubectl get secret, which prints credential material. Narrow it to the resource names you read if that matters in your cluster.

Why not one rule per tool

A rule is matched as written, so Bash(aws *) approves every aws subcommand, including create and delete calls this block would never approve. A wildcard at the end of a rule leaves no later word to narrow it, so nothing in the text limits which verb runs.

A deny or ask rule still outranks a broad allow. The reason to avoid the broad allow is the verbs nobody listed: an allow on Bash(kubectl *) approves kubectl delete unless a matching ask or deny exists, and the list of approved verbs is invisible until someone reads the file.

The wildcard belongs after the subcommand. Bash(git * main) is the documented example of a rule that reads narrower than it is, because the wildcard stands in for any subcommand. A rule such as Bash(terraform * apply *) is the other trap: it matches a command where apply is only an argument, such as terraform state mv apply prod.

The cloud change a rule does not catch

Rules match the command text Claude writes. A cloud change reached through a full path to the binary, through sh -c, or through a wrapper that is not one of the stripped ones is a different text, so a deny or ask rule covers the invocation Claude usually produces and not every path to the program.

Two forms do work in your favor. A leading assignment is matched by an ask or deny rule, so AWS_PROFILE=prod terraform apply still asks. And the wrappers Anthropic strips before matching, such as timeout and time, do not hide the command that follows them.

A deny rule applies when any subcommand matches, including one inside a subshell, a command substitution or a loop body. For enforcement that does not depend on the text at all, use the sandbox or a PreToolUse hook.

Where the block goes

For a team, commit it at .claude/settings.json. For yourself in every project, use ~/.claude/settings.json. A project file's allow rules wait for the workspace trust dialog, while the ask and deny lists apply at once.

For one session, --allowedTools "Bash(kubectl get *)" and --disallowedTools "Bash(terraform destroy *)" add rules from the command line. A deny in a settings file still outranks a flag.

Confirm it took effect

  1. Run /permissions and check that the nine allow rules, the four ask rules and the two deny rules are listed, with the settings file that supplied each.
  2. Ask Claude to run terraform plan. No prompt.
  3. Ask it to run terraform apply. A prompt that shows the command.
  4. Ask it to run terraform destroy. Refused.

claude doctor lists entries Claude Code rejected, which is where a typo in a tool name shows up. A saved edit applies from Claude's next tool call.

The mistakes that make a cloud rule misfire

  • A wildcard before the verb. Bash(kubectl * apply) approves the delete that happens to end in apply, and warns at startup.
  • A global flag before the verb. kubectl -n prod delete is not matched by a rule written for kubectl delete.
  • Assuming deny covers every path to the binary. sh -c and a full path are different command texts.
  • No space before the trailing wildcard. Bash(kubectl get*) also matches a command that merely starts with those letters.

The other new pages

Each page carries a complete block, not a fragment. The hub lists all ten.

Where Omniscio fits

Omniscio is a desktop app for running several Claude Code agents side by side in one window. The rules on this page are Claude Code's own and apply inside an Omniscio session, because each session runs Claude Code.

Where these answers come from

  • Configure permissions, for wildcard matching, the warning, compound commands, leading assignments, the stripped wrappers and the form a rule does not catch. Read November 27, 2026.
  • Settings reference, for the permission keys.
  • CLI reference, for --allowedTools and --disallowedTools.
  • The changelog, release 2.1.332, dated November 25, 2026.

Common questions

Why not allow Bash(aws *) and be done?

That rule approves every aws subcommand, including the ones that create and delete resources. It also has a wildcard before the subcommand, which is the shape Claude Code warns about at startup. Name the read commands you use instead.

Does an ask rule for terraform apply replace the prompt I already get?

It makes the prompt explicit and keeps it in every mode that would otherwise approve edits, because ask rules are checked before allow rules and prompt even in acceptEdits. Without the rule, the mode you are in decides.

Does the deny rule stop terraform destroy when it is part of a longer command?

A deny rule applies when any subcommand matches it, including one inside a subshell, a command substitution or the body of a loop. So cd infra && terraform destroy is matched. A destroy reached through sh -c, or through a full path to the binary, is a different text and is not.

Is AWS_PROFILE=prod kubectl apply still matched by the ask rule?

Yes for the ask rule. An allow rule matches past a leading assignment only for a known-safe set of variables, while a deny or ask rule matches past any leading assignment. The ask therefore still fires with the profile in front.