description: "Every export writes under the workspace output directory (workspace_status.output_dir). subdir must match ^[A-Za-z0-9_.-/]{0,200}$ and must stay inside the..."¶
Export¶
Every export writes under the workspace output directory (workspace_status.output_dir). subdir must match ^[A-Za-z0-9_.\-/]{0,200}$ and must stay inside the output directory after resolution; .. escapes and absolute paths elsewhere fail with an access error. Files with the same name are overwritten.
terraform_preview¶
Category export · sensitivity internal · capabilities read_state · readOnly true, destructive false, idempotent true, openWorld false · outputSchema no · timeout: layer default (300 s)
What a Terraform recreation of the assets would contain, without writing anything: assets_considered, total_mapped, total_unmapped, resource_types (Terraform type to count) and unmapped_asset_types (asset types with no Terraform mapping). refs picks assets explicitly; asset_types filters (both may be combined).
| Argument | Type | Default | Constraints | Description |
|---|---|---|---|---|
refs |
string[] or null | null |
Only these assets (refs). | |
asset_types |
string[] or null | null |
Only these AssetType values. | |
dataset |
string | "" |
Dataset name (see list_datasets). Empty = the active dataset. |
Called with the arguments below, terraform_preview returned this structuredContent.
{
"dataset": "sample",
"assets_considered": 44,
"total_mapped": 29,
"total_unmapped": 15,
"resource_types": {
"aws_vpc": 1,
"aws_subnet": 2,
"aws_security_group": 4,
"aws_lb": 1,
"aws_instance": 3,
"...": "13 more"
},
"unmapped_asset_types": {
"ORGANIZATION": 1,
"ORG_UNIT": 1,
"CLOUD_ACCOUNT": 3,
"ORG_POLICY": 1,
"TARGET_GROUP": 1,
"...": "8 more"
}
}
Called with the arguments below, terraform_preview returned this structuredContent.
{
"dataset": "sample",
"assets_considered": 2,
"total_mapped": 2,
"total_unmapped": 0,
"resource_types": {
"aws_instance": 1,
"aws_db_instance": 1
},
"unmapped_asset_types": {}
}
{
"tool": "terraform_preview",
"arguments": {
"refs": [
"web-11"
]
},
"isError": true,
"text": "No asset matches the reference in this dataset. 5 close matches, see suggestions in the error data. Use find_assets(query=...) to search by name, ARN or tag.",
"_meta": {
"cloudg/error_code": -32602,
"cloudg/error_data": {
"value": "web-11",
"dataset": "sample",
"suggestions": [
{
"id": "web-1",
"name": "web-1",
"arn": "arn:aws:ec2:us-east-1:111111111111:instance/i-0web1",
"type": "EC2",
"account_id": "111111111111",
"dataset": "sample"
},
{
"id": "web-2",
"name": "web-2",
"arn": "arn:aws:ec2:us-east-1:111111111111:instance/i-0web2",
"type": "EC2",
"account_id": "111111111111",
"dataset": "sample"
},
"... 3 more"
]
}
}
}
export_terraform¶
Category export · sensitivity confidential · capabilities read_state, write_fs · readOnly false, destructive false, idempotent true, openWorld false · outputSchema no · timeout: layer default (300 s)
Writes a .tf.json recreation of the selected assets (provider.tf.json, variables.tf.json, main.tf.json) and an import_commands.sh into <output_dir>/<subdir>. Edges with at least one end among the selected assets are passed to the exporter. Returns output_dir, resources (assets selected) and files.
| Argument | Type | Default | Constraints | Description |
|---|---|---|---|---|
subdir |
string | "terraform" |
pattern ^[A-Za-z0-9_.\-/]{0,200}$ |
Sub-directory of the workspace output directory ('' = the directory itself). |
refs |
string[] or null | null |
Only these assets (refs). | |
asset_types |
string[] or null | null |
Only these AssetType values. | |
dataset |
string | "" |
Dataset name (see list_datasets). Empty = the active dataset. |
Called with the arguments below, export_terraform returned this structuredContent.
{
"dataset": "sample",
"output_dir": "<estate>/out/tf",
"resources": 4,
"files": {
"provider": "<estate>/out/tf/provider.tf.json",
"variables": "<estate>/out/tf/variables.tf.json",
"main": "<estate>/out/tf/main.tf.json",
"import_commands": "<estate>/out/tf/import_commands.sh"
}
}
{
"tool": "export_terraform",
"arguments": {
"subdir": "../../etc"
},
"isError": true,
"text": "Output path ../../etc escapes the output directory <estate>/out.",
"_meta": {
"cloudg/error_code": -31001
}
}
export_report¶
Category export · sensitivity confidential · capabilities read_state, write_fs · readOnly false, destructive false, idempotent true, openWorld false · outputSchema no · timeout: layer default (300 s)
Writes the dataset as a cloudg report file set and returns the paths.
| Argument | Type | Default | Constraints | Description |
|---|---|---|---|---|
format |
string | "json" |
one of json, html, inventory, graphml, asset_map |
json: findings.json (assets, findings, compliance, D3 graph); html: interactive report.html; inventory: inventory-map.json + .graphml + graph + dependencies; graphml: the graph only; asset_map: asset-map.json + compliance-map.json (inventory x findings). |
subdir |
string | "" |
pattern ^[A-Za-z0-9_.\-/]{0,200}$ |
Sub-directory of the workspace output directory ('' = the directory itself). |
dataset |
string | "" |
Dataset name (see list_datasets). Empty = the active dataset. |
format |
Files (files keys) |
|---|---|
json |
findings.json with assets, edges, findings, compliance and the D3 graph (json). Loadable again with load_dataset. |
html |
The interactive report.html (html). |
inventory |
inventory-map.json, .graphml, the graph JSON, dependencies and organization files (map, graphml, graph, dependencies, organization). |
graphml |
<dataset>.graphml (graphml). |
asset_map |
asset-map.json and compliance-map.json, the inventory joined with findings (asset_map, compliance_map). |
Called with the arguments below, export_report returned this structuredContent.
{
"dataset": "sample",
"format": "json",
"output_dir": "<estate>/out/reports/json",
"files": {
"json": "<estate>/out/reports/json/findings.json"
}
}
Called with the arguments below, export_report returned this structuredContent.
{
"dataset": "sample",
"format": "inventory",
"output_dir": "<estate>/out/reports/inventory",
"files": {
"map": "<estate>/out/reports/inventory/inventory-map.json",
"graphml": "<estate>/out/reports/inventory/inventory-map.graphml",
"graph": "<estate>/out/reports/inventory/inventory-graph.json",
"dependencies": "<estate>/out/reports/inventory/inventory-dependencies.json",
"organization": "<estate>/out/reports/inventory/inventory-organization.json"
}
}
The html, graphml and asset_map runs returned:
export_report returned this structuredContent.
{
"dataset": "sample",
"format": "html",
"output_dir": "<estate>/out/reports/html",
"files": {
"html": "<estate>/out/reports/html/report.html"
}
}
export_report returned this structuredContent.
{
"dataset": "sample",
"format": "graphml",
"output_dir": "<estate>/out/reports/graphml",
"files": {
"graphml": "<estate>/out/reports/graphml/sample.graphml"
}
}
export_report returned this structuredContent.