Skip to content

Malformed config.tf file when first creating backend layer #321

Description

@juanmatias

Describe the Bug

When crating a fresh backend layer, the s3 key must be commented out and init must be done with leverage tofu init --skip-validation.

The process fails as follows:

 ❯ leverage tofu init --skip-validation
[18:28:59.333] ERROR    Malformed config.tf file. Unable to parse.

Expected Behavior

The backend layer should be correctly initialized, so it can be applied and then, with command leverage tofu init the backend should be migrated to the newly created bucket.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a new backend layer
  2. Go to to the new layer
  3. Ensure s3 key is commented out in the config.tf file
  4. Run leverage tofu init --skip-validation
  5. See error as described above

Environment (please complete the following information):

Anything that will help us triage the bug will help. Here are some ideas:

❯ leverage --version
leverage, version 3.0.0
❯ uname -s -r -v -m -o
Linux 7.1.5-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sun, 26 Jul 2026 00:48:55 +0000 x86_64 GNU/Linux
❯ python --version                                                                                                    
Python 3.14.6                    
❯ tofu --version                                                                   
OpenTofu v1.10.8                                                                     

Additional Context

Additional analysis and possible fix added as comment.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingfix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions