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

Kubernetes API get '404 NOT Found' when checking the existing resources

Open Duanjax opened this issue 2 years ago • 0 comments

Kubernetes API can not get existing resources when checking terraform state file, and then it want to recreate some resources

  1. I apply my terraform scripts in my local computer and save the state file to Ali cloud OSS
  2. I trigger the terraform init, plan in Github action using the same state file, then terraform want to recreate some of existing resources

image

When I check the log in terraform, I found Terraform provider can not find some part of existing resources saying '404 Not Found' image

But some resources not, without errors image

Terraform Version, Provider Version and Kubernetes Version

Terraform v1.6.5
on darwin_amd64
+ provider registry.terraform.io/aliyun/alicloud v1.207.0
+ provider registry.terraform.io/hashicorp/alicloud v1.213.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.24.0

Affected Resource(s)

  • kubernetes_limit_range
  • kubernetes_cluster_role_binding_v1
  • kubernetes_role_binding

Debug Output

Terraform log in Github action could be found here.

https://gist.github.com/Duanjax/dd693b8acb200e5c156a65c100f49e61

Steps to Reproduce

  1. terraform apply --> create some Kubernetes resources in local device
  2. trigger github aciton terraform plan use the same state file

Expected Behavior

NO Changes

It should be no changes here.

Actual Behavior

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

It want to recreate some existing resources.

Duanjax avatar Dec 07 '23 07:12 Duanjax