属性"bucket_arn"的值不合适:在地形中创建 AWS 消防水带资源时需要字符串



我试图在这里学习地形,但在创建AWS资源时遇到了一些问题。

我正在尝试创建AWS消防软管交付流,但在尝试生成计划时出错。

我试图将我创建的角色和s3责任传递给消防队资源,但出现了错误。

提前谢谢。

terraform {
required_version = ">=0.12.0" 
}
provider "aws" {
version = "~> 2.0"
region = "ap-south-1"
}
data "aws_caller_identity" "current" {}
resource "aws_s3_bucket" "bucket1" {
bucket = "${data.aws_caller_identity.current.account_id}-kinesis-firehose-bucket1"
}
resource "aws_iam_role" "firehose_role" {
name = "firehose_test_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "firehose.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]  
}
EOF
}
resource "aws_kinesis_firehose_delivery_stream" "test_stream" {
name = "big-data-cert-delivery-stream"
destination = "s3"
s3_configuration {
role_arn = "${aws_iam_role.firehose_role}"
bucket_arn = "${aws_s3_bucket.bucket1}"
} 
}

Error: Incorrect attribute value type
on kinesis-stream.tf line 41, in resource "aws_kinesis_firehose_delivery_stream" "test_stream":
41:         role_arn = "${aws_iam_role.firehose_role}"
|----------------
| aws_iam_role.firehose_role is object with 13 attributes
Inappropriate value for attribute "role_arn": string required.

Error: Incorrect attribute value type
on kinesis-stream.tf line 42, in resource "aws_kinesis_firehose_delivery_stream" "test_stream":
42:         bucket_arn = "${aws_s3_bucket.bucket1}"
|----------------
| aws_s3_bucket.bucket1 is object with 25 attributes
Inappropriate value for attribute "bucket_arn": string required.

在resource(iam-role,s3bucket(末尾添加.arn是有效的。

required_version = ">=0.12.0" 
}
provider "aws" {
version = "~> 2.0"
region = "ap-south-1"
}
data "aws_caller_identity" "current" {}
resource "aws_s3_bucket" "bucket1" {
bucket = "${data.aws_caller_identity.current.account_id}-kinesis-firehose-bucket1"
}
resource "aws_iam_role" "firehose_role" {
name = "firehose_test_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "firehose.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]  
}
EOF
}

resource "aws_kinesis_firehose_delivery_stream" "test_stream" {
name = "big-data-cert-delivery-stream"
destination = "s3"
s3_configuration {
role_arn = aws_iam_role.firehose_role.arn
bucket_arn = aws_s3_bucket.bucket1.arn
} 
}

相关内容

  • 没有找到相关文章