terraform-schema-inspector-skill
11
总安装量
11
周安装量
#27358
全站排名
安装命令
npx skills add https://github.com/quixoticmonk/terraform-schema-inspector-skill --skill terraform-schema-inspector-skill
Agent 安装分布
opencode
11
gemini-cli
11
github-copilot
11
codex
11
kiro-cli
11
kimi-cli
11
Skill 文档
Terraform Schema Inspector
Identify which capabilities a Terraform provider supports:
- Resources: Standard managed resources
- Data Sources: Read-only data queries
- Actions: Imperative operations during lifecycle events
- List Resources: Resources supporting bulk list operations
- Ephemeral Resources: Temporary resources for credentials/tokens
- Functions: Provider-specific functions
Workflow
When a user asks about provider capabilities:
-
Check for existing Terraform configuration
- Look for
*.tffiles or.terraform.lock.hclin the current directory - If found, skip to step 3
- Look for
-
Create provider configuration (if needed)
- Create a minimal
providers.tffile with the requested provider - Example for AWS:
terraform { required_providers { aws = { source = "hashicorp/aws" } } } - For other providers, replace
awswith the provider name (e.g.,azurerm,google,kubernetes)
- Create a minimal
-
Run the inspection script
scripts/check.sh <capability_type> <provider_name> -
Verify execution
- Check the script succeeded (exit code 0)
- Validate output is valid JSON
- Common failures: missing
terraformCLI,jqnot installed, provider initialization errors, invalid provider names
-
Clean up (if you created the provider file)
- Remove the temporary
providers.tffile - Remove
.terraform/directory and.terraform.lock.hcl
- Remove the temporary
Security
The script implements security hardening to prevent command injection:
- Input validation: Provider names restricted to alphanumeric, hyphens, and underscores
- Safe string handling: All provider operations use jq’s
--argto prevent injection
Security considerations:
- Only run on trusted Terraform configurations
- Review
.tffiles before runningterraform init - Provider binaries are downloaded from configured registries during
terraform init
Capability Types
resources– Standard managed resourcesdata-sources– Read-only data sourcesactions– Imperative lifecycle actionslist– List resource capabilitiesephemeral– Ephemeral resources (credentials, tokens)functions– Provider-specific functions
Examples
Check AWS ephemeral resources
# Create providers.tf first, then:
scripts/check.sh ephemeral aws
Check all providers for actions
# If multiple providers configured:
scripts/check.sh actions
Check Azure data sources
# Create providers.tf with azurerm, then:
scripts/check.sh data-sources azurerm
Output Format
Returns JSON mapping providers to their supported capabilities:
{
"aws": [
"aws_cognito_identity_openid_token_for_developer_identity",
"aws_ecr_authorization_token",
"aws_eks_cluster_auth",
"aws_kms_secrets",
"aws_lambda_invocation",
"aws_secretsmanager_random_password",
"aws_secretsmanager_secret_version",
"aws_ssm_parameter"
]
}
Requirements
- Terraform CLI installed
- jq (JSON processor)
Notes
- The script requires a Terraform configuration to inspect provider schemas
- Always clean up temporary files after inspection
- Provider schemas are fetched during
terraform init