ts-terraform Logots-terraform
npm version
Build Status
  • Modules

API

@ts-terraform/provider

Provider

Provider allows for interacting with a Terraform provider using gRPC.

ts
export declare const createProvider: ( binary: string, opts?: Options | undefined, ) => Promise<Provider<ProviderConfigType>> export declare function codegen(provider: Provider): string export interface Options { /** If true, the provider's debug messages will be printed on stderr */ debug?: boolean } export interface ProviderConfigType { providerSchema: object dataSourceSchemas: Record<string, object> resourceSchemas: Record<string, object> dataSourceStateSchemas: Record<string, object> resourceStateSchemas: Record<string, object> } export declare class Provider<ProviderConfig extends ProviderConfigType = ProviderConfigType> { get providerSchema(): ObjectType<ObjectProperties> get dataSourceSchemas(): Record<string, ObjectType<ObjectProperties>> get resourceSchemas(): Record<string, ObjectType<ObjectProperties>> get dataSourceStateSchemas(): Record<string, ObjectType<ObjectProperties>> get resourceStateSchemas(): Record<string, ObjectType<ObjectProperties>> getSchema(): Promise<tfplugin5.GetProviderSchema.Response> applyResourceChange<Name extends StringKeyOf<ProviderConfig['resourceStateSchemas']>>( typeName: Name, priorState: ProviderConfig['resourceStateSchemas'][Name], plannedState: ProviderConfig['resourceStateSchemas'][Name], options?: { private?: Record<string, unknown> }, ): Promise<{ newState: ProviderConfig['resourceStateSchemas'][Name] private: Record<string, unknown> }> configure(config: ProviderConfig['providerSchema']): Promise<tfplugin5.Configure.Response> importResourceState<Name extends StringKeyOf<ProviderConfig['resourceStateSchemas']>>( typeName: Name, id: string, ): Promise< { typeName: Name state: ProviderConfig['resourceStateSchemas'][Name] private?: Record<string, unknown> }[] > planResourceChange<Name extends StringKeyOf<ProviderConfig['resourceStateSchemas']>>( typeName: Name, priorState: ProviderConfig['resourceStateSchemas'][Name], proposedNewState: ProviderConfig['resourceStateSchemas'][Name], options?: { private?: Record<string, unknown> }, ): Promise<{ plannedState: ProviderConfig['resourceStateSchemas'][Name] plannedPrivate: Record<string, unknown> requiresReplace: tfplugin5.IAttributePath[] }> readDataSource<Name extends StringKeyOf<ProviderConfig['dataSourceSchemas']>>( typeName: Name, config: ProviderConfig['dataSourceSchemas'][Name], ): Promise<ProviderConfig['dataSourceStateSchemas'][Name]> readResource<Name extends StringKeyOf<ProviderConfig['resourceStateSchemas']>>( typeName: Name, currentState: ProviderConfig['resourceStateSchemas'][Name], options?: { private?: Record<string, unknown> }, ): Promise<ProviderConfig['resourceStateSchemas'][Name] | undefined> shutdown(signal?: NodeJS.Signals | number): Promise<boolean> upgradeResourceState<Name extends StringKeyOf<ProviderConfig['resourceStateSchemas']>>( typeName: Name, version: number, state: object, ): Promise<ProviderConfig['resourceStateSchemas'][Name]> validateDataSourceConfig<Name extends StringKeyOf<ProviderConfig['dataSourceSchemas']>>( typeName: Name, config: object, ): Promise<tfplugin5.ValidateDataSourceConfig.Response> validateResourceTypeConfig<Name extends StringKeyOf<ProviderConfig['resourceSchemas']>>( typeName: Name, config: object, ): Promise<tfplugin5.ValidateResourceTypeConfig.Response> }