# Terraform provider backend state

**URL:** <https://community.dynatrace.com/t/terraform-provider-backend-state/55892>\
**Category:** Automations\
**Tags:** terraform, automations\
**Created:** [May 13, 2026, 10:28am UTC](https://community.dynatrace.com/t/terraform-provider-backend-state/55892 "2026-05-13T10:28:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tarjei](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/tarjei/32/39196_2.png) [@tarjei](https://community.dynatrace.com/u/tarjei)\
**Post date:** [May 13, 2026, 10:28am UTC](https://community.dynatrace.com/t/terraform-provider-backend-state/55892/1 "2026-05-13T10:28:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![sujit\_k\_singh](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sujit\_k\_singh](https://community.dynatrace.com/u/sujit_k_singh)\
**Post date:** [June 2, 2026, 4:43am UTC](https://community.dynatrace.com/t/terraform-provider-backend-state/55892/2 "2026-06-02T04:43:51Z")

</div>

Hi&nbsp;[@tarjei](https://community.dynatrace.com/user/12960)

Terraform doesn’t support directly importing state into a backend (S3/AzureRM) outside of its normal workflow.

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](https://support.hashicorp.com/hc/en-us/articles/360061289934-How-to-Import-Resources-into-a-Remote-State-Managed-by-Terraform-Cloud)

Thanks,

Sujit

---

<div class="post-metadata">

**Author:** ![t\_pawlak](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/t_pawlak/32/14991_2.png) [@t\_pawlak](https://community.dynatrace.com/u/t_pawlak)\
**Post date:** [June 2, 2026, 1:38pm UTC](https://community.dynatrace.com/t/terraform-provider-backend-state/55892/3 "2026-06-02T13:38:42Z")

</div>

Hi,

I agree with [@sujit\_k\_singh](https://community.dynatrace.com/user/67382)&nbsp;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:

1. Configure the backend first.
2. Run terraform init
3. Run terraform import or use import blocks.
4. Let Terraform write the imported resources into the configured remote state.

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.

---

<div class="post-metadata">

**Author:** ![tarjei](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/tarjei/32/39196_2.png) [@tarjei](https://community.dynatrace.com/u/tarjei)\
**Post date:** [June 4, 2026, 4:32pm UTC](https://community.dynatrace.com/t/terraform-provider-backend-state/55892/4 "2026-06-04T16:32:56Z")

</div>

Thank you both for your replies!

I am able to do the migrate state step / thing. But what I am asking for really is for the dt module to use whatever setting you have in the backend. Because if you do the export command it will place it in a local state file instead if a remote if this makes sense?
