resource "kubernetes_deployment" "nginx" { metadata { name = "scalable-nginx-example" labels = { App = "ScalableNginxExample" } } spec { replicas = 2 selector { match_labels = { App = "ScalableNginxExample" } } template { metadata { labels = { App = "ScalableNginxExample" } } spec { container { image = "nginx:latest" name = "example" port { container_port = 60080 } resources { limits { cpu = "0.5" memory = "512Mi" } requests { cpu = "250m" memory = "50Mi" } } } } } } } resource "kubernetes_service" "nginx" { metadata { name = "nginx-example" } spec { selector = { App = kubernetes_deployment.nginx.spec.0.template.0.metadata[0].labels.App } port { port = 60080 target_port = 60080 } type = "LoadBalancer" } } output "lb_ip" { value = kubernetes_service.nginx.load_balancer_ingress[0].ip }