ionos-cloud / terraform-provider-profitbricks

Terraform ProfitBricks provider
https://www.terraform.io/docs/providers/profitbricks/
Mozilla Public License 2.0
3 stars 16 forks source link

[BUG] Creating a Server can't use snapshots by UUID #84

Open jbuchhammer opened 3 years ago

jbuchhammer commented 3 years ago

Terraform Version

Terraform v0.13.3

Affected Resource(s)

profitbricks_server

Terraform Configuration Files

resource "profitbricks_server" "web" {
  name              = "Web Server"
  datacenter_id     = profitbricks_datacenter.acmeo_tenant.id
  cores             = var.web_cpus
  ram               = var.web_ram
  cpu_family        = "INTEL_XEON"
  availability_zone = "AUTO"

  volume {
    name           = "Web Server boot"
    size           = 8
    disk_type      = "HDD"
    availability_zone = "AUTO"
  }
  image_name     = <Snapshot-UUID> 
  nic {
    lan             = profitbricks_lan.tenant_lan.id
    dhcp            = true
  }
}

Expected Behavior

A snaphot's UUID can be provided for the property image_name to set up a server.

Actual Behavior

terraform apply exits with an error (line 419 ff):

return fmt.Errorf("Error fetching image %s: (%s) - %+v", image_name, err, rsp)

Steps to Reproduce

  1. terraform apply

Important Factoids

This is simply due to the fact that the code exits if an image is not found for the specified UUID. It does not continue to the next steps (check HTTP 404 and look for a snapshot). Using a snapshot by name works instead.