provider/azurerm: fix computed tags causing non-empty plan

The tag schema was changed in #9199, setting the Computed flag, this was causing
the plan to not be empty for resources which support tags but none were set, as
no value would be set by flattenAndSetTags.

Setting an empty map instead fixes the issue, ran original failing test and an
update tags test to ensure nothing else was broken.

Depends on #9305.

```
TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMCdnProfile -timeout 120m
=== RUN   TestAccAzureRMCdnProfile_importWithTags
--- PASS: TestAccAzureRMCdnProfile_importWithTags (171.64s)
=== RUN   TestAccAzureRMCdnProfile_basic
--- PASS: TestAccAzureRMCdnProfile_basic (162.70s)
=== RUN   TestAccAzureRMCdnProfile_withTags
--- PASS: TestAccAzureRMCdnProfile_withTags (203.12s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/azurerm	537.538s
```
This commit is contained in:
Peter McAtominey 2016-10-10 11:26:41 +01:00
parent 70a90cc1f4
commit a07275df5e
1 changed files with 1 additions and 0 deletions

View File

@ -64,6 +64,7 @@ func expandTags(tagsMap map[string]interface{}) *map[string]*string {
func flattenAndSetTags(d *schema.ResourceData, tagsMap *map[string]*string) {
if tagsMap == nil {
d.Set("tags", make(map[string]interface{}))
return
}