The documentation describes source_hash as an alternative to etag when storing aws_s3_bucket_object. [aws_s3_bucket_object | Resources | hashicorp/aws | Terraform Registry]
The issue is etag is unreliable in a number of circumstances and using etag to prevent unnecessary updates will not work.
source_hash is the documented alternative, but I cannot get the syntax correct:
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")
}
Results:
│ 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.
Is my syntax wrong. My configuration:
Terraform v1.1.4
on windows_386
+ provider registry.terraform.io/hashicorp/aws v3.37.0