gavinbunney / terraform-provider-kubectl

Terraform provider to handle raw kubernetes manifest yaml files
https://registry.terraform.io/providers/gavinbunney/kubectl
Mozilla Public License 2.0
626 stars 107 forks source link

Creating an already existing kubernetes resource suceeds - but should have failed #210

Open runesl opened 2 years ago

runesl commented 2 years ago

scenario kubernetes resource "xyz" is already present in kubernetes. terraform apply with a kubectl_manifest resource that creates resource "xyz".

expected behaviour terraform apply should fail with "resource xyz already present in Kubernetes."

actual behaviour Terraform suceeds the apply, and it is silently imported into terraform state. This is dangerous as the ressource "xyz" will now be destroyed in Kubernetes on subsequent terraform destroy although it was neither created by terraform or manually imported into terraform state. The observed behaviour breaks the terraform assumption of 1-1 between terraform resource and remote resource, which well-behaved providers should follow.