Tflocal:不支持的参数计量市场

问题描述 投票:0回答:2

我正在尝试运行 terraform-local 在部署之前测试我的模块。我在尝试本地运行堆栈时遇到错误:

错误:不支持的论点

在 localstack_providers_override.tf 第 67 行,提供程序“aws”中: 67:计量市场=“http://localhost:4566”

此处不应出现名为“meteringmarketplace”的参数。

对于上下文,我的 terraform 模板指定以下资源

  • 具有节点运行时的 lambda 函数
  • API 网关
  • Cloudwatch 日志组、IAM 角色、s3 对象和其他一些次要资源

我也在运行 terraform v1.2.7 和 terraform-local v1.2.7

知道如何修复此错误吗?

aws-lambda terraform aws-api-gateway terraform-provider-aws localstack
2个回答
1
投票

我得到了完全相同的错误。我假设 terraform-local 配置正在设置“meteringmarketplace”,但它实际上已经不存在了(我认为它已重命名?)。

一种可能性是直接自己进行本地配置,而不是使用 terraform-local 而是使用 terraform 进行覆盖,并让它在 localstack 上运行(https://github.com/localstack/localstack)。

举个例子,我使用了 terraform 页面中的代码:

main.tf:

provider "aws" {
  access_key                  = "mock_access_key"
  region                      = "us-east-1"
  s3_force_path_style         = true
  secret_key                  = "mock_secret_key"
  skip_credentials_validation = true
  skip_metadata_api_check     = true
  skip_requesting_account_id  = true

  endpoints {
    apigateway     = "http://localhost:4566"
    cloudformation = "http://localhost:4566"
    cloudwatch     = "http://localhost:4566"
    dynamodb       = "http://localhost:4566"
    es             = "http://localhost:4566"
    firehose       = "http://localhost:4566"
    iam            = "http://localhost:4566"
    kinesis        = "http://localhost:4566"
    lambda         = "http://localhost:4566"
    route53        = "http://localhost:4566"
    redshift       = "http://localhost:4566"
    s3             = "http://localhost:4566"
    secretsmanager = "http://localhost:4566"
    ses            = "http://localhost:4566"
    sns            = "http://localhost:4566"
    sqs            = "http://localhost:4566"
    ssm            = "http://localhost:4566"
    stepfunctions  = "http://localhost:4566"
    sts            = "http://localhost:4566"
  }
}

resource "aws_s3_bucket" "test-bucket" {
  bucket = "my-bucket"
}

如果您的本地堆栈使用默认设置运行,您应该能够针对它运行“terraform plan”。

也许这可以帮助您解决问题。


0
投票

我遇到了类似的错误。显然我的本地 Terraform 和 Terraform Local 没有正确符号链接。我通过自制程序安装。所以我必须跑

brew link --overwrite terraform-local

之后我就能够成功运行了

tflocal apply

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.