This is my module snippet:
inputs.tf:
variable "namespace" {
type = object({
metadata = object({
name = string
})
})
}
main.tf:
resource "helm_release" "spark" {
name = "spark"
repository = "https://charts.bitnami.com/bitnami"
chart = "spark"
version = "1.2.21"
namespace = var.namespace.metadata.name
}
As you can see, I'm trying to get access to previously created kubernetes_namespace.
Into my environment workspace:
resource "kubernetes_namespace" "this" {
metadata {
name = var.namespace
}
}
module "spark" {
source = "../modules/spark"
namespace = kubernetes_namespace.this
workers = 1
}
I'm getting this message when I'm trying to get plan:
➜ development terraform plan | xclip -selection clipboard
Error: Invalid value for module argument
on main.tf line 14, in module "spark":
14: namespace = kubernetes_namespace.this
The given value is not suitable for child module variable "namespace" defined
at ../modules/spark/inputs.tf:1,1-21: attribute "metadata": object required.
Any ideas?