hashicorp/terraform

Error retrieving ID of template: json: cannot unmarshal object into Go struct field alias.childtemplates of type []interface {}

Closed this issue · 3 comments

Terraform Version

Terraform v0.12.18
+ provider.cloudstack v0.3.0

Terraform Configuration Files

variable "compute_template" {
  default = "debian9.4 stretch BUILD-1946"
}

variable "path_to_ssh_key" {
  default = "~/.ssh/id_rsa.pub"
}

variable "ssh_keypair_name" {
  default = "foo1_ssh_key"
}

variable "compute_offering" {
  default = "XS Instanz"
}

variable "zone" {
  default = "Enterprise_Internet_Bi"
}

variable "acl_items" {
  default = ["0.0.0.0/0"]
}

variable "vpc_offering" {
  default = "Default VPC Offering (512MB)"
}

variable "network_offering" {
  default = "NAT for VPC"
}

variable "cidr" {
  default = "10.0.1.0/24"
}

provider "cloudstack" {
  api_url    = var.api_url
  api_key    = var.api_key
  secret_key = var.secret_key
}

resource "cloudstack_ssh_keypair" "default" {
  name       = "foo1-ssh-key"
  public_key = file(var.path_to_ssh_key)
}

resource "cloudstack_vpc" "foo1-cluster" {
  name         = "foo1-terraform-vpc"
  cidr         = var.cidr
  vpc_offering = var.vpc_offering
  zone         = var.zone
}

resource "cloudstack_network_acl" "foo1-acl" {
  name   = "foo1 terraform acl"
  vpc_id = cloudstack_vpc.foo1-cluster.id
}

resource "cloudstack_network_acl_rule" "default" {
  acl_id = cloudstack_network_acl.foo1-acl.id

  rule {
    action       = "allow"
    cidr_list    = var.acl_items
    protocol     = "tcp"
    ports        = ["22"]
    traffic_type = "ingress"
  }
}

resource "cloudstack_network" "foo1-network" {
  name             = "foo1-terraform-network"
  network_offering = var.network_offering
  zone             = var.zone
  cidr             = var.cidr
  vpc_id           = cloudstack_vpc.foo1-cluster.id
  acl_id           = cloudstack_network_acl.foo1-acl.id
}

resource "cloudstack_instance" "foo1-vm" {
  name             = "foo1-virtual-machine"
  service_offering = var.compute_offering
  network_id       = cloudstack_network.foo1-network.id
  template         = var.compute_template
  zone             = var.zone
  expunge          = "true"
  keypair          = "foo1-ssh-key"
}

resource "cloudstack_ipaddress" "foo1ipaddress" {
  vpc_id = cloudstack_vpc.foo1-cluster.id
  zone   = var.zone
}

resource "cloudstack_port_forward" "default" {
  ip_address_id = cloudstack_ipaddress.foo1ipaddress.id
  forward {
    protocol           = "tcp"
    private_port       = 22
    public_port        = 22
    virtual_machine_id = cloudstack_instance.foo1-vm.id
  }
}

output "public_ip_foo1vm" {
  value = cloudstack_ipaddress.foo1ipaddress.ip_address
}

Debug Output

No debug output recognizable despite TF_LOG=trace.

Expected Behavior

Correct execution.

Actual Behavior

Error:

..
cloudstack_instance.foo2-vm: Creating...
cloudstack_network_acl_rule.default: Creation complete after 2s [id=2584bed0-bcd9-499e-b29a-e4729b366f9f]
Error: Error retrieving ID of template debian9.4 stretch BUILD-1946: json: cannot unmarshal object into Go struct field alias.childtemplates of type []interface {}

Steps to Reproduce

  1. terraform init
  2. terraform apply

P.S. tested also with another template, same error.

This issue has been automatically migrated to xanzy/terraform-provider-cloudstack#72 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to xanzy/terraform-provider-cloudstack#72.

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.