antonbabenko / pre-commit-terraform

pre-commit git hooks to take care of Terraform configurations 🇺🇦
MIT License
3.17k stars 537 forks source link

[tf aws provider version] terraform_validate false negative on `aws_kinesis_firehose_delivery_stream.extended_s3_configuration.file_extension` #659

Closed TiansuYu closed 5 months ago

TiansuYu commented 5 months ago

Describe the bug

pre-commit hook terraform_validate falsely flag the attribute aws_kinesis_firehose_delivery_stream.extended_s3_configuration.file_extensionas Unsupported argument:

Validation failed: .
╷
│ Error: Unsupported argument
│ 
│   on main.tf line 38, in resource "aws_kinesis_firehose_delivery_stream" "extended_s3_streams":
│   38:     file_extension      = "some_value"
│ 
│ An argument named "file_extension" is not expected here.

How can we reproduce it?

create a firehose stream e.g. w/

resource "aws_kinesis_firehose_delivery_stream" "extended_s3_stream" {
  name        = "some-firehose-stream"
  destination = "extended_s3"
  extended_s3_configuration {
    role_arn            = "some-role"
    bucket_arn          = "some-bucket"
    prefix              = "some-prefix"
    file_extension      = ".json.gz"
}}

and run the pre-commit hook

Environment information

yermulnik commented 5 months ago

Are you running pre-commit-terraform as Docker container or not? In the latter case, please provide output of terraform version command from the same directory where validated resource is based in.

yermulnik commented 5 months ago

What I mean is that this most probably has nothing to do with pre-commit-terarform, but is related to your local setup. The file_extension attribute under extended_s3_configuration block was added in v5.39.0 of Terraform provider for AWS. If you have lower version of the provider installed locally, then the error.

TiansuYu commented 5 months ago

@yermulnik Thanks for pointing that out, I wasn't expecting that to be a minor version issue, this solved the problem once I pinned a higher provider version. Thanks a lot!