import * as pulumi from "@pulumi/pulumi"; /** * Provides details about an AWS Lambda Layer Version. Use this data source to retrieve information about a specific layer version or find the latest version compatible with your runtime and architecture requirements. * * ## Example Usage * * ### Get Latest Layer Version * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = aws.lambda.getLayerVersion({ * layerName: "my-shared-utilities", * }); * // Use the layer in a Lambda function * const exampleFunction = new aws.lambda.Function("example", { * code: new pulumi.asset.FileArchive("function.zip"), * name: "example_function", * role: lambdaRole.arn, * handler: "index.handler", * runtime: aws.lambda.Runtime.NodeJS24dX, * layers: [example.then(example => example.arn)], * }); * ``` * * ### Get Specific Layer Version * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = aws.lambda.getLayerVersion({ * layerName: "production-utilities", * version: 5, * }); * export const layerInfo = { * arn: example.then(example => example.arn), * version: example.then(example => example.version), * description: example.then(example => example.description), * }; * ``` * * ### Get Latest Compatible Layer Version * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Find latest layer version compatible with Python 3.12 * const pythonLayer = aws.lambda.getLayerVersion({ * layerName: "python-dependencies", * compatibleRuntime: "python3.12", * }); * // Find latest layer version compatible with ARM64 architecture * const armLayer = aws.lambda.getLayerVersion({ * layerName: "optimized-libraries", * compatibleArchitecture: "arm64", * }); * // Use both layers in a function * const example = new aws.lambda.Function("example", { * code: new pulumi.asset.FileArchive("function.zip"), * name: "multi_layer_function", * role: lambdaRole.arn, * handler: "app.handler", * runtime: aws.lambda.Runtime.Python3d12, * architectures: ["arm64"], * layers: [ * pythonLayer.then(pythonLayer => pythonLayer.arn), * armLayer.then(armLayer => armLayer.arn), * ], * }); * ``` * * ### Compare Layer Versions * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Get latest version * const latest = aws.lambda.getLayerVersion({ * layerName: "shared-layer", * }); * // Get specific version for comparison * const stable = aws.lambda.getLayerVersion({ * layerName: "shared-layer", * version: 3, * }); * const useLatestLayer = latest.then(latest => latest.version > 5); * const selectedLayer = useLatestLayer ? latest.then(latest => latest.arn) : stable.then(stable => stable.arn); * export const selectedLayerVersion = useLatestLayer ? latest.then(latest => latest.version) : stable.then(stable => stable.version); * ``` * * ### Cross-Account Layer Access * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Reference a layer from another AWS account using full ARN with version * const sharedLayer = aws.lambda.getLayerVersion({ * layerVersionArn: "arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities:5", * }); * // Use in your Lambda function * const example = new aws.lambda.Function("example", { * code: new pulumi.asset.FileArchive("function.zip"), * name: "cross_account_example", * role: lambdaRole.arn, * handler: "index.handler", * runtime: aws.lambda.Runtime.NodeJS24dX, * layers: [sharedLayer.then(sharedLayer => sharedLayer.arn)], * }); * ``` * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Reference a layer ARN without version (requires ListLayerVersions permission) * const latestShared = aws.lambda.getLayerVersion({ * layerVersionArn: "arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities", * }); * ``` */ export declare function getLayerVersion(args?: GetLayerVersionArgs, opts?: pulumi.InvokeOptions): Promise; /** * A collection of arguments for invoking getLayerVersion. */ export interface GetLayerVersionArgs { /** * Specific architecture the layer version must support. Only valid with `layerName`. Conflicts with `version` and `layerVersionArn`. If specified, the latest available layer version supporting the provided architecture will be used. */ compatibleArchitecture?: string; /** * Specific runtime the layer version must support. Only valid with `layerName`. Conflicts with `version` and `layerVersionArn`. If specified, the latest available layer version supporting the provided runtime will be used. */ compatibleRuntime?: string; /** * Name of the Lambda layer. One of `layerName` or `layerVersionArn` is required. */ layerName?: string; /** * ARN of the Lambda layer version. Can be a full ARN with version (e.g., `arn:aws:lambda:region:account:layer:name:1`) or without version (e.g., `arn:aws:lambda:region:account:layer:name`). When the version is omitted, the latest version will be retrieved (requires `lambda:ListLayerVersions` permission). Use the full ARN with version for cross-account layers where you don't have list permissions. One of `layerName` or `layerVersionArn` is required. */ layerVersionArn?: string; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: string; /** * Specific layer version. Only valid with `layerName`. Conflicts with `compatibleRuntime`, `compatibleArchitecture`, and `layerVersionArn`. If omitted, the latest available layer version will be used. */ version?: number; } /** * A collection of values returned by getLayerVersion. */ export interface GetLayerVersionResult { /** * ARN of the Lambda Layer with version. */ readonly arn: string; /** * Base64-encoded representation of raw SHA-256 sum of the zip file. */ readonly codeSha256: string; readonly compatibleArchitecture?: string; /** * List of [Architectures](https://docs.aws.amazon.com/lambda/latest/dg/API_GetLayerVersion.html#SSS-GetLayerVersion-response-CompatibleArchitectures) the specific Lambda Layer version is compatible with. */ readonly compatibleArchitectures: string[]; readonly compatibleRuntime?: string; /** * List of [Runtimes](https://docs.aws.amazon.com/lambda/latest/dg/API_GetLayerVersion.html#SSS-GetLayerVersion-response-CompatibleRuntimes) the specific Lambda Layer version is compatible with. */ readonly compatibleRuntimes: string[]; /** * Date this resource was created. */ readonly createdDate: string; /** * Description of the specific Lambda Layer version. */ readonly description: string; /** * The provider-assigned unique ID for this managed resource. */ readonly id: string; /** * ARN of the Lambda Layer without version. */ readonly layerArn: string; readonly layerName: string; readonly layerVersionArn: string; /** * License info associated with the specific Lambda Layer version. */ readonly licenseInfo: string; readonly region: string; /** * ARN of a signing job. */ readonly signingJobArn: string; /** * ARN for a signing profile version. */ readonly signingProfileVersionArn: string; /** * (**Deprecated** use `codeSha256` instead) Base64-encoded representation of raw SHA-256 sum of the zip file. * * @deprecated source_code_hash is deprecated. Use codeSha256 instead. */ readonly sourceCodeHash: string; /** * Size in bytes of the function .zip file. */ readonly sourceCodeSize: number; readonly version: number; } /** * Provides details about an AWS Lambda Layer Version. Use this data source to retrieve information about a specific layer version or find the latest version compatible with your runtime and architecture requirements. * * ## Example Usage * * ### Get Latest Layer Version * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = aws.lambda.getLayerVersion({ * layerName: "my-shared-utilities", * }); * // Use the layer in a Lambda function * const exampleFunction = new aws.lambda.Function("example", { * code: new pulumi.asset.FileArchive("function.zip"), * name: "example_function", * role: lambdaRole.arn, * handler: "index.handler", * runtime: aws.lambda.Runtime.NodeJS24dX, * layers: [example.then(example => example.arn)], * }); * ``` * * ### Get Specific Layer Version * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = aws.lambda.getLayerVersion({ * layerName: "production-utilities", * version: 5, * }); * export const layerInfo = { * arn: example.then(example => example.arn), * version: example.then(example => example.version), * description: example.then(example => example.description), * }; * ``` * * ### Get Latest Compatible Layer Version * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Find latest layer version compatible with Python 3.12 * const pythonLayer = aws.lambda.getLayerVersion({ * layerName: "python-dependencies", * compatibleRuntime: "python3.12", * }); * // Find latest layer version compatible with ARM64 architecture * const armLayer = aws.lambda.getLayerVersion({ * layerName: "optimized-libraries", * compatibleArchitecture: "arm64", * }); * // Use both layers in a function * const example = new aws.lambda.Function("example", { * code: new pulumi.asset.FileArchive("function.zip"), * name: "multi_layer_function", * role: lambdaRole.arn, * handler: "app.handler", * runtime: aws.lambda.Runtime.Python3d12, * architectures: ["arm64"], * layers: [ * pythonLayer.then(pythonLayer => pythonLayer.arn), * armLayer.then(armLayer => armLayer.arn), * ], * }); * ``` * * ### Compare Layer Versions * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Get latest version * const latest = aws.lambda.getLayerVersion({ * layerName: "shared-layer", * }); * // Get specific version for comparison * const stable = aws.lambda.getLayerVersion({ * layerName: "shared-layer", * version: 3, * }); * const useLatestLayer = latest.then(latest => latest.version > 5); * const selectedLayer = useLatestLayer ? latest.then(latest => latest.arn) : stable.then(stable => stable.arn); * export const selectedLayerVersion = useLatestLayer ? latest.then(latest => latest.version) : stable.then(stable => stable.version); * ``` * * ### Cross-Account Layer Access * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Reference a layer from another AWS account using full ARN with version * const sharedLayer = aws.lambda.getLayerVersion({ * layerVersionArn: "arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities:5", * }); * // Use in your Lambda function * const example = new aws.lambda.Function("example", { * code: new pulumi.asset.FileArchive("function.zip"), * name: "cross_account_example", * role: lambdaRole.arn, * handler: "index.handler", * runtime: aws.lambda.Runtime.NodeJS24dX, * layers: [sharedLayer.then(sharedLayer => sharedLayer.arn)], * }); * ``` * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * // Reference a layer ARN without version (requires ListLayerVersions permission) * const latestShared = aws.lambda.getLayerVersion({ * layerVersionArn: "arn:aws:lambda:us-east-1:123456789012:layer:shared-utilities", * }); * ``` */ export declare function getLayerVersionOutput(args?: GetLayerVersionOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output; /** * A collection of arguments for invoking getLayerVersion. */ export interface GetLayerVersionOutputArgs { /** * Specific architecture the layer version must support. Only valid with `layerName`. Conflicts with `version` and `layerVersionArn`. If specified, the latest available layer version supporting the provided architecture will be used. */ compatibleArchitecture?: pulumi.Input; /** * Specific runtime the layer version must support. Only valid with `layerName`. Conflicts with `version` and `layerVersionArn`. If specified, the latest available layer version supporting the provided runtime will be used. */ compatibleRuntime?: pulumi.Input; /** * Name of the Lambda layer. One of `layerName` or `layerVersionArn` is required. */ layerName?: pulumi.Input; /** * ARN of the Lambda layer version. Can be a full ARN with version (e.g., `arn:aws:lambda:region:account:layer:name:1`) or without version (e.g., `arn:aws:lambda:region:account:layer:name`). When the version is omitted, the latest version will be retrieved (requires `lambda:ListLayerVersions` permission). Use the full ARN with version for cross-account layers where you don't have list permissions. One of `layerName` or `layerVersionArn` is required. */ layerVersionArn?: pulumi.Input; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input; /** * Specific layer version. Only valid with `layerName`. Conflicts with `compatibleRuntime`, `compatibleArchitecture`, and `layerVersionArn`. If omitted, the latest available layer version will be used. */ version?: pulumi.Input; } //# sourceMappingURL=getLayerVersion.d.ts.map