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

expected "namespace::groupVersion::kind::name" with 0.8.3 and terraform-0.13 #58

Closed
Andor opened this issue Sep 4, 2020 · 1 comment

Comments

@Andor
Copy link

Andor commented Sep 4, 2020

Describe the bug

I have code:

data "template_file" "priority_class_low" {
  template = file(
    "${path.module}/templates/priority-class.yaml.tpl"
  )
  vars = {
    name           = "low"
    value          = "1000"
    global_default = "false"
    description    = "For pods you don't really care about"
  }
}

resource "k8s_manifest" "priority_class_low" {
  content = data.template_file.priority_class_low.rendered
}

And template:

apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
  name: ${name}
value: ${value}
globalDefault: ${global_default}
description: "${description}"

With Terraform 0.12 and provider 0.5.0 everything was OK.

Now
After update from tf-0.12 and provider 0.5.0 to tf-0.13 and provider 0.8.3 I have the issue:

Error: unexpected ID format ("/apis/scheduling.k8s.io/v1beta1/priorityclasses/low"), expected "namespace::groupVersion::kind::name".

Here is existing resource in kubernetes:

$ kubectl get priorityclasses/low -o yaml
apiVersion: scheduling.k8s.io/v1
description: For pods you don't really care about
kind: PriorityClass
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"scheduling.k8s.io/v1","description":"For pods you don't really care about","globalDefault":false,"kind":"PriorityClass","metadata":{"annotations":{},"name":"low"},"value":1000}
  creationTimestamp: "2019-10-22T11:17:18Z"
  generation: 1
  name: low
  resourceVersion: "43187495"
  selfLink: /apis/scheduling.k8s.io/v1/priorityclasses/low
  uid: 8237f8b1-f4bd-11e9-9951-0abbc3022b5e
value: 1000 

Here is the same resource in terraform state:

    {
      "module": "module.eks_cluster",
      "mode": "managed",
      "type": "k8s_manifest",
      "name": "priority_class_low",
      "provider": "module.eks_cluster.provider[\"registry.terraform.io/banzaicloud/k8s\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "content": "apiVersion: scheduling.k8s.io/v1\nkind: PriorityClass\nmetadata:\n  name: low\nvalue: 1000\nglobalDefault: false\ndescription: \"For pods you don't really care about\"\n",
            "id": "/apis/scheduling.k8s.io/v1beta1/priorityclasses/low"
          },
          "private": "...",
          "dependencies": [ ...
          ]
        }
      ]
    },

Steps to reproduce the issue:

  1. Apply the code with terraform-0.12 and provider 0.5.0;
  2. Upgrade terraform to 0.13 and provider to 0.8.3;
  3. Try to apply again.

Expected behavior

I expect the code will get resource definition from Kubernetes and correctly compare it with locally compiled resource from the template.

Additional context

I noticed there v1beta1 in resource id in the state because the resource was created with older Kubernetes version, but when I manually patch it to just v1 the error is the same.

@Andor
Copy link
Author

Andor commented Sep 4, 2020

duplicate #30

@Andor Andor closed this as completed Sep 4, 2020
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

1 participant