【问题标题】:Tflocal: unsupported argument meteringmarketplaceTflocal:不支持的参数计量市场
【发布时间】:2022-08-18 17:02:04
【问题描述】:

我正在尝试在部署之前运行 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


    【解决方案1】:

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

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

    例如,我使用了 terraform 页面中的代码:

    主文件:

    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"
    }
    

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-23
      • 2021-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-16
      • 2021-06-27
      • 2011-07-28
      相关资源
      最近更新 更多