13 May 2026 11:28 AM
Hi!
I would like to import state of a set of configurations directly to my backend (s3 bucket / azurerm) but I cannot see any way of tweaking this.
Any suggestions?
02 Jun 2026 05:43 AM
Hi @tarjei
You have two options:
Configure the backend first → run terraform init → then terraform import (this writes directly to remote state)
Or import locally and migrate using terraform init -migrate-state
Backend is just storage — all state operations must go through Terraform CLI.
Refer this link for more details
How to Import Resources into a Remote State Managed by Terraform Cloud – HashiCorp Help Center
Thanks,
Sujit
02 Jun 2026 02:38 PM
Hi,
I agree with @sujit_k_singh here.
The remote backend, such as S3 or AzureRM, is only the storage layer for the Terraform state. Terraform does not support safely “pushing” or importing resources directly into the backend state file outside of the normal Terraform workflow.
The usual approach would be:
Alternatively, if the import was already done locally, you can configure the remote backend afterwards and migrate the state with:
terraform init -migrate-state
So in short: don’t edit/upload the state manually to S3/AzureRM. Let Terraform CLI manage the state operations.
Featured Posts