基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill terraform-native-tests命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
| name | terraform-native-tests |
| description | >- Use when this capability is needed. |
You guide the creation of .tftest.hcl files for Catalyst Terraform modules using the native test framework (Terraform 1.10+). You enforce the mandatory assertion set from AGENTS.md §6 and AGENTS.md (every module that touches IAM, encryption, or security must be tested).
Co-located with the module, named <module-name>.tftest.hcl:
infrastructure/modules/leaf/s3-secure-bucket/
main.tf
variables.tf
outputs.tf
s3-secure-bucket.tftest.hcl # <-- here
# s3-secure-bucket.tftest.hcl
variables {
name = "test-bucket"
environment = "dev"
kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/test-key-id"
tags = { TestRun = "true" }
}
run "creates_bucket_with_encryption" {
command = plan # plan-only — no real resources
assert {
condition = aws_s3_bucket.this.bucket == "test-bucket"
error_message = "Bucket name should match input"
}
assert {
condition = aws_s3_bucket_server_side_encryption_configuration.this.rule[0].apply_server_side_encryption_by_default[0].sse_algorithm == "aws:kms"
error_message = "Bucket must use KMS encryption"
}
}
run "denies_non_tls_access" {
command = plan
assert {
condition = can(regex("aws:SecureTransport", aws_s3_bucket_policy.this.policy))
error_message = "Bucket policy must enforce TLS-only access"
}
}
run "blocks_public_access" {
command = plan
assert {
condition = aws_s3_bucket_public_access_block.this.block_public_acls == true
error_message = "Block public ACLs must be enabled"
}
assert {
condition = aws_s3_bucket_public_access_block.this.block_public_policy == true
error_message = "Block public policy must be enabled"
}
assert {
condition = aws_s3_bucket_public_access_block.this.ignore_public_acls == true
error_message = "Ignore public ACLs must be enabled"
}
assert {
condition = aws_s3_bucket_public_access_block.this.restrict_public_buckets == true
error_message = "Restrict public buckets must be enabled"
}
}
run "versioning_enabled" {
command = plan
assert {
condition = aws_s3_bucket_versioning.this.versioning_configuration[0].status == "Enabled"
error_message = "Versioning must be enabled"
}
}
Per AGENTS.md §6 and AGENTS.md, every module MUST assert:
| Module type | Required assertions |
|---|---|
| Any with IAM | No "*" in Resource or Action of rendered policy |
| Any with encryption | KMS key ARN is set, SSE algorithm is aws:kms |
| Any with networking | Security groups have no 0.0.0.0/0 ingress (except ALB on 443) |
| All modules | At least one happy-path output value is non-empty |
# iam-role.tftest.hcl
run "no_wildcard_in_policy" {
command = plan
assert {
condition = !can(regex("\"\\*\"", data.aws_iam_policy_document.permissions.json))
error_message = "IAM policy must not contain wildcard '*' in Resource or Action"
}
}
run "trust_policy_matches_input" {
command = plan
assert {
condition = can(regex(var.trust_principal, aws_iam_role.this.assume_role_policy))
error_message = "Trust policy principal must match the input trust_principal"
}
}
# aurora-serverless-v2.tftest.hcl
variables {
cluster_name = "test-aurora"
environment = "dev"
kms_key_arn = "arn:aws:kms:us-east-1:123456789012:key/test"
min_acu = 0.5
max_acu = 4
vpc_id = "vpc-test"
subnet_ids = ["subnet-a", "subnet-b"]
tags = {}
}
run "iam_auth_enabled" {
command = plan
assert {
condition = aws_rds_cluster.this.iam_database_authentication_enabled == true
error_message = "IAM database authentication must be enabled"
}
}
run "storage_encrypted" {
command = plan
assert {
condition = aws_rds_cluster.this.storage_encrypted == true
error_message = "Storage encryption must be enabled"
}
}
run "deletion_protection" {
command = plan
assert {
condition = aws_rds_cluster.this.deletion_protection == true
error_message = "Deletion protection must be enabled"
}
}
run "acu_within_bounds" {
command = plan
assert {
condition = aws_rds_cluster.this.serverlessv2_scaling_configuration[0].min_capacity >= 0.5
error_message = "Min ACU must be >= 0.5"
}
assert {
condition = aws_rds_cluster.this.serverlessv2_scaling_configuration[0].max_capacity <= 16
error_message = "Max ACU must be <= 16"
}
}
# At the top of the test file, override provider config
provider "aws" {
region = "us-east-1"
# For plan-only tests, mock responses are sufficient
skip_credentials_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
default_tags {
tags = {
TestRun = "true"
}
}
}
Tests run in the GitHub Actions PR workflow:
- name: Terraform Test
run: |
cd infrastructure/modules/leaf/s3-secure-bucket
terraform init
terraform test
Per AGENTS.md: do not bypass terraform test — it is the line-stop. Fix the code, don't disable the gate.
run block names use snake_case describing what is assertedrun block.tftest.hcl with variables block + run blocks covering the mandatory set.tftest.hcl before it can be merged.command = plan for assertion tests — no real resources needed.command = apply only for integration tests that verify real AWS behavior (rare, in infrastructure/tests/).Source: Cloud-Byte-Consulting/Catalyst — distributed by TomeVault.