Error : terraspace plan - Backend Init required

Hello everyone,

does anyone have the same “problem”. I use in my project output helper like the follow in the tfvars files and i get the follow error message against my states

I use terraspace 1.17.

Thanks for any hint.

###########

vpc_id = <%= output("vpc.vpc_id") %>

############

Error running: cd /mnt/c/**/**/.terraspace-cache/**/**/stacks/vpc && terraform state pull > /tmp/terraspace/remote_state/stacks/vpc/state.json
Please fix the error before continuing
╷
│ Error: Backend initialization required, please run "terraform init"
│
│ Reason: Unsetting the previously set backend "s3"
│
│ The "backend" is the interface that Terraform uses to store state,
│ perform operations, etc. If this message is showing up, it means that the
│ Terraform configuration you're using is using a custom configuration for
│ the Terraform backend.
│
│ Changes to backend configurations require reinitialization. This allows
│ Terraform to set up the new configuration, copy existing state, etc. Please run
│ "terraform init" with either the "-reconfigure" or "-migrate-state" flags to
│ use the current configuration.
│
│ If the change reason above is incorrect, please verify your configuration
│ hasn't changed and try again. At this point, no changes to your existing
│ configuration or state have been made.
╵ 

Best regards

Wondering if the same error message appears if you try to manually cd into the .terraspace-cache/**/**/stacks/vpc folder and running terraform state pull.

Terraspace should automatically retry a terraform init if there’s an init error. Though, if it cant run manually then the automatic retry won’t help.

Also, if possible, a repo with a small reproducible example helps. Thanks.

Hello Tung,
thank you very much for your fast reply. In preparation for an example i found my personal issue, in a module there was in ${module}/examples/tfvars/example.tfvars

there are included output helper for reuse in other projects.

After rename the example.tfvars to example.tfvars.example and it works :slight_smile:

We can close the topic :slight_smile:

Best Regards

1 Like