Terraform-provider-kubernetes: Priority classes- Error: invalid resource name "/high-priority": [may not contain '/']

Created on 4 Mar 2020  ·  3Comments  ·  Source: hashicorp/terraform-provider-kubernetes

Terraform Version

0.12.21

Affected Resource(s)

Please list the resources as a list, for example:

  • kubernetes_priority_class

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

provider "kubernetes" {
  version = "~> 1.11.1"

  host                   = aws_eks_cluster.cluster.endpoint
  cluster_ca_certificate = base64decode(aws_eks_cluster.cluster.certificate_authority[0].data)
  token                  = data.aws_eks_cluster_auth.cluster_auth.token
  load_config_file       = false
}

resource "kubernetes_priority_class" "high_priority_class" {
  metadata {
    name = "high-priority"
  }

  value          = 10000000
  global_default = false
 }

Debug Output

 2020-03-04T09:24:53.784Z [DEBUG] plugin: plugin exited
 Error: invalid resource name "/high-priority": [may not contain '/']

Expected Behavior

The same configuration worked with kubernetes provider version 1.11.1

Actual Behavior

Error is shown

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

I simply wanted to upgrade kubernetes provider to latest version. (from version 1.10.0 to 1.11.1)

bug

Most helpful comment

The only fix I came up with was to destroy priority classes with provider version 1.10.0 and then recreated them after upgrading to 1.11.1. It is a breaking change... in the provider

All 3 comments

i just recognize that the kubernetes provider on version 1.10.0 sets the id of the resources as the name with a / prefix (see last lines of terminal output).

Terraform will perform the following actions:

  # kubernetes_priority_class.high_priority will be created
  + resource "kubernetes_priority_class" "high_priority" {
      + global_default = false
      + id             = (known after apply)
      + value          = 200

      + metadata {
          + generation       = (known after apply)
          + name             = "high-priority"
          + resource_version = (known after apply)
          + self_link        = (known after apply)
          + uid              = (known after apply)
        }
    }

  # kubernetes_priority_class.low_priority will be created
  + resource "kubernetes_priority_class" "low_priority" {
      + global_default = false
      + id             = (known after apply)
      + value          = 100

      + metadata {
          + generation       = (known after apply)
          + name             = "low-priority"
          + resource_version = (known after apply)
          + self_link        = (known after apply)
          + uid              = (known after apply)
        }
    }

  # kubernetes_priority_class.mid_priority will be created
  + resource "kubernetes_priority_class" "mid_priority" {
      + global_default = false
      + id             = (known after apply)
      + value          = 150

      + metadata {
          + generation       = (known after apply)
          + name             = "mid-priority"
          + resource_version = (known after apply)
          + self_link        = (known after apply)
          + uid              = (known after apply)
        }
    }

Plan: 3 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

kubernetes_priority_class.low_priority: Creating...
kubernetes_priority_class.mid_priority: Creating...
kubernetes_priority_class.high_priority: Creating...
kubernetes_priority_class.high_priority: Creation complete after 1s [id=/high-priority]
kubernetes_priority_class.mid_priority: Creation complete after 1s [id=/mid-priority]
kubernetes_priority_class.low_priority: Creation complete after 2s [id=/low-priority]

The only fix I came up with was to destroy priority classes with provider version 1.10.0 and then recreated them after upgrading to 1.11.1. It is a breaking change... in the provider

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings