Terraform v0.11.14
+ provider.kubernetes v1.10.0
Please list the resources as a list, for example:
resource "kubernetes_priority_class" "monitoring_critical" {
metadata {
name = "monitoring-critical"
}
value = 1900000
description = "Used for pods that are critical for monitoring workloads."
}
A new PriorityClass should be created.
The new PriorityClass is not created, and the provider returns an error:
$ terraform apply
...
+ kubernetes_priority_class.monitoring_critical
id: <computed>
description: "Used for pods that are critical for monitoring workloads."
global_default: "false"
metadata.#: "1"
metadata.0.generation: <computed>
metadata.0.name: "monitoring-critical"
metadata.0.resource_version: <computed>
metadata.0.self_link: <computed>
metadata.0.uid: <computed>
value: "1900000"
Plan: 1 to add, 0 to change, 0 to destroy.
...
Error: Error applying plan:
1 error occurred:
* kubernetes_priority_class.monitoring_critical: 1 error occurred:
* kubernetes_priority_class.monitoring_critical: Failed to create priority class: the server could not find the requested resource
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
terraform apply and type 'yes' when promptedkubernetes_priority_class was just recently released in v1.10.0Can you also share cluster version and platform details?
I tried to reproduce it on minikube with K8s 1.15 and it works fine.
~ » kubectl version alex@MacBook-Pro
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.3", GitCommit:"2d3c76f9091b6bec110a5e63777c332469e0cba2", GitTreeState:"clean", BuildDate:"2019-08-19T11:13:54Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.4", GitCommit:"67d2fcf276fcd9cf743ad4be9a9ef5828adc082f", GitTreeState:"clean", BuildDate:"2019-09-18T14:41:55Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
------------------------------------------------------------
~/test-681 » terraform version alex@MacBook-Pro
Terraform v0.12.13
+ provider.kubernetes v1.10.0
------------------------------------------------------------
~/test-681 » terraform plan alex@MacBook-Pro
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# kubernetes_priority_class.monitoring_critical will be created
+ resource "kubernetes_priority_class" "monitoring_critical" {
+ description = "Used for pods that are critical for monitoring workloads."
+ global_default = false
+ id = (known after apply)
+ value = 1900000
+ metadata {
+ generation = (known after apply)
+ name = "monitoring-critical"
+ resource_version = (known after apply)
+ self_link = (known after apply)
+ uid = (known after apply)
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
------------------------------------------------------------------------
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
------------------------------------------------------------
~/test-681 » terraform apply alex@MacBook-Pro
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# kubernetes_priority_class.monitoring_critical will be created
+ resource "kubernetes_priority_class" "monitoring_critical" {
+ description = "Used for pods that are critical for monitoring workloads."
+ global_default = false
+ id = (known after apply)
+ value = 1900000
+ metadata {
+ generation = (known after apply)
+ name = "monitoring-critical"
+ resource_version = (known after apply)
+ self_link = (known after apply)
+ uid = (known after apply)
}
}
Plan: 1 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.monitoring_critical: Creating...
kubernetes_priority_class.monitoring_critical: Creation complete after 0s [id=/monitoring-critical]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
------------------------------------------------------------
This happens with kubernetes v1.13 which I believe is the version @tdmalone is running as per https://github.com/terraform-providers/terraform-provider-kubernetes/pull/665#issuecomment-552359791.
# export KUBE_CTX=kubernetes-1.13
# make testacc TEST=./kubernetes TESTARGS='-run=TestAccKubernetesPriority.* -count=1'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./kubernetes -v -run=TestAccKubernetesPriority.* -count=1 -timeout 120m
go: finding k8s.io/client-go v12.0.0+incompatible
go: finding k8s.io/client-go v12.0.0+incompatible
go: finding github.com/terraform-providers/terraform-provider-google v2.17.0+incompatible
go: finding github.com/terraform-providers/terraform-provider-aws v2.32.0+incompatible
go: finding github.com/terraform-providers/terraform-provider-google v2.17.0+incompatible
go: finding github.com/terraform-providers/terraform-provider-aws v2.32.0+incompatible
=== RUN TestAccKubernetesPriorityClass_basic
--- FAIL: TestAccKubernetesPriorityClass_basic (0.30s)
testing.go:635: Step 0 error: errors during apply:
Error: Failed to create priority class: the server could not find the requested resource
on /tmp/tf-test619719169/main.tf line 2:
(source code not available)
=== RUN TestAccKubernetesPriorityClass_generatedName
--- FAIL: TestAccKubernetesPriorityClass_generatedName (0.27s)
testing.go:635: Step 0 error: errors during apply:
Error: Failed to create priority class: the server could not find the requested resource
on /tmp/tf-test478502875/main.tf line 2:
(source code not available)
=== RUN TestAccKubernetesPriorityClass_importBasic
--- FAIL: TestAccKubernetesPriorityClass_importBasic (0.24s)
testing.go:635: Step 0 error: errors during apply:
Error: Failed to create priority class: the server could not find the requested resource
on /tmp/tf-test038131909/main.tf line 2:
(source code not available)
FAIL
FAIL github.com/terraform-providers/terraform-provider-kubernetes/kubernetes 0.851s
FAIL
make: *** [GNUmakefile:17: testacc] Error 1
In that version, it is only beta: https://v1-13.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.13/#priorityclass-v1beta1-scheduling-k8s-io
The current implementation uses the v1 endpoint which is not available in kubernetes v1.13: https://github.com/terraform-providers/terraform-provider-kubernetes/blob/ade5df62a862ec551bcf4520e99f0f655ba4361c/kubernetes/resource_kubernetes_priority_class.go#L65
PriorityClass is GA only since kubernetes v1.14 https://v1-14.docs.kubernetes.io/docs/reference/generated/kubernetes-api/v1.14/#priorityclass-v1-scheduling-k8s-io
@pdecat is right - thanks for that.
I’m currently using a null_resource with a provisioner running kubectl in order to create PriorityClasses, so I can stick with that until we upgrade to 1.14 shortly.
I didn’t realise PriorityClasses were only at beta in 1.13. If possible - it would be great to support both endpoints, and it would make the implementation in the provider more robust - but I realise that adds a bit of annoying complexity.
I’ve left this open for now just in case, but happy to close if this is a wontfix.
I am having the same problem. Some short-term solution would be helpful, like a beta=true switch for this resource or a customised apiVersion field.
This issue has been open 180 days with no activity. If this issue is reproducible with the latest version of the provider and with Terraform 0.12, please comment. Otherwise this issue will be closed in 30 days.
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!
Most helpful comment
@pdecat is right - thanks for that.
I’m currently using a null_resource with a provisioner running kubectl in order to create PriorityClasses, so I can stick with that until we upgrade to 1.14 shortly.
I didn’t realise PriorityClasses were only at beta in 1.13. If possible - it would be great to support both endpoints, and it would make the implementation in the provider more robust - but I realise that adds a bit of annoying complexity.
I’ve left this open for now just in case, but happy to close if this is a wontfix.