Update to TF1.5 with ansible 2.8.0 gives error

I have something similar to this:

My existing set-up was with TF0.12 and and ansible 2.8.0 (both coming from our custom docker image) which was working fine.
I have now a new docker image with TF1.5 and ansible 2.8.0, and for this I am getting the same error as above thread.

Failed to validate Terraform configuration files. Failed to parse command-line flags flag provided but not defined: -var. Too many command line arguments. Expected at most one positional argument.

What can I do in my case here? The TF code is run via Jinja template like so:

{% for region in hostvars[inventory_hostname]['Active_Regions'] %}

module "datadog_log_shipper_{{ region }}" {
  providers = {
    aws = aws.{{ region }}
  }
  source                        = "./module/datadog-log-shipper"
  create                        = true  
  datadog_log_shipper_role_arn  = aws_iam_role.datadog_log_shipper_role.arn
  datadog_log_shipper_timeout   = 900
  datadog_api_key               = var.datadog_api_key
  
}

{% endfor %}

The .datadog_api_key is being passed via ansible.

Hi @devang.sanghani,

As with the other topic you linked to, this seems to be a problem with the software you are using to run Terraform rather than with Terraform itself

In preparation for Terraform v1.0 and the v1.x compatibility promises we fixed various situations where Terraform had been accepting but ignoring arguments that were inappropriate for particular situations, such as when providing planning options like -var to commands that don’t create plans. You seem to be running Terraform using something that was relying on those incorrect-but-formerly-ignored arguments, and so modern Terraform rejects the given command line.

I’m not very familiar with Ansible but I see in the other topic that the solution had been to switch to a different Terraform integration that had been updated to provide correct arguments as modern Terraform expects. Have you tried the same change on your system?

Unfortunately since this is a Terraform forum rather than an Ansible one I can’t promise that anyone who sees this topic will be familiar with the details of your system, but perhaps one of the other contributors will be able to suggest something more specific if the solution from the other topic is insufficient.

For anyone who comes here looking a solution to this error, it got resolved by downloading the latest Ansible version. Thanks for taking time and suggestion solutions.