@@ -24,6 +24,27 @@ func TestAccKubernetesConfigMap_basic(t *testing.T) {
24
24
Providers : testAccProviders ,
25
25
CheckDestroy : testAccCheckKubernetesConfigMapDestroy ,
26
26
Steps : []resource.TestStep {
27
+ {
28
+ Config : testAccKubernetesConfigMapConfig_nodata (name ),
29
+ Check : resource .ComposeAggregateTestCheckFunc (
30
+ testAccCheckKubernetesConfigMapExists ("kubernetes_config_map.test" , & conf ),
31
+ resource .TestCheckResourceAttr ("kubernetes_config_map.test" , "metadata.0.annotations.%" , "2" ),
32
+ resource .TestCheckResourceAttr ("kubernetes_config_map.test" , "metadata.0.annotations.TestAnnotationOne" , "one" ),
33
+ resource .TestCheckResourceAttr ("kubernetes_config_map.test" , "metadata.0.annotations.TestAnnotationTwo" , "two" ),
34
+ testAccCheckMetaAnnotations (& conf .ObjectMeta , map [string ]string {"TestAnnotationOne" : "one" , "TestAnnotationTwo" : "two" }),
35
+ resource .TestCheckResourceAttr ("kubernetes_config_map.test" , "metadata.0.labels.%" , "3" ),
36
+ resource .TestCheckResourceAttr ("kubernetes_config_map.test" , "metadata.0.labels.TestLabelOne" , "one" ),
37
+ resource .TestCheckResourceAttr ("kubernetes_config_map.test" , "metadata.0.labels.TestLabelTwo" , "two" ),
38
+ resource .TestCheckResourceAttr ("kubernetes_config_map.test" , "metadata.0.labels.TestLabelThree" , "three" ),
39
+ testAccCheckMetaLabels (& conf .ObjectMeta , map [string ]string {"TestLabelOne" : "one" , "TestLabelTwo" : "two" , "TestLabelThree" : "three" }),
40
+ resource .TestCheckResourceAttr ("kubernetes_config_map.test" , "metadata.0.name" , name ),
41
+ resource .TestCheckResourceAttrSet ("kubernetes_config_map.test" , "metadata.0.generation" ),
42
+ resource .TestCheckResourceAttrSet ("kubernetes_config_map.test" , "metadata.0.resource_version" ),
43
+ resource .TestCheckResourceAttrSet ("kubernetes_config_map.test" , "metadata.0.self_link" ),
44
+ resource .TestCheckResourceAttrSet ("kubernetes_config_map.test" , "metadata.0.uid" ),
45
+ resource .TestCheckResourceAttr ("kubernetes_config_map.test" , "data.%" , "0" ),
46
+ ),
47
+ },
27
48
{
28
49
Config : testAccKubernetesConfigMapConfig_basic (name ),
29
50
Check : resource .ComposeAggregateTestCheckFunc (
@@ -224,6 +245,25 @@ func testAccCheckKubernetesConfigMapExists(n string, obj *api.ConfigMap) resourc
224
245
}
225
246
}
226
247
248
+ func testAccKubernetesConfigMapConfig_nodata (name string ) string {
249
+ return fmt .Sprintf (`
250
+ resource "kubernetes_config_map" "test" {
251
+ metadata {
252
+ annotations {
253
+ TestAnnotationOne = "one"
254
+ TestAnnotationTwo = "two"
255
+ }
256
+ labels {
257
+ TestLabelOne = "one"
258
+ TestLabelTwo = "two"
259
+ TestLabelThree = "three"
260
+ }
261
+ name = "%s"
262
+ }
263
+ data {}
264
+ }` , name )
265
+ }
266
+
227
267
func testAccKubernetesConfigMapConfig_basic (name string ) string {
228
268
return fmt .Sprintf (`
229
269
resource "kubernetes_config_map" "test" {
0 commit comments