【问题标题】:Terraform does not update AWS canary codeTerraform 不更新 AWS 金丝雀代码
【发布时间】:2022-07-28 00:08:10
【问题描述】:

我正在更改 AWS 金丝雀代码。

运行 terraform apply 后,我在新的 zip 文件中看到了更新,但在 AWS 控制台中,代码是旧的。

我做错了什么?

我的地形代码:

resource "aws_synthetics_canary" "canary" {
  depends_on           = [time_sleep.wait_5_minutes]
  name                 = var.name
  artifact_s3_location = "s3://${local.artifacts_bucket_and_path}"
  execution_role_arn   = aws_iam_role.canary_role.arn
  handler              = "apiCanary.handler"
  start_canary         = true
  zip_file             = data.archive_file.source_zip.output_path
  runtime_version      = "syn-nodejs-puppeteer-3.3"
  tags                 = {
    Description = var.description
    Entity      = var.entity
    Service     = var.service
  }

  run_config {
    timeout_in_seconds = 300
  }

  schedule {
    expression = "rate(${var.rate_in_minutes} ${var.rate_in_minutes == 1 ? "minute" : "minutes"})"
  }
}

我读了this,但对我没有帮助。

【问题讨论】:

    标签: amazon-web-services terraform amazon-cloudwatch


    【解决方案1】:

    这可能是您的部署角色的权限问题。您的角色必须有权修改金丝雀后面的 lambda,才能应用您的 zip 文件更改创建的新层。

    很遗憾,对 lambda 进行更改时出现的任何错误都不会通过 terraform 或 AWS 控制台中的任何位置传达。

    但是,如果您有权访问 AWS CLI,请运行 aws synthetics get-canary --name <your canary name> 并检查 Status.StateReason。

    如果在尝试应用更改时出现权限问题,您应该会看到以下内容:

    <user> is not authorized to perform: lambda:UpdateFunctionConfiguration on resource: <lamdba arn>
    

    基于上述内容,您应该能够将任何缺少的权限添加到您的部署角色 iam 策略中。

    【讨论】:

      猜你喜欢
      • 2022-10-12
      • 2022-06-28
      • 1970-01-01
      • 2020-10-10
      • 1970-01-01
      • 2018-02-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-01
      相关资源
      最近更新 更多