Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider created content_library_vm_template successfully but produced an unexpected new value. #18

Open
Xiritianming opened this issue Sep 5, 2024 · 0 comments · May be fixed by #20

Comments

@Xiritianming
Copy link

Terraform Version

Terraform v1.9.5
on darwin_arm64

Provider Version

0.1.9

Affected Resource(s)

  • resource_content_library_vm_template

Terraform Configuration Files

terraform {
  required_providers {
    cloudtower = {
      version = "~> 0.1.9"
      source  = "registry.terraform.io/smartxworks/cloudtower"
    }
  }
}

locals {
  GB = 1024 * local.MB
  MB = 1024 * local.KB
  KB = 1024
}

provider "cloudtower" {
  username          = var.cloudtower_user
  password          = var.cloudtower_password
  user_source       = var.cloudtower_user_source
  cloudtower_server = var.cloudtower_server
}

data "cloudtower_cluster" "cluster" {
  name = "XXX"
}

data "cloudtower_vlan" "vm_vlan" {
  name       = "default"
  type       = "VM"
  cluster_id = data.cloudtower_cluster.cluster.clusters[0].id
}

resource "cloudtower_vm" "foo" {
  name          = "foo"
  vcpu          = 4
  cpu_cores     = 1
  cpu_sockets   = 4
  memory        = 8 * local.GB
  ha            = true
  firmware      = "BIOS"
  status        = "STOPPED" # clone to vm template need vm's status is `STOPPED`
  guest_os_type = "LINUX"
  cluster_id    = data.cloudtower_cluster.cluster.clusters[0].id


  disk {
    boot = 1
    bus  = "VIRTIO"
    vm_volume {
      storage_policy = "REPLICA_2_THIN_PROVISION"
      name           = "foo-1"
      size           = 40 * local.GB
    }
  }
  cd_rom {
    boot = 2
    iso_id = ""
  }

  nic {
    vlan_id = data.cloudtower_vlan.vm_vlan.vlans[0].id
  }
}

resource "cloudtower_content_library_vm_template" "foo-template-from-vm" {
  name                 = "foo-template-from-vm"
  cluster_id           = ["${data.cloudtower_cluster.cluster.clusters[0].id}"]
  cloud_init_supported = false
  src_vm_id            = cloudtower_vm.foo.id
}

Debug Output

Panic Output

cloudtower_content_library_vm_template.foo-template-from-vm: Creating...
╷
│Error:Provider produced inconsistent result after apply
│
│ When applying changes to cloudtower_content_library_vm_template.foo-template-from-vm, provider
│ "provider[\"registry.terraform.io/smartxworks/cloudtower\"]" produced an unexpected new value: Root object was
│ present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Expected Behavior

Provider should return success result.

Actual Behavior

Provider created content_library_vm_template successfully but produced an unexpected new value.

Steps to Reproduce

  1. terraform apply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant