You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/develop/using-ai.md
+88-73Lines changed: 88 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,11 @@ sidebar_label: Using AI
5
5
6
6
# Using AI
7
7
8
-
Creating new controls for Powerpipe mods with AI tools and IDEs works remarkably well. At Turbot, we develop controls frequently and use AI for almost every new control we create. We've found that AI typically produces excellent results when working with existing mod repositories, as it can learn from established patterns and conventions.
8
+
Creating new benchmarks, dashboards, and controls for Powerpipe mods with AI tools and IDEs works remarkably well. At Turbot, we develop these components frequently and use AI for almost every new implementation. We've experimented with various approaches, including detailed prompt engineering, explicit guidelines, IDE rules and instructions, and complex workflows, but found that AI typically produces excellent results even without heavy guidance.
9
9
10
-
The key to success is working within existing mod repositories and opening the entire repository as a folder or project in your IDE. This gives AI tools access to existing control implementations, documentation examples, code patterns, and naming conventions to generate consistent, high-quality results.
10
+
The key to this success is working within existing mod repositories and opening the entire repository as a folder or project in your IDE. This gives AI tools access to existing implementations, documentation examples, code patterns, and naming conventions to generate consistent, high-quality results without extensive prompting.
11
11
12
-
If you're looking to use AI to run Powerpipe controls rather than develop new ones, you can use the [Powerpipe MCP server](../query/mcp), which provides powerful tools for AI agents to inspect and run controls, benchmarks, and queries.
12
+
If you're looking to use AI to run Powerpipe controls rather than develop new ones, you can use the [Powerpipe MCP server](../run/mcp), which provides powerful tools for AI agents to inspect and run controls, benchmarks, and queries.
13
13
14
14
## Getting Started
15
15
@@ -22,108 +22,123 @@ While AI often works well with simple requests like "Create a control for [requi
22
22
3. Set up access to the cloud providers or systems you'll be evaluating.
23
23
4. Configure the [Powerpipe MCP server](https://github.com/turbot/powerpipe-mcp) which allows the agent to inspect and run controls.
24
24
25
-
### Understand Conventions
25
+
### Create Control
26
26
27
-
First, review existing controls and conventions to ensure consistency:
27
+
First, create the complete control implementation:
28
28
29
29
```md
30
-
Your goal is to understand the conventions for creating a new Powerpipe control.
30
+
Your goal is to create a new control with all necessary components.
31
31
32
-
1. Review the sample repository at https://github.com/turbot/steampipe-mod-aws-thrifty for reference patterns.
32
+
1. Review existing controls and their documentation in the mod to understand established patterns, naming conventions, and query structures.
33
33
34
-
2. Analyze existing controls in the current mod to understand:
35
-
- Control naming conventions
36
-
- File and directory organization
37
-
- Query structure and style
38
-
- Variable naming and placement
39
-
- Documentation format and requirements
40
-
41
-
3. Document the key conventions you've identified to ensure your new control will be consistent.
34
+
2. Create the control definition:
35
+
- Choose appropriate directory and file based on existing patterns
36
+
- Use descriptive names following conventions
37
+
- Include clear descriptions and documentation
38
+
- Set appropriate severity levels
39
+
- Define any necessary variables with default values
40
+
- Implement the SQL query following established patterns:
41
+
- Use `->` and `->>` operators with spaces before and after
42
+
- Include resource identifiers in non-aggregate queries
43
+
- Add to relevant benchmarks (e.g., all controls benchmark, service-specific benchmark)
44
+
- Include comprehensive documentation:
45
+
- Clear description of what the control checks
46
+
- Explanation of why this check is important
47
+
- List of variables and their purposes
48
+
- Example queries and expected results
49
+
- Remediation steps for failing resources
50
+
- Any limitations or important notes
42
51
```
43
52
44
-
### Create and Test the Query
53
+
### Run Control
45
54
46
-
Next, develop the SQL query that will power your control:
55
+
Next, verify the control is properly configured:
47
56
48
57
```md
49
-
Your goal is to create a working SQL query for your new control.
50
-
51
-
1. Follow the query structure conventions identified earlier.
58
+
Your goal is to verify the control runs without errors.
- Powerpipe CLI command: powerpipe control run <control_name>
130
+
1. Delete all resources created for testing:
131
+
- Use the same method used for creation
132
+
- Remove any dependent resources
133
+
- Follow provider's recommended deletion order
119
134
120
-
2. Verify:
121
-
- Control executes without errors
122
-
- Results match expectations
123
-
- Documentation examples work correctly
124
-
- Variables function as intended
125
-
126
-
3. Make any necessary adjustments and retest until everything works perfectly.
135
+
2. Verify cleanup:
136
+
- Confirm all resources are successfully deleted
137
+
- Run the control again to verify 0 results or expected baseline
127
138
```
128
139
140
+
## Powerpipe HCL
141
+
142
+
For detailed information about writing Powerpipe HCL configurations, including benchmarks, controls, dashboards, and more, see the [Powerpipe HCL documentation](../develop/hcl).
143
+
129
144
Remember that AI tools work best when they can see the full context of your mod repository. Always open the entire repository in your IDE and use the Powerpipe MCP server when available for the most efficient development experience.
0 commit comments