/** * Generic parsers for Terraform blocks. * Handles resource, data, provider, module, terraform settings, and unknown block types. */ import { DataBlock, GenericBlock, ModuleBlock, ProviderBlock, ResourceBlock, TerraformSettingsBlock } from '../types/blocks'; import { HclBlock } from '../types/blocks'; /** * Parser for terraform settings blocks. * * @example * ```hcl * terraform { * required_version = ">= 1.0.0" * required_providers { * aws = { * source = "hashicorp/aws" * version = "~> 4.0" * } * } * } * ``` */ export declare class TerraformSettingsParser { /** * Parses a terraform settings block. * @param block - The raw HCL block to parse * @returns Parsed TerraformSettingsBlock */ parse(block: HclBlock): TerraformSettingsBlock; } /** * Parser for provider configuration blocks. * * @example * ```hcl * provider "aws" { * alias = "west" * region = "us-west-2" * } * ``` */ export declare class ProviderParser { /** * Parses a provider configuration block. * @param block - The raw HCL block to parse * @returns Parsed ProviderBlock with name, alias, and properties */ parse(block: HclBlock): ProviderBlock; } /** * Parser for module call blocks. * * @example * ```hcl * module "vpc" { * source = "terraform-aws-modules/vpc/aws" * version = "3.0.0" * * name = "my-vpc" * cidr = "10.0.0.0/16" * } * ``` */ export declare class ModuleParser { /** * Parses a module call block. * @param block - The raw HCL block to parse * @returns Parsed ModuleBlock with name and all properties */ parse(block: HclBlock): ModuleBlock; } /** * Parser for resource definition blocks. * Separates meta-arguments (count, for_each, depends_on, etc.) from resource properties. * * @example * ```hcl * resource "aws_instance" "web" { * count = 3 * ami = var.ami_id * instance_type = "t2.micro" * * tags = { * Name = "web-${count.index}" * } * * dynamic "ebs_block_device" { * for_each = var.ebs_volumes * content { * device_name = ebs_block_device.value.device_name * volume_size = ebs_block_device.value.size * } * } * } * ``` */ export declare class ResourceParser { /** * Parses a resource block, separating properties, meta-arguments, and dynamic blocks. * @param block - The raw HCL block to parse * @returns Parsed ResourceBlock with separated concerns */ parse(block: HclBlock): ResourceBlock; /** * Extracts dynamic blocks from nested blocks. * @param blocks - Nested blocks from the resource body * @returns Array of DynamicBlock objects */ private extractDynamicBlocks; } /** * Parser for data source blocks. * * @example * ```hcl * data "aws_ami" "ubuntu" { * most_recent = true * * filter { * name = "name" * values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"] * } * * owners = ["099720109477"] * } * ``` */ export declare class DataParser { /** * Parses a data source block. * @param block - The raw HCL block to parse * @returns Parsed DataBlock with type, name, properties, and nested blocks */ parse(block: HclBlock): DataBlock; } /** * Parser for generic/unknown block types. * Used for moved, import, check, terraform_data, and unrecognized blocks. * * @example * ```hcl * moved { * from = aws_instance.old * to = aws_instance.new * } * * import { * to = aws_instance.example * id = "i-1234567890abcdef0" * } * * check "health" { * assert { * condition = data.http.health.status_code == 200 * error_message = "Health check failed" * } * } * ``` */ export declare class GenericBlockParser { /** * Parses a generic block into a GenericBlock structure. * @param block - The raw HCL block to parse * @returns Parsed GenericBlock with type, labels, properties, and nested blocks */ parse(block: HclBlock): GenericBlock; }