Terraform:aws_s3_bucket_object "An argument named "source_hash“预计不会出现在这里。”

Terraform: aws_s3_bucket_object "An argument named "source_hash" is not expected here."

Terraform 文档将 source_hash 描述为存储 aws_s3_bucket_object 时 etag 的替代方法。 https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_object#source_hash

问题是 etag 在很多情况下都不可靠,使用 etag 来防止不必要的更新是行不通的。

source_hash 是记录在案的替代方案,但我无法获得正确的语法:

resource "aws_s3_bucket_object" "NessusAgent_0_1_x64_manifest" {
  bucket = aws_s3_bucket.SSMContent.id
  key    = "NessusAgent-10.0.1-x64/manifest.json"
  source = "../Infrastructure/NessusAgent-10.0.1-x64/manifest.json"
  server_side_encryption = "aws:kms"
  source_hash = filemd5("../Infrastructure/NessusAgent-10.0.1-x64/manifest.json")
}

结果:

│ Error: Unsupported argument
│
│   on ..\Infrastructure\aws_s3_bucket.SSMContent.tf line 32, in resource "aws_s3_bucket_object" "NessusAgent_0_1_x64_manifest":
│   32:   source_hash = filemd5("../Infrastructure/NessusAgent-10.0.1-x64/manifest.json")
│
│ An argument named "source_hash" is not expected here.

是我的语法错误吗。我的配置:

Terraform v1.1.4
on windows_386
+ provider registry.terraform.io/hashicorp/aws v3.37.0

aws_s3_bucket_resource_objectsource_hash 参数已在提供程序的版本 3.50.0 中实现:CHANGELOG。您需要相应地将提供商从 3.37.0 更新为 ~> 3.50