Inspecting resources on the terraform state

1 min read | by Jordi Prats

While debugging an issue it can be quite handy to be able to inspect the terraform state. We can inspect specific resources by using terraform state show

It's usage it's straightforward, we just need to specify the resource we want to inspect to get all the details present on the terraform state:

$ terraform state show kubernetes_namespace.demo
# kubernetes_namespace.demo:
resource "kubernetes_namespace" "demo" {
    id = "demoprometrics"

    metadata {
        annotations      = {}
        generation       = 0
        labels           = {}
        name             = "demoprometrics"
        resource_version = "508"
        self_link        = "/api/v1/namespaces/demoprometrics"
        uid              = "d24fec99-b71e-4394-b445-ae9085785ea9"
    }
}

Posted on 12/04/2021