运行 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 秒过去了]
这里有两件事需要注意:
注意: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"
}