Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying CRD using terraform causes the error Forbidden attribute key in "manifest" value #224

Closed
Lexmark-jrichey opened this issue Dec 13, 2021 · 1 comment

Comments

@Lexmark-jrichey
Copy link

Lexmark-jrichey commented Dec 13, 2021

An error occurs when attempting to install the file sloth.slok.dev_prometheusservicelevels.yaml using terraform and the kubernetes provider (kubernetes_manifest resource). Reproduced using hashicorp/kubernetes v2.7.1 and Terraform v1.0.11

 Error: Forbidden attribute key in "manifest" value

    with kubernetes_manifest.sloth_crd,
    on sloth.tf line 16, in resource "kubernetes_manifest" "sloth_crd":
    16: resource "kubernetes_manifest" "sloth_crd" {

   'status' attribute key is not allowed in manifest configuration

example terraform:

resource "kubernetes_manifest" "sloth_crd" {
  provider = kubernetes

  manifest = yamldecode(file("sloth.slok.dev_prometheusservicelevels.yaml"))
}

Using the sloth CRD to install the sloth operator via terraform generates an error due to the unexpected .status element at the root level.

As mentioned in the kubernetes-alpha provider repo here "..the status field seems to be a read-only field from the user perspective. It makes little sense to pass this field to the API server ..in Terraform we use the exact configuration supplied by the user and instead validate before applying and report an error."

The workaround is to remove the .status properties (and sub-elements) from the CRD yaml file.

@slok slok closed this as completed Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants