terrac
Version:
A minimal private module registry for Terraform and OpenTofu
40 lines (39 loc) • 1.13 kB
TypeScript
import { IBackend, IModuleListItem } from './shared';
import { IModuleMeta } from '../types/module';
import { S3Client } from '@aws-sdk/client-s3';
import * as Joi from 'joi';
export declare const configSchemaS3: Joi.ObjectSchema<any>;
export interface IBackendConfigS3 {
/**
* Backend type
*/
type: 's3';
/**
* Bucket name
*/
bucket: string;
/**
* Bucket region
*/
region: string;
/**
* Object key prefix
*/
keyPrefix?: string;
}
export declare class BackendS3 implements IBackend {
config: IBackendConfigS3;
client: S3Client;
constructor(config: IBackendConfigS3);
upload(name: string, version: string, packagePath: string): Promise<void>;
getSourceUrl(name: string, version?: string): Promise<string>;
list(name?: string): Promise<IModuleListItem[]>;
exists(name: string, version?: string): Promise<boolean>;
getMeta(name: string): Promise<IModuleMeta>;
saveMeta(meta: IModuleMeta): Promise<void>;
private putObject;
private keyExists;
private listKeys;
private getMetaKey;
private getPackageKey;
}