Terraform kubernetes_pod resource is not created

Viewed 31

I am very new to Terraform and I am given a project to make a basic Wordpress website in Google Cloud Platform using Kubernetes automated by Terraform. I am trying to set up the kubernetes pod for wordpress as follows:

resource "kubernetes_pod" "kubPod" {
  metadata {
    labels = {
      app = "MyApp"
    }
    name = "terraform-example"
    
  }

  spec {
    container {
      image = "wordpress:4.8-apache"
      name  = "mywp"
    }
    
  }
}

When I build the project using terraform apply, I get the following output:

kubernetes_pod_v1.kubPod: Creating...

and after that terraform closes without creating the pod. I did not understand what is wrong with the code, I just suspect that it might be related to a lack in declarations, but examples I looked for were quite similar with my code below, I would be glad if I could get some help.

My version information is as follows:

Terraform v1.2.8 on windows_amd64

  • provider registry.terraform.io/hashicorp/google v4.34.0
  • provider registry.terraform.io/hashicorp/kubernetes v2.13.1
  • provider registry.terraform.io/hashicorp/null v3.1.1

Regards.

0 Answers
Related