Provider produced inconsistent final plan on aws_lambda_function {source_code_hash}

Terraform v0.15.0
on linux_amd64

I am getting " Error: Provider produced inconsistent final plan "

Some brief scenario, I had successfully applied the operation using source_code_hash = "{data.archive_file.zip.output_base64sha256} " method.
Due to hashing replacement without any changes on the script ( main.py ), I decided to change my syntax to filebase64sha256(“{data.archive_file.zip.output_path}”).

With this action, I am getting an error as below {fyi: plan works but apply return error as below}:
│ When expanding the plan for
│ module.xxxxx.aws_lambda_function.lambda-function to include new values
│ learned so far during apply, provider “registry.terraform.io/hashicorp/aws
│ produced an invalid new value for .source_code_hash: was
│ cty.StringVal(“xxxxx”), but now
│ cty.StringVal(“xxxx”).

│ This is a bug in the provider, which should be reported in the provider’s
│ own issue tracker.

To resolve this issue, I need to delete the existing lambda and create lambda again with the new syntax, which something that I cannot afford to produce on production environment.

Please advise/help to resolve this error. Thank you

Hey, I am facing the exact same issue and did anybody find a fix for this?

@HarshaR,

The cause of this can vary by configuration, so you should probably start a new topic with the error and relevant configuration. If it helps, the problem is not usually the resource which is showing the error, but rather something providing that resource with the incorrect data. In the example above it’s probably the source of the .source_code_hash from another resource (though that is an old version of Terraform, so there are a few other possibilities).

You can also check the logs for warnings about the value in question, where legacy providers are generating incorrect values but must be allowed for backwards compatibility.

Hello, I am also facing the same issue from past few days. It was working just fine before that. Any solution?