dojo.md 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,65 @@
1
+ meta:
2
+ id: hcl-syntax-errors
3
+ level: 1
4
+ course: terraform-infrastructure-setup
5
+ type: output
6
+ description: "Fix HCL syntax errors — diagnose missing braces, incorrect attribute assignments, string interpolation issues, and block structure problems"
7
+ tags: [Terraform, HCL, syntax, validation, formatting, beginner]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ You run `terraform validate` and get multiple errors:
13
+
14
+ ```
15
+ Error: Missing closing brace
16
+
17
+ on main.tf line 12:
18
+ 12: tags = {
19
+ 13: Name = "web-server"
20
+ 14:
21
+
22
+ Error: Unsupported argument
23
+
24
+ on main.tf line 8, in resource "aws_instance" "web":
25
+ 8: ami := "ami-0c55b159cbfafe1f0"
26
+
27
+ Error: Invalid reference
28
+
29
+ on main.tf line 15, in resource "aws_instance" "web":
30
+ 15: subnet_id = "${var.subnet_id}"
31
+ ```
32
+
33
+ Your main.tf:
34
+
35
+ ```hcl
36
+ resource "aws_instance" "web" {
37
+ ami := "ami-0c55b159cbfafe1f0"
38
+ instance_type = var.instance_type
39
+
40
+ tags = {
41
+ Name = "web-server"
42
+
43
+ vpc_security_group_ids = [aws_security_group.web.id]
44
+ }
45
+ ```
46
+
47
+ Task: Explain HCL syntax fundamentals, common syntax errors and
48
+ how to fix them, the difference between = and := (Terraform only
49
+ uses =), string interpolation rules, terraform fmt for auto-formatting,
50
+ terraform validate for catching errors before plan, and block structure
51
+ (resource, data, variable, output, locals).
52
+
53
+ assertions:
54
+ - type: llm_judge
55
+ criteria: "HCL syntax fundamentals are explained — blocks: resource, data, variable, output, locals, terraform, provider. Attribute assignment uses = (not :=, that's Go syntax). String interpolation: use ${} inside quoted strings, but for simple references just use var.name directly (no interpolation needed since Terraform 0.12). Heredoc syntax: <<-EOT for multi-line strings. Comments: # for single line, /* */ for multi-line. Lists: [], maps: {}. The specific errors: (1) := should be =, (2) missing closing brace for tags block, (3) bare ${var.subnet_id} should be just var.subnet_id (interpolation-only expressions are deprecated)"
56
+ weight: 0.35
57
+ description: "HCL fundamentals"
58
+ - type: llm_judge
59
+ criteria: "terraform fmt and validate workflow is covered — terraform fmt: auto-formats HCL files to canonical style (consistent indentation, alignment). Run before committing. terraform fmt -check in CI to enforce formatting. terraform validate: checks configuration for internal consistency (syntax, attribute names, required arguments). Does NOT check against cloud APIs. Workflow order: fmt → validate → plan → apply. validate catches: missing required arguments, unknown attributes, type mismatches, invalid references"
60
+ weight: 0.35
61
+ description: "Formatting and validation"
62
+ - type: llm_judge
63
+ criteria: "Block structure is explained — resource 'type' 'name' {}: creates infrastructure. data 'type' 'name' {}: reads existing infrastructure. variable 'name' {}: input parameters (type, default, description, validation). output 'name' {}: export values. locals {}: computed local values (like constants). terraform {}: settings (required_version, required_providers, backend). provider 'name' {}: provider configuration. Each block type has specific allowed arguments. Meta-arguments available on resources: depends_on, count, for_each, provider, lifecycle"
64
+ weight: 0.30
65
+ description: "Block structure"
@@ -0,0 +1,62 @@
1
+ meta:
2
+ id: provider-configuration
3
+ level: 1
4
+ course: terraform-infrastructure-setup
5
+ type: output
6
+ description: "Configure Terraform providers — set up AWS credentials, handle authentication errors, manage provider aliases for multi-region deployments"
7
+ tags: [Terraform, providers, AWS, authentication, credentials, beginner]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ You run `terraform plan` and get this error:
13
+
14
+ ```
15
+ Error: No valid credential sources found
16
+
17
+ with provider["registry.terraform.io/hashicorp/aws"],
18
+ on main.tf line 5, in provider "aws":
19
+ 5: provider "aws" {
20
+
21
+ Please see https://registry.terraform.io/providers/hashicorp/aws
22
+ for more information about providing credentials.
23
+ ```
24
+
25
+ Your configuration:
26
+
27
+ ```hcl
28
+ provider "aws" {
29
+ region = "us-east-1"
30
+ }
31
+
32
+ resource "aws_s3_bucket" "data" {
33
+ bucket = "my-data-bucket-12345"
34
+ }
35
+
36
+ resource "aws_s3_bucket" "logs" {
37
+ provider = aws.west
38
+ bucket = "my-logs-bucket-12345"
39
+ }
40
+ ```
41
+
42
+ You have AWS CLI installed with a profile named "dev" but haven't
43
+ configured any credentials for Terraform.
44
+
45
+ Task: Explain Terraform provider configuration, AWS credential
46
+ chain (how Terraform finds credentials), provider aliases for
47
+ multi-region, common authentication errors and fixes, and best
48
+ practices for credential management (never hardcode keys).
49
+
50
+ assertions:
51
+ - type: llm_judge
52
+ criteria: "AWS credential chain is explained — Terraform AWS provider checks credentials in order: (1) provider block (access_key/secret_key — NEVER do this), (2) environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN), (3) shared credentials file (~/.aws/credentials), (4) shared config file (~/.aws/config with profile), (5) EC2 instance metadata / ECS task role / Lambda execution role. Fix: export AWS_PROFILE=dev or set profile in provider block. For CI/CD: use environment variables or OIDC federation (GitHub Actions → AWS IAM role)"
53
+ weight: 0.35
54
+ description: "Credential chain"
55
+ - type: llm_judge
56
+ criteria: "Provider aliases are explained — to use multiple regions, define provider aliases: provider 'aws' { region = 'us-east-1' } and provider 'aws' { alias = 'west', region = 'us-west-2' }. Reference alias: provider = aws.west in resource block. Without the alias provider block defined, the aws.west reference will fail. Default provider (no alias) is used when provider isn't specified. Each alias can have different credentials, regions, or assume_role configurations"
57
+ weight: 0.35
58
+ description: "Provider aliases"
59
+ - type: llm_judge
60
+ criteria: "Security best practices are covered — NEVER hardcode credentials in .tf files (they end up in version control and state files). Use: environment variables, AWS profiles, IAM roles (instance profiles, task roles), or OIDC federation. For assume_role: provider block supports assume_role {} for cross-account access. State files contain provider config — ensure state is encrypted and access-controlled. Use terraform plan output to verify no credentials are exposed. Add *.tfvars with secrets to .gitignore"
61
+ weight: 0.30
62
+ description: "Security practices"
@@ -0,0 +1,78 @@
1
+ meta:
2
+ id: variable-and-output-errors
3
+ level: 1
4
+ course: terraform-infrastructure-setup
5
+ type: output
6
+ description: "Debug variable and output errors — fix type mismatches, missing required variables, default values, and output reference issues"
7
+ tags: [Terraform, variables, outputs, types, validation, beginner]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ You run `terraform plan` and hit these errors:
13
+
14
+ ```
15
+ Error: No value for required variable
16
+
17
+ on variables.tf line 1:
18
+ 1: variable "environment" {
19
+
20
+ The root module input variable "environment" is not set, and has
21
+ no default value.
22
+
23
+ Error: Invalid value for variable
24
+
25
+ on variables.tf line 7:
26
+ 7: variable "instance_count" {
27
+
28
+ This variable does not accept the value "three". Expected type number.
29
+
30
+ Error: Unsupported attribute
31
+
32
+ on outputs.tf line 3:
33
+ 3: value = aws_instance.web.public_dns
34
+ ```
35
+
36
+ Your files:
37
+
38
+ variables.tf:
39
+ ```hcl
40
+ variable "environment" {
41
+ type = string
42
+ description = "Deployment environment"
43
+ }
44
+
45
+ variable "instance_count" {
46
+ type = number
47
+ default = 1
48
+ }
49
+
50
+ variable "allowed_cidrs" {
51
+ type = list(string)
52
+ default = ["0.0.0.0/0"]
53
+ }
54
+ ```
55
+
56
+ terraform.tfvars:
57
+ ```hcl
58
+ instance_count = "three"
59
+ ```
60
+
61
+ Task: Explain Terraform variables (types, defaults, validation),
62
+ how to pass values (tfvars, CLI, env vars, auto.tfvars), output
63
+ values and their uses, type system (string, number, bool, list,
64
+ map, object, tuple), and common variable/output errors.
65
+
66
+ assertions:
67
+ - type: llm_judge
68
+ criteria: "Variable system is explained — types: string, number, bool (primitives), list(type), set(type), map(type), object({key=type}), tuple([types]) (complex). Required vs optional: variables without default are required. Validation blocks: variable 'env' { validation { condition = contains(['dev','prod'], var.env), error_message = '...' } }. Sensitive = true: hides value in plan output. Nullable = false: disallows null values. The errors: (1) environment has no default and no value provided, (2) instance_count expects number but got string 'three', (3) public_dns might not exist if count = 0 or resource uses for_each"
69
+ weight: 0.35
70
+ description: "Variable system"
71
+ - type: llm_judge
72
+ criteria: "Value passing methods are covered in precedence order — (1) -var flag on CLI: terraform plan -var='environment=prod'. (2) -var-file flag: terraform plan -var-file=prod.tfvars. (3) terraform.tfvars or terraform.tfvars.json (auto-loaded). (4) *.auto.tfvars files (auto-loaded, alphabetical order). (5) TF_VAR_name environment variables: TF_VAR_environment=prod. Later sources override earlier ones. Best practice: use terraform.tfvars for defaults, environment-specific .tfvars files for overrides, never commit secrets in tfvars"
73
+ weight: 0.35
74
+ description: "Value passing"
75
+ - type: llm_judge
76
+ criteria: "Outputs are explained — output blocks export values after apply. Uses: display information, pass data between modules (module.vpc.vpc_id), feed into other tools. Attributes: value (required), description, sensitive, depends_on. terraform output command to retrieve values. terraform output -json for machine-readable format. Common errors: referencing attribute that doesn't exist on resource type, referencing resource with count/for_each without index (aws_instance.web[0].public_dns or aws_instance.web[*].public_dns)"
77
+ weight: 0.30
78
+ description: "Outputs"
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "dojo.md",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Training arena for AI agents — scenario-based evaluation with mock services, LLM-judged assertions, and automatic SKILL.md generation",
5
5
  "type": "module",
6
6
  "bin": {
7
- "dojo": "./dist/cli/index.js"
7
+ "dojo": "./dist/cli/index.js",
8
+ "dojo.md": "./dist/cli/index.js"
8
9
  },
9
10
  "main": "./dist/engine/model-client.js",
10
11
  "exports": {