import { Block, Comment, Resource, Data, Module, Output, Provider, Variable, Backend, Provisioner, ResourceToDataOptions, Locals, Import, ImportArgs, VariableArgs, ModuleArgs, OutputArgs, Moved, MovedArgs, RemovedArgs, Removed } from './blocks'; import { TerraformArgs } from './utils'; /** * @category TerraformGenerator */ export interface WriteOptions { /** * Directory to write to. * * Default = . */ dir?: string; /** * Terraform filename, must ends with .tf. * * Default = terraform.tf */ tfFilename?: string; /** * Terraform variables filename, must ends with .tfvars. * * Default = terraform.tfvars */ tfvarsFilename?: string; /** * Put `true` to use `terraform fmt` to format the configuration, Terraform must be installed. * * If the terraform binary is named differently in your machine, put the binary name instead. * * Default = false */ format?: boolean | string; } /** * @category TerraformGenerator */ export declare class TerraformGenerator { #private; /** * Construct Terraform generator. * * Refer to Terraform documentation on what can be put as arguments. * * @param args arguments */ constructor(args?: TerraformArgs); /** * Generate Terraform configuration as string. */ generate(): { tf: string; tfvars?: string; }; /** * Write Terraform configuration to a file. * * @param options options */ write(options?: WriteOptions): void; /** * Add blocks into Terraform. * * @param blocks blocks */ addBlocks(...blocks: Block[]): this; /** * Add comment into Terraform. * * @param comment comment */ comment(comment: string): Comment; /** * Add provider into Terraform. * * Refer to Terraform documentation on what can be put as type & arguments. * * @param type type * @param args arguments */ provider(type: string, args: TerraformArgs): Provider; /** * Add resource into Terraform. * * Refer to Terraform documentation on what can be put as type & arguments. * * @param type type * @param name name * @param args arguments * @param provisioners provisioners */ resource(type: string, name: string, args: TerraformArgs, provisioners?: Provisioner[]): Resource; /** * Convert resource into data source and add it into Terraform. * * @param resource resource * @param options options * @param argNames names of resource arguments to be converted into data source arguments; * use array for name mapping, position 0 = original resource's argument name, position 1 = mapped data source's argument name * @param args extra arguments */ dataFromResource(resource: Resource, options: ResourceToDataOptions | undefined, argNames: (string | [string, string])[], args?: TerraformArgs): Data; /** * Add data source into Terraform. * * Refer to Terraform documentation on what can be put as type & arguments. * * @param type type * @param name name * @param args arguments */ data(type: string, name: string, args: TerraformArgs): Data; /** * Add module into Terraform. * * Refer to Terraform documentation on what can be put as arguments. * * @param name name * @param args arguments */ module(name: string, args: ModuleArgs): Module; /** * Add output into Terraform. * * Refer to Terraform documentation on what can be put as arguments. * * @param name name * @param args arguments */ output(name: string, args: OutputArgs): Output; /** * Add locals into Terraform. * * Refer to Terraform documentation on what can be put as arguments. * * @param args arguments */ locals(args: TerraformArgs): Locals; /** * Add variable into Terraform. * * Refer to Terraform documentation on what can be put as arguments. * * @param name name * @param args arguments * @param value variable value */ variable(name: string, args: VariableArgs, value?: any): Variable; /** * Add import into Terraform. * * Refer to Terraform documentation on what can be put as arguments. * * @param args arguments */ import(args: ImportArgs): Import; /** * Add backend into Terraform. * * Refer to Terraform documentation on what can be put as type & arguments. * * @param type type * @param args arguments */ backend(type: string, args: TerraformArgs): Backend; /** * Add moved into Terraform. * * Refer to Terraform documentation on what can be put as type & arguments. * * @param args arguments */ moved(args: MovedArgs): Moved; /** * Add removed into Terraform. * * Refer to Terraform documentation on what can be put as type & arguments. * * @param args arguments */ removed(args: RemovedArgs): Removed; /** * Add variable values into Terraform. * * @param variables variables */ addVars(variables: TerraformArgs): this; /** * Merge this instance with other TerraformGenerator instances. * * @param tfgs other instances */ merge(...tfgs: TerraformGenerator[]): this; /** * Get arguments. */ getArguments(): TerraformArgs | undefined; /** * Get blocks. */ getBlocks(): Block[]; /** * Get variables. */ getVars(): TerraformArgs; }