Skip to main content
Crusoe Support Help Center home page
Crusoe

How-To Migrate crusoe_ib_partition to crusoe_transport_partition in Terraform using moved {} block

Rishabh Sinha
Rishabh Sinha
Updated

Introduction

Starting with Crusoe Terraform provider v1.3.0, crusoe_ib_partition is deprecated in favor of crusoe_transport_partition. Both resource types manage the same InfiniBand / RoCE partition in Crusoe Cloud.

This guide shows how to rename the resource in Terraform without destroying the partition. That matters if VMs or Kubernetes node pools are already attached to it — destroying a partition detaches everything on it.

Terraform treats a change of resource type as a different resource, so editing the type alone plans a destroy + create. A moved {} block tells Terraform the resource was renamed rather than replaced, so the existing partition is carried over in state and nothing is recreated.

⚠️ Warning: Use provider v1.4.0 or later. Earlier versions (v1.3.0 / v1.3.1) do not support moved {} for this rename — on those versions the plan plans a destroy + create, which deletes the existing partition.

Prerequisites

  • Terraform CLI 1.8 or Later
  • Crusoe Terraform Provider v1.4.0 or Later
  • Crusoe Credentials Configured in ~/.crusoe/config (or CRUSOE_ACCESS_KEY_ID / CRUSOE_SECRET_KEY)
  • An Existing Partition Currently Managed as crusoe_ib_partition

Instructions

Step 1: Pin the Provider to v1.4.0

terraform {
  required_providers {
    crusoe = {
      source  = "crusoecloud/crusoe"
      version = ">= 1.4.0"
    }
  }
}

Then run:

terraform init -upgrade

Step 2: Note the Current Resource

Example of the deprecated resource:

resource "crusoe_ib_partition" "example" {
  name          = "my-ib-partition"
  ib_network_id = "<network-id>"
}

Keep the same partition name and the same network ID. Only the resource type and the attribute name change (ib_network_id becomes transport_network_id).

You can list networks with:

crusoe networking transport-networks list

ℹ️ Note: crusoe networking ib-networks list is deprecated. It prints the same list with a deprecation warning.

Step 3: Switch to crusoe_transport_partition and Add a moved Block

Replace the old resource with:

resource "crusoe_transport_partition" "example" {
  name                 = "my-ib-partition"
  transport_network_id = "<network-id>"
}

moved {
  from = crusoe_ib_partition.example
  to   = crusoe_transport_partition.example
}

Update the from and to addresses to match your own resource names, including module prefixes if the resource lives inside a module.

Step 4: Plan First — Do Not Apply a Destroy

terraform plan

A successful plan looks like this:

# crusoe_ib_partition.example has moved to crusoe_transport_partition.example
    resource "crusoe_transport_partition" "example" {
        id   = "<existing-partition-id>"
        name = "my-ib-partition"
        # (unchanged attributes hidden)
    }

Plan: 0 to add, 0 to change, 0 to destroy.

⚠️ Warning: If the plan reports 1 to add, 1 to destroy, stop and do not apply — applying would delete the live partition and detach everything attached to it.

If you see a destroy in the plan, check that:

  • The provider version is v1.4.0 or later
  • The moved block's from and to addresses match the old and new resources
  • transport_network_id is the same network as the previous ib_network_id

Step 5: Apply the Move

terraform apply

Expected result:

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

The partition ID does not change. Attached VMs and node pools stay on that partition.

After a successful apply, you can leave the moved block in place or remove it. Either is valid.

Example

You already manage a partition as crusoe_ib_partition and want to switch to crusoe_transport_partition without deleting it.

1. Starting config (main.tf)

terraform {
  required_providers {
    crusoe = {
      source  = "crusoecloud/crusoe"
      version = "1.4.0"
    }
  }
}

resource "crusoe_ib_partition" "repro" {
  name          = "repro-test-v140"
  ib_network_id = "<network-id>"
}

2. Initialize and apply (creates the partition if it does not exist yet; if it already exists, import it first)

terraform init
terraform apply -auto-approve

Output:

# crusoe_ib_partition.repro will be created
+ resource "crusoe_ib_partition" "repro" {
    + ib_network_id = "<network-id>"
    + id            = (known after apply)
    + name          = "repro-test-v140"
    + project_id    = (known after apply)
  }

Plan: 1 to add, 0 to change, 0 to destroy.
crusoe_ib_partition.repro: Creating...
crusoe_ib_partition.repro: Creation complete after 0s [id=4b280065-51e9-4ca7-9742-4a29d1cc4311]

Warning: Deprecated
This is deprecated as of provider version v1.3.0 and will be removed in the next major version.
Use the `crusoe_transport_partition` resource instead.

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Note the partition ID. It must stay the same after the move.

3. Change the config — same name, same network ID, new resource type, plus a moved block

terraform {
  required_providers {
    crusoe = {
      source  = "crusoecloud/crusoe"
      version = "1.4.0"
    }
  }
}

resource "crusoe_transport_partition" "repro" {
  name                 = "repro-test-v140"
  transport_network_id = "<network-id>"
}

moved {
  from = crusoe_ib_partition.repro
  to   = crusoe_transport_partition.repro
}

4. Plan

terraform plan

Output (success):

# crusoe_ib_partition.repro has moved to crusoe_transport_partition.repro
    resource "crusoe_transport_partition" "repro" {
        id                   = "4b280065-51e9-4ca7-9742-4a29d1cc4311"
        name                 = "repro-test-v140"
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 0 to change, 0 to destroy.

If the plan reports 1 to add, 1 to destroy, do not apply — that would delete the existing partition.

5. Apply

terraform apply

Output:

# crusoe_ib_partition.repro has moved to crusoe_transport_partition.repro
    resource "crusoe_transport_partition" "repro" {
        id                   = "4b280065-51e9-4ca7-9742-4a29d1cc4311"
        name                 = "repro-test-v140"
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 0 to change, 0 to destroy.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Done. Same partition ID (4b280065-51e9-4ca7-9742-4a29d1cc4311), and nothing was destroyed or recreated. You can leave the moved block in the config or remove it after this apply.

Common Issues

Error: Unable to Move Resource State

  • Cause: Provider v1.3.0 or v1.3.1 — crusoe_transport_partition did not implement moved support.
  • Solution: Upgrade to provider v1.4.0 or later and run terraform init -upgrade.

Plan Shows a Destroy of crusoe_ib_partition and a Create of crusoe_transport_partition

  • Cause: The resource type was changed without a moved block, or the moved addresses do not match.
  • Solution: Add a moved block as in Step 3. Do not apply the destroy/create plan.

Plan Still Wants to Replace After a Correct moved Block

  • Cause: The name or network ID in the new resource does not match the existing partition.
  • Solution: Keep the same name and use the same network ID (the ib_network_id value becomes transport_network_id).

Additional Resources

Related Articles

Related to

Was this article helpful?

0 out of 0 found this helpful

Still need help?

Our support team is ready to assist you with any questions.

Have more questions? Submit a request

Related Articles

Recently Viewed

Comments

0 comments

Article is closed for comments.