@@ -164,6 +164,39 @@ func TestAccKubernetesIngressV1_TLS(t *testing.T) {
164
164
})
165
165
}
166
166
167
+ func TestAccKubernetesIngressV1_emptyTLS (t * testing.T ) {
168
+ var conf networking.Ingress
169
+ name := fmt .Sprintf ("tf-acc-test-%s" , acctest .RandStringFromCharSet (10 , acctest .CharSetAlphaNum ))
170
+ resourceName := "kubernetes_ingress_v1.test"
171
+
172
+ resource .ParallelTest (t , resource.TestCase {
173
+ PreCheck : func () {
174
+ testAccPreCheck (t )
175
+ skipIfClusterVersionLessThan (t , "1.22.0" )
176
+ },
177
+ IDRefreshName : resourceName ,
178
+ ProviderFactories : testAccProviderFactories ,
179
+ CheckDestroy : testAccCheckKubernetesIngressV1Destroy ,
180
+ IDRefreshIgnore : []string {"metadata.0.resource_version" },
181
+ Steps : []resource.TestStep {
182
+ {
183
+ Config : testAccKubernetesIngressV1Config_emptyTLS (name ),
184
+ Check : resource .ComposeAggregateTestCheckFunc (
185
+ testAccCheckKubernetesIngressV1Exists (resourceName , & conf ),
186
+ resource .TestCheckResourceAttr (resourceName , "metadata.0.name" , name ),
187
+ resource .TestCheckResourceAttrSet (resourceName , "metadata.0.generation" ),
188
+ resource .TestCheckResourceAttrSet (resourceName , "metadata.0.resource_version" ),
189
+ resource .TestCheckResourceAttrSet (resourceName , "metadata.0.uid" ),
190
+ resource .TestCheckResourceAttr (resourceName , "spec.#" , "1" ),
191
+ resource .TestCheckResourceAttr (resourceName , "spec.0.tls.#" , "1" ),
192
+ resource .TestCheckResourceAttr (resourceName , "spec.0.tls.0.hosts.#" , "0" ),
193
+ resource .TestCheckResourceAttr (resourceName , "spec.0.tls.0.secret_name" , "" ),
194
+ ),
195
+ },
196
+ },
197
+ })
198
+ }
199
+
167
200
func TestAccKubernetesIngressV1_InternalKey (t * testing.T ) {
168
201
var conf networking.Ingress
169
202
name := fmt .Sprintf ("tf-acc-test-%s" , acctest .RandStringFromCharSet (10 , acctest .CharSetAlphaNum ))
@@ -541,6 +574,26 @@ func testAccKubernetesIngressV1Config_TLS_modified(name string) string {
541
574
}` , name )
542
575
}
543
576
577
+ func testAccKubernetesIngressV1Config_emptyTLS (name string ) string {
578
+ return fmt .Sprintf (`resource "kubernetes_ingress_v1" "test" {
579
+ metadata {
580
+ name = "%s"
581
+ }
582
+ spec {
583
+ default_backend {
584
+ service {
585
+ name = "app1"
586
+ port {
587
+ number = 443
588
+ }
589
+ }
590
+ }
591
+ tls {
592
+ }
593
+ }
594
+ }` , name )
595
+ }
596
+
544
597
func testAccKubernetesIngressV1Config_internalKey (name string ) string {
545
598
return fmt .Sprintf (`resource "kubernetes_ingress_v1" "test" {
546
599
metadata {
0 commit comments