RTFM Moment of the Day

TL;DR: A kubernetes OperatorGroup expects the node spec/targetNamespace to be an array!

Utilizing the terraform kubernetes_manifest resource I ran into an error specifying the operator namespace.

resource “kubernetes_manifest” “grafana-operator” {
manifest = {
“spec” = {
targetNamespaces = “grafana”

The error and the stacktrace were more confusing than helpful, initially.

Error: “Failed to morph manifest to OAPI type”

AttributeName(“spec”): [AttributeName(“spec”)] failed to morph object element into object element: AttributeName(“spec”): [AttributeName(“spec”)] unsupported morph of tuple value into type: tftypes.Object[“selector”:tftypes.Object[“matchExpressions”:tftypes.List[tftypes.Object[“key”:tftypes.String, “operator”:tftypes.String, “values”:tftypes.List[tftypes.String]]], “matchLabels”:tftypes.Map[tftypes.String]], “serviceAccountName”:tftypes.String, “staticProvidedAPIs”:tftypes.Bool, “targetNamespaces”:tftypes.List[tftypes.String]]

I created this from a working YAML and use similar structures elsewhere so I wasn’t sure why this particular one was throwing an error. Finally, after fruitless searching I loaded up the OperatorGroup schema and saw:

targetNamespaces array

It seems like a fair mistake to make and overlook since passing a single namespace as a string is accepted in most areas, but terraform can be less flexible. In hindsight, the error message was quite helpful. Note the last line:


Any problem is an opportunity for learning and my takeaways from this are:

  1. Read and try to understand the whole error message, even if you think it’s not useful.
  2. Recognize the differences between the different technologies and how they deal with certain scenarios. In this case, how do terraform and k8s handle type casting and conversion?
  3. Technology is constantly evolving and documentation and error logging can lag which makes them great opportunities for contributions.

Until the next time, RTFM!




Spot for my brain dumps.

Love podcasts or audiobooks? Learn on the go with our new app.

How to write your first CLI with Thor

Building a high-performance platform on AWS to support real-time gaming services using Presto and…

Engineering behind HindustanTime’s subscription platform

Subscription tech architecture

How to make an application using serverless application model (SAM) and python

Multi-company fleet management: moving towards smoother communication & maintenance planning in…

Unit Testing in an CI/CD Enterprise Environment

The Ultimate eLearning Buzzwords You Need To Know Right Now

Monitoring Mobile Game App Performance

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Spot for my brain dumps.

More from Medium

GitOps experiment with FluxCD

Eliminate Hidden Costs by using multi-cloud RedHat OpenShift

History, Principles, and implementation of SRE

IBM Cloud Secrets Manager and the External Secrets Operator