Failed to Decode Current Backend Config Error When Doing Terraform Destroy

I encounter this error when doing terraform destroy

When using the suggested command terraform init -reconfigure the issue is resolved but I get instead this warning every time now.

However, I didn't change anything in this code. Is it the conflict of Terraform version?

Thank you very much in advance.

1 Answer

Terraform is reporting this warning because your child module in ../modules/geotwin_service includes a backend "gcs" block, but backend configurations are relevant only in the root module of a Terraform configuration.

This warning is new in recent versions of Terraform, but prior versions of Terraform also ignored this backend configuration. The only change is that Terraform now explicitly warns about it rather than ignoring it silently, because otherwise it can be confusing as to why Terraform is not making any use of that backend configuration.

Given that you were able to run terraform init -reconfigure successfully I expect that you also have a backend "gcs" block in your root module, which is the one Terraform is using here. Given that, you might consider removing the unused backend "gcs" block from ../modules/geotwin_service, although that would be safe to do only if that module is used exclusively as a child module, and never directly as a root module.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest