IaC grammar#
Infrastructure grammar describes program, resource, and deployment declarations used to model deployable runtime resources.
Source#
| Property | Value |
|---|---|
| Grammar file | packages/business/language/grammar/iac.g4 |
| Grammar name | iac |
| Grammar kind | parser |
| Imports | common, expression, function, annotation |
| Imported by | BusinessLanguage |
| Direct rule or token count | 22 |
How to use this page#
Read the examples first when authoring Business Language. Use the rule inventory when checking exact grammar coverage or when updating parser, lowering, editor, or documentation behavior.
Entry rules and syntax families#
Start with these rules when reading this grammar: resourceDeclaration, resourceType, resourceProfileStatement, resourceNameStatement, resourcePublicStatement, resourceHostOnStatement, resourceRuntimeStatement, resourceEnvStatement, resourceSecretStatement, resourceConnectStatement.
- Declarations:
deploymentDeclaration,resourceDeclaration - Statements:
deploymentOutputStatement,deploymentProviderProfileStatement,deploymentRegionStatement,deploymentUseStatement,resourceAdminLoginStatement,resourceAdminPasswordSecretStatement,resourceConnectStatement,resourceEngineStatement, and 8 more - Types:
resourceType
Key grammar excerpts#
resourceDeclaration#
resourceDeclaration
: annotation* accessModifier? RESOURCE resourceType OPEN_BRACE resourceMember* CLOSE_BRACE
// @runtime_ast_export
;resourceType#
resourceType
: unresolvedIdentifier+
;resourceProfileStatement#
resourceProfileStatement
: PROFILE singleExpression SEMICOLON?
;Complete rule and token inventory#
deploymentDeclaration, deploymentMember, deploymentOutputStatement, deploymentProviderProfileStatement, deploymentRegionStatement, deploymentUseStatement, resourceAdminLoginStatement, resourceAdminPasswordSecretStatement
resourceConnectStatement, resourceDeclaration, resourceEngineStatement, resourceEnvStatement, resourceHostOnStatement, resourceMember, resourceNameStatement, resourceOnStatement
resourceProfileStatement, resourcePublicStatement, resourceReference, resourceRuntimeStatement, resourceSecretStatement, resourceTypeExamples#
Resource declaration#
resource web app {
profile "production";
name "docs.nezam.ai";
public;
runtime node version "20";
env PORT = 38193;
}Deployment declaration#
deployment docs_site(environment: string) {
provider profile "default";
region "eu-central";
use web app;
output url = environment;
}Linked resources with secrets#
resource web app {
profile "production";
name "vendor-api";
public;
host on cluster main;
runtime node version "20";
env PORT = 8080;
secret DATABASE_URL = "vendor-db-url";
connect to database primary;
on network private;
}
resource database primary {
engine "postgres";
admin login "admin";
admin password secret "database-admin-password";
}
deployment production() {
provider profile "contabo";
region "de";
use web app;
use database primary;
output api_url = "https://vendors.example.com";
}Common authoring mistakes#
- Do not copy examples without checking the rule inventory for the exact grammar boundary.
- Do not add behavior that depends on missing configuration or undeclared user-facing errors.
Related guides#
- /language/resources-deployments/
- /reference/deployment/
Authoring notes#
- Keep examples aligned with the grammar source, not with inferred syntax from another language.
- Use declared messages for user-facing failures, and fail closed when required configuration is absent.