N NezamDocumentation

IaC grammar#

Infrastructure grammar describes program, resource, and deployment declarations used to model deployable runtime resources.

Source#

PropertyValue
Grammar filepackages/business/language/grammar/iac.g4
Grammar nameiac
Grammar kindparser
Importscommon, expression, function, annotation
Imported byBusinessLanguage
Direct rule or token count22

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#

antlr
resourceDeclaration
    : annotation* accessModifier? RESOURCE resourceType OPEN_BRACE resourceMember* CLOSE_BRACE
      // @runtime_ast_export
    ;

resourceType#

antlr
resourceType
    : unresolvedIdentifier+
    ;

resourceProfileStatement#

antlr
resourceProfileStatement
    : PROFILE singleExpression SEMICOLON?
    ;

Complete rule and token inventory#

text
deploymentDeclaration, deploymentMember, deploymentOutputStatement, deploymentProviderProfileStatement, deploymentRegionStatement, deploymentUseStatement, resourceAdminLoginStatement, resourceAdminPasswordSecretStatement
resourceConnectStatement, resourceDeclaration, resourceEngineStatement, resourceEnvStatement, resourceHostOnStatement, resourceMember, resourceNameStatement, resourceOnStatement
resourceProfileStatement, resourcePublicStatement, resourceReference, resourceRuntimeStatement, resourceSecretStatement, resourceType

Examples#

Resource declaration#

bl
resource web app {
  profile "production";
  name "docs.nezam.ai";
  public;
  runtime node version "20";
  env PORT = 38193;
}

Deployment declaration#

bl
deployment docs_site(environment: string) {
  provider profile "default";
  region "eu-central";
  use web app;
  output url = environment;
}

Linked resources with secrets#

bl
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.
  • /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.
Source: packages/business/language/grammar-files/iac.md