`NewValue` function should also return an `Error` type
BBBmau opened this issue · comments
Mauricio Alvarez Leon commented
terraform-plugin-go version
v0.14.2
Relevant provider source code
func NewValue(t Type, val interface{}) Value {
v, err := newValue(t, val)
if err != nil {
panic(err)
}
return v
}
Terraform Configuration Files
terraform {
required_providers {
kubernetes = {
source = "hashicorp/kubernetes"
}
}
}
provider "kubernetes" {
# Configuration options
config_path = "~/.kube/config"
}
locals {
condition = false
postStart = {
exec = {
command = ["bash", "-c", "echo postStart"]
}
}
preStop = {
exec = {
command = ["bash", "-c", "echo preStop"]
}
}
}
resource "kubernetes_manifest" "deploy_foo" {
manifest = {
apiVersion = "apps/v1"
kind = "Deployment"
metadata = {
name = "foo"
namespace = "foo"
labels = {
"app" = "foo"
}
}
spec = {
selector = {
matchLabels = {
"app" = "foo"
}
}
template = {
metadata = {
labels = {
"app" = "foo"
},
}
spec = {
containers = [
{
name = "foo"
image = "busybox"
lifecycle = true ? {
postStart = local.postStart
} :{
preStop = local.preStop
}
}
]
}
}
}
}
}
Expected Behavior
Should return an error in order to prevent having to catch the error with the k8s provider
Actual Behavior
no error is returned forcing us to have to catch the error right before the panic within the provider.