koyeb / terraform-provider-koyeb

Terraform Koyeb provider
https://registry.terraform.io/providers/koyeb/koyeb/latest/docs
Mozilla Public License 2.0
3 stars 2 forks source link

Using Docker args in service results in `panic: interface conversion: interface {} is []interface {}, not []string` #24

Closed cherryblossom000 closed 2 years ago

cherryblossom000 commented 2 years ago

Terraform Version

v1.3.0

Affected Resource(s)

Terraform Configuration Files

terraform {
  required_providers {
    koyeb = {
      source  = "koyeb/koyeb"
      version = "~> 0.1.0"
    }
  }
}

provider "koyeb" {}

locals {
  app_name = "crash"
}

resource "koyeb_app" "crash" {
  name = local.app_name
}

resource "koyeb_service" "service" {
  app_name = local.app_name
  definition {
    name = "service"
    docker {
      image = "docker.io/koyeb/demo:b1ddc2682413"
      args  = ["foo=bar"]
    }
    instance_types {
      type = "nano"
    }
    scalings {}
    regions = ["par"]
    ports {
      port     = 3000
      protocol = "http"
    }
  }

  depends_on = [koyeb_app.crash]
}

Debug Output

https://gist.github.com/cherryblossom000/f580fcdfb0a7abbb7b1326a3317f1caa

Panic Output

https://gist.github.com/cherryblossom000/6844ff2d58ea29f28fb7892161cb80ca

Expected Behavior

The service ‘service’ should be created.

Actual Behavior

The provider panicked. The error occurs here when casting rawDockerSource["args"] into []string: https://github.com/koyeb/terraform-provider-koyeb/blob/036b35ccc507671c14912ac4820016cf4bfba6ca/koyeb/resource_koyeb_service.go#L319

Steps to Reproduce

  1. terraform init
  2. Set KOYEB_TOKEN environment variable
  3. terraform apply
edouardb commented 2 years ago

Hi @cherryblossom000,

Thanks for reporting this and sorry for the late reply.

The latest release should fix this behavior.