Skip to content

terraform хочет пересоздать ресурсы даже если их не изменять #5

Description

@baulinss

Созданы ресурсы с помощью кода ниже

Код:

terraform {
  required_providers {
    vmmanager6 = {
      source = "usaafko/vmmanager6"
      version = "0.0.34"
    }
  }
}

provider "vmmanager6" {
  pm_email    = "..."
  pm_password = "..."
  pm_api_url  = "..."
}

resource "vmmanager6_vm_qemu" "operator" {
  count    = 1
  cluster  = 1
  domain   = "test1.example.org"
  name     = "test1"
  os       = 282
  account  = 100002
  password = "password"
  cores    = 1
  memory   = 2048
  disk     = 20480

  vxlan {
    id    = vmmanager6_vxlan.test_vxlan2.id
    ipnet = vmmanager6_vxlan.test_vxlan2.ipnets[ 0 ].id
  }

}

resource "vmmanager6_vxlan" "test_vxlan2" {

  account  = 100002
  clusters = [ 1 ]
  name     = "test_vxlan2"
  ipnets {
    name    = "192.168.1.0/24"
    gateway = "192.168.1.1"
  }

}

Тераформ хочет пересоздать если сделать plan или apply

Версия:

PS C:\Terraform_VMM_test> .\terraform.exe --version
Terraform v1.10.5
on windows_amd64
+ provider registry.terraform.io/usaafko/vmmanager6 v0.0.34

Стейт:

PS C:\Terraform_VMM_test> .\terraform.exe show
# vmmanager6_vm_qemu.operator[0]:
resource "vmmanager6_vm_qemu" "operator" {
    account       = 100002
    anti_spoofing = true
    cluster       = 1
    cores         = 1
    cpu_mode      = "default"
    desc          = null
    disk          = 20480
    disk_id       = 199
    domain        = "test1.example.org"
    id            = "197"
    ip_addresses  = [
        {
            addr    = "192.168.1.2"
            domain  = "test1.example.org"
            family  = 2
            gateway = "192.168.1.1"
            id      = 189
            mask    = "255.255.255.0"
            netid   = 10
        },
    ]
    memory        = 2048
    name          = "test1"
    node          = 5
    os            = 282
    password      = (sensitive value)
    preset        = 0

    vxlan {
        id          = 11
        ipnet       = 10
        ipv4_number = 1
    }
}

# vmmanager6_vxlan.test_vxlan2:
resource "vmmanager6_vxlan" "test_vxlan2" {
    account  = 100002
    clusters = [
        1,
    ]
    comment  = null
    id       = "11"
    ippool   = 9
    name     = "test_vxlan2"

    ipnets {
        gateway = "192.168.1.1"
        id      = 10
        name    = "192.168.1.0/24"
    }
}

Не меняя код, делаем plan:

PS C:\Terraform_VMM_test> .\terraform.exe plan
vmmanager6_vxlan.test_vxlan2: Refreshing state... [id=11]
vmmanager6_vm_qemu.operator[0]: Refreshing state... [id=197]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # vmmanager6_vm_qemu.operator[0] must be replaced
-/+ resource "vmmanager6_vm_qemu" "operator" {
      ~ disk_id       = 199 -> (known after apply)
      ~ id            = "197" -> (known after apply)
      ~ ip_addresses  = [
          - {
              - addr    = "192.168.1.2"
              - domain  = "test1.example.org"
              - family  = 2
              - gateway = "192.168.1.1"
              - id      = 189
              - mask    = "255.255.255.0"
              - netid   = 10
            },
        ] -> (known after apply)
        name          = "test1"
      ~ node          = 5 -> 0 # forces replacement
        # (12 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions