1
1
package azurerm
2
2
3
3
import (
4
+ "errors"
4
5
"fmt"
5
6
"log"
6
7
"regexp"
@@ -20,6 +21,7 @@ func resourceArmStorageAccount() *schema.Resource {
20
21
Read : resourceArmStorageAccountRead ,
21
22
Update : resourceArmStorageAccountUpdate ,
22
23
Delete : resourceArmStorageAccountDelete ,
24
+
23
25
Importer : & schema.ResourceImporter {
24
26
State : schema .ImportStatePassthrough ,
25
27
},
@@ -287,11 +289,39 @@ func resourceArmStorageAccount() *schema.Resource {
287
289
},
288
290
},
289
291
290
- "tags" : tagsSchema (),
292
+ "tags" : {
293
+ Type : schema .TypeMap ,
294
+ Optional : true ,
295
+ Computed : true ,
296
+ ValidateFunc : validateAzureRMStorageAccountTags ,
297
+ },
291
298
},
292
299
}
293
300
}
294
301
302
+ func validateAzureRMStorageAccountTags (v interface {}, _ string ) (ws []string , es []error ) {
303
+ tagsMap := v .(map [string ]interface {})
304
+
305
+ if len (tagsMap ) > 15 {
306
+ es = append (es , errors .New ("a maximum of 15 tags can be applied to each ARM resource" ))
307
+ }
308
+
309
+ for k , v := range tagsMap {
310
+ if len (k ) > 128 {
311
+ es = append (es , fmt .Errorf ("the maximum length for a tag key is 128 characters: %q is %d characters" , k , len (k )))
312
+ }
313
+
314
+ value , err := tagValueToString (v )
315
+ if err != nil {
316
+ es = append (es , err )
317
+ } else if len (value ) > 256 {
318
+ es = append (es , fmt .Errorf ("the maximum length for a tag value is 256 characters: the value for %q is %d characters" , k , len (value )))
319
+ }
320
+ }
321
+
322
+ return ws , es
323
+ }
324
+
295
325
func resourceArmStorageAccountCreate (d * schema.ResourceData , meta interface {}) error {
296
326
client := meta .(* ArmClient ).storageServiceClient
297
327
0 commit comments