terraform-provider-kubernetes
terraform-provider-kubernetes copied to clipboard
kubernetes_manifest with pod and volume: inconsistent result after apply
Terraform Version, Provider Version and Kubernetes Version
Terraform version: v1.4.6
Kubernetes provider version: v2.23.0
Kubernetes version: v1.26.4
Affected Resource(s)
- kubernetes_manifest
Terraform Configuration Files
resource "kubernetes_manifest" "test" {
manifest = {
apiVersion = "v1"
kind = "Pod"
metadata = {
name = "test"
namespace = "default"
}
spec = {
containers = [{
name = "test"
image = "docker.io/library/busybox:latest"
command = ["busybox", "sh", "-c", "sleep inf"]
volumeMounts = [{
name = "test"
mountPath = "/test"
}]
}]
volumes = [{
name = "test"
emptyDir = {}
}]
}
}
}
Debug Output
I will post this if you really need it but I think its entirely reproducible and its hard to capture that incredibly verbose output.
Panic Output
n/a
Steps to Reproduce
terraform applythe above repro
Expected Behavior
pod created and terraform happy
Actual Behavior
pod created and terraform unhappy
kubernetes_manifest.test: Creating...
2023-10-20T17:45:07.584-0400 [INFO] Starting apply for kubernetes_manifest.test
2023-10-20T17:45:07.584-0400 [DEBUG] skipping FixUpBlockAttrs
2023-10-20T17:45:07.584-0400 [DEBUG] kubernetes_manifest.test: applying the planned Create change
2023-10-20T17:45:08.841-0400 [ERROR] vertex "kubernetes_manifest.test" error: Provider produced inconsistent result after apply
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to kubernetes_manifest.test, provider "provider[\"registry.terraform.io/hashicorp/kubernetes\"]" produced an unexpected new value: .object: wrong final value type: attribute "spec": attribute
│ "volumes": tuple required.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
2023-10-20T17:45:08.869-0400 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2023-10-20T17:45:08.876-0400 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/kubernetes/2.23.0/darwin_amd64/terraform-provider-kubernetes_v2.23.0_x5 pid=70337
2023-10-20T17:45:08.876-0400 [DEBUG] provider: plugin exited
Important Factoids
References
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
same issue here. though the pod is getting created, and I am able to update the pod with an additional volume as well. each time it throws the error, but the pod seems to getting created and updated correctly.
Some additional info that might help. This seems to be caused by the ServiceAccount token auto mount under volumes. Adding an additional element to the list of volumes, confusing the provider. Setting automountServiceAccountToken: false works happily without any errors.