AWS Terraform aws_cur_report_definition 挂了这么久

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

运行 Terraform,在尝试运行 terraform apply 和 create

aws_cur_report_definition
时挂起。请参阅下面的代码:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "5.42.0"
    }
  }
}

provider "aws" {
  profile = "xxxxxxxxx"
  region =  "eu-west-1"
}
    
resource "aws_cur_report_definition" "cost_and_usage_report" {
  report_name                = "my_cost_and_usage_report_test"
  time_unit                  = "HOURLY"
  format                     = "Parquet"
  compression                = "Parquet"
  additional_schema_elements = ["RESOURCES"]
  s3_bucket                  = "cur-grafana-test"
  s3_region                  = "us-east-1" 
  additional_artifacts       = ["ATHENA"]
  s3_prefix                  = "/test"
  report_versioning          = "OVERWRITE_REPORT"
}

尝试为现有数据创建数据时遇到同样的问题

aws_cur_report_definition

花了超过 9 分钟,什么也没有出现,terraform apply 只是挂着

data.aws_cur_report_definition.report_definition:仍在阅读... [已过去 6 分 31 秒] data.aws_cur_report_definition.report_definition:仍在阅读... [已过去 6 分 41 秒] data.aws_cur_report_definition.report_definition:仍在阅读... [6 分 51 秒过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [7分钟过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [7 分 11 秒过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [7 分 21 秒过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [7分31秒过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [7 分 41 秒过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [7分51秒过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [8分钟过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [8 分 11 秒过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [8 分 21 秒过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [8分31秒过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [已过 8 分 41 秒] data.aws_cur_report_definition.report_definition:仍在阅读... [8分51秒过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [9分钟过去了] data.aws_cur_report_definition.report_definition:仍在阅读... [9 分 11 秒过去了]

amazon-web-services terraform terraform-provider-aws
1个回答
0
投票

这里有两件事需要注意:

  1. 您的提供程序配置正在使用
    eu-west-1
    ,这意味着在未指定提供程序别名的情况下创建的任何资源都是使用现有提供程序配置创建的
  2. 如果您仔细查看资源文档(文档顶部的注释),它会显示以下内容:

注意:AWS 成本和使用情况报告服务目前仅在

us-east-1
中可用。

这进一步意味着您需要为

us-east-1
区域创建一个提供程序别名并将其与资源一起使用,如下所示:

provider "aws" {
  profile = "xxxxxxxxx"
  region  = "us-east-1"
}

provider "aws" {
  alias   = "us-east-1"
  profile = "xxxxxxxxx"
  region  = "us-east-1"
}

resource "aws_cur_report_definition" "cost_and_usage_report" {
  provier                    = aws.us-east-1
  report_name                = "my_cost_and_usage_report_test"
  time_unit                  = "HOURLY"
  format                     = "Parquet"
  compression                = "Parquet"
  additional_schema_elements = ["RESOURCES"]
  s3_bucket                  = "cur-grafana-test"
  s3_region                  = "us-east-1" 
  additional_artifacts       = ["ATHENA"]
  s3_prefix                  = "/test"
  report_versioning          = "OVERWRITE_REPORT"
}
© www.soinside.com 2019 - 2024. All rights reserved.