Reputation: 5038
Terraform documentation describes source_hash as an alternative to etag when storing aws_s3_bucket_object. https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_object#source_hash
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
Upvotes: 1
Views: 1387
Reputation: 28774
The source_hash
argument for the aws_s3_bucket_resource_object
was implemented in version 3.50.0 of the provider: CHANGELOG. You will need to update the provider from 3.37.0
to ~> 3.50
accordingly.
Upvotes: 2