@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
216 lines • 7.6 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLayerVersionOutput = exports.getLayerVersion = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* 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.NodeJS20dX,
* 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);
* ```
*/
function getLayerVersion(args, opts) {
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invoke("aws:lambda/getLayerVersion:getLayerVersion", {
"compatibleArchitecture": args.compatibleArchitecture,
"compatibleRuntime": args.compatibleRuntime,
"layerName": args.layerName,
"region": args.region,
"version": args.version,
}, opts);
}
exports.getLayerVersion = getLayerVersion;
/**
* 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.NodeJS20dX,
* 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);
* ```
*/
function getLayerVersionOutput(args, opts) {
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invokeOutput("aws:lambda/getLayerVersion:getLayerVersion", {
"compatibleArchitecture": args.compatibleArchitecture,
"compatibleRuntime": args.compatibleRuntime,
"layerName": args.layerName,
"region": args.region,
"version": args.version,
}, opts);
}
exports.getLayerVersionOutput = getLayerVersionOutput;
//# sourceMappingURL=getLayerVersion.js.map