繁体   English   中英

如何使用 terraform 为 aws lambda 指定 dotnet 6 运行时?

[英]How to specify the dotnet 6 runtime for aws lambda, using terraform?

我可以在我的 terraform 中使用此输入部署 dotnetcore3.1 运行时(从 GitLab CI 管道执行):


variable "runtime" {
  type = string
  default = "dotnetcore3.1"
}

部署后,我可以手动将运行时从 .NET Core 3.1 更改为 .NET 6:

在此处输入图像描述

但是我如何在 terraform 中指定 .NET 6 开始呢?

我努力了:


variable "runtime" {
  type = string
  default = "dotnet6"
}

但我在管道中收到以下错误:

Error: expected runtime to be one of [nodejs nodejs4.3 nodejs6.10 nodejs8.10 nodejs10.x nodejs12.x nodejs14.x java8 java8.al2 java11 python2.7 python3.6 python3.7 python3.8 dotnetcore1.0 dotnetcore2.0 dotnetcore2.1 dotnetcore3.1 nodejs4.3-edge go1.x ruby2.5 ruby2.7 provided provided.al2], got dotnet6

select .NET 6 如何在 TF 中运行?

Terraform 似乎不支持 .NET 6。

这并不完全正确,AWS 提供商支持dotnet6运行时,您只需要有一个支持它的提供商版本。

目前最新版本的 AWS 提供商是4.27.0 dotnet6的支持是在4.4.0版本左右引入的。 将提供程序调整为高于4.4.0的版本应该足以支持dotnet6

因此,将您的required_providers块修改为如下所示:

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = ">=4.4.0"
    }
  }
}

dotnet6工作得很好。

我怀疑您的 TF 版本和/或 AWS 提供商已过时。 我将dotnet6用于 lmabda,以下内容很好。

"terraformVersions": {
    "terraformMajorVersion": "1",
    "providerVersions": {
        "aws": "4.14.0",
    }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM