terraform-provider-kubernetes-alpha icon indicating copy to clipboard operation
terraform-provider-kubernetes-alpha copied to clipboard

No valid OpenAPI definition warning

Open Vrtak-CZ opened this issue 3 years ago • 1 comments

I'm creating this issue because the original issue was solved and closed. But current version still reporting there is no OpenAPI definition even when the schema is defined.

Terraform, Provider, Kubernetes versions

Terraform version: 1.0.0
Provider version: 0.5.0
Kubernetes version: 1.20.x

Affected Resource(s)

  • kubernetes_manifest

Terraform Configuration Files

resource "kubernetes_manifest" "app_admin_ssm_envs" {
  manifest = {
    apiVersion = "kubernetes-client.io/v1"
    kind       = "ExternalSecret"

    metadata = {
      name      = "admin-ssm-envs"
      namespace = var.environment
    }

    spec = {
      backendType = "systemManager"
      region      = var.aws_region

      data = [
        {
          key  = aws_ssm_parameter.apps_admin_sentry_dsn.name
          name = "SENTRY_DSN"
        }
      ]
    }
  }
}

Steps to Reproduce

  1. terraform apply

Expected Behavior

There should be no warning.

Actual Behavior

╷
│ Warning: This custom resource does not have an associated OpenAPI schema.
│ 
│   with kubernetes_manifest.app_admin_ssm_envs,
│   on apps_admin.tf line 71, in resource "kubernetes_manifest" "app_admin_ssm_envs":
│   71: resource "kubernetes_manifest" "app_admin_ssm_envs" {
│ 
│ We could not find an OpenAPI schema for this custom resource. Updates to
│ this resource will cause a forced replacement.
│ 
│ (and 7 more similar warnings elsewhere)
╵

Important Factoids

This CRD has OpenAPI definition

References

  • https://github.com/hashicorp/terraform-provider-kubernetes-alpha/issues/181

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Vrtak-CZ avatar Jun 23 '21 14:06 Vrtak-CZ

I have faced with the same issue: terraform shows this warning, but the resource is able to be created. The more actual problem is I cannot update this resource or even run terraform plan after creation without errors:

terraform plan
Acquiring state lock. This may take a few moments...
kubernetes_manifest.elasticsearch: Refreshing state...
╷
│ Warning: This custom resource does not have an associated OpenAPI schema.
│ 
│   with kubernetes_manifest.elasticsearch,
│   on main.tf line 1, in resource "kubernetes_manifest" "elasticsearch":
│    1: resource "kubernetes_manifest" "elasticsearch" {
│ 
│ We could not find an OpenAPI schema for this custom resource. Updates to this resource will cause a forced replacement.
╵
╷
│ Error: Dry-run failed for non-structured resource
│ 
│   with kubernetes_manifest.elasticsearch,
│   on main.tf line 1, in resource "kubernetes_manifest" "elasticsearch":
│    1: resource "kubernetes_manifest" "elasticsearch" {
│ 
│ A dry-run apply was performed for this resource but was unsuccessful: Apply failed with 1 conflict: conflict with "elastic-operator" using elasticsearch.k8s.elastic.co/v1: .spec.nodeSets
╵

Terraform, Provider, Kubernetes versions

Terraform version: 1.0.0
Provider version: 0.5.0
Kubernetes(EKS) version: 1.20.x

Terraform resource

resource "kubernetes_manifest" "elasticsearch" {
  provider = kubernetes-alpha
  manifest = {
    "apiVersion" = "elasticsearch.k8s.elastic.co/v1"
    "kind"       = "Elasticsearch"
    "metadata" = {
      "name" = "es-test"
      "namespace" = data.terraform_remote_state.operator.outputs.namespace
    }
    "spec" = {
      "nodeSets" = [
        {
          "config" = {
            "node.store.allow_mmap" = false
          }
          "count" = 3
          "name"  = "default"
        },
      ]
      "version" = "7.13.2"
    }
  }
}

dracut5 avatar Jul 05 '21 12:07 dracut5