8000 updating gcore_volume's image_id reports error · Issue #38 · G-Core/terraform-provider-gcore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
< 8000 /div>

updating gcore_volume's image_id reports error #38

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

Open
idy opened this issue Sep 27, 2023 · 1 comment
Open

updating gcore_volume's image_id reports error #38

idy opened this issue Sep 27, 2023 · 1 comment
Labels

Comments

@idy
Copy link
idy commented Sep 27, 2023

terraform version

Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/g-core/gcore v0.3.82

config file

terraform {
  required_providers {
    gcore = {
      source = "G-Core/gcore"
    }
  }
}

provider "gcore" {
  permanent_api_token = <API_TOKEN>
}

variable "gcore_project_id" {
  type    = number
  default =<PROJECT>
}

variable "gcore_regions" {
  type = list(string)
  default = [
    "Luxembourg-2",
  ]
}

variable "instances" {
  type = list(object({
    name        = string
    region      = string
    flavor_id   = string
    volumn_type = string
  }))
  default = [
    {
      name        = "testing-lux-1"
      region      = "Luxembourg-2"
      flavor_id   = "g1-standard-2-4"
      volumn_type = "ssd_hiiops"
    },
  ]
}

data "gcore_region" "region_ids" {
  for_each = toset(var.gcore_regions)
  name     = each.key
}

data "gcore_image" "ubuntu" {
  for_each = toset(var.gcore_regions)

  project_id = var.gcore_project_id
  region_id  = data.gcore_region.region_ids[each.key].id
  name       = "ubuntu-20.04-x64"
}

resource "gcore_reservedfixedip" "public" {
  for_each = {
    for instance in var.instances : instance.name => instance
  }

  project_id = var.gcore_project_id
  region_id  = data.gcore_region.region_ids[each.value.region].id
  type       = "external"
  is_vip     = false
}

resource "gcore_volume" "system_volumns" {
  for_each = {
    for instance in var.instances : instance.name => instance
  }

  project_id = var.gcore_project_id
  region_id  = data.gcore_region.region_ids[each.value.region].id
  name       = "System"
  type_name  = each.value.volumn_type
  size       = 20
  image_id   = data.gcore_image.ubuntu[each.value.region].id
}

resource "gcore_instance" "servers" {
  for_each = {
    for instance in var.instances : instance.name => instance
  }

  project_id = var.gcore_project_id
  region_id  = data.gcore_region.region_ids[each.value.region].id
  name       = each.value.name
  flavor_id  = each.value.flavor_id

  volume {
    source     = "existing-volume"
    volume_id  = gcore_volume.system_volumns[each.key].id
    boot_index = 0
  }
  interface {
    type    = "reserved_fixed_ip"
    port_id = gcore_reservedfixedip.public[each.key].port_id
  }
}

reproduce steps

  1. run terraform apply with the above config file, it reports 3 resources created and everything is OK.
  2. change gcore_image to ubuntu-22.04-x64 and run terraform apply, then terraform will destroy 1 resource, create 1 resource and change 1 resource.

An error occurred while executing the terraform apply command.

gcore_volume.system_volumns["testing-lux-1"]: Destroying... [id=bc562b75-780d-4d0b-a2b4-5ce2eb70a754]

│ Error: task is in error state: ERROR. Error: Invalid volume: Volume  must not be migrating, attached, belong to a group, have snapshots or be disassociated from snapshots after volume transfer. (HTTP 400) (Request-ID: req-6dc67ba9-28b8-48ac-b0f9-616852e5b9c1)
@daragok
Copy link
Collaborator
daragok commented Sep 27, 2023

thank you for reporting the issue. We currently do not handle an image change correctly. Please re-create the instance with the new image ID in the boot volume as a workaround. We have a Bug in our backlog related to this issue, it will be resolved at some point in the future

@daragok daragok added the Cloud label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants
0