Fix failing test for storage ACLs.

When using predefined storage ACLs, you'd get a permadiff, because the
role_entities list was computed, but was never set in state. So it would
be read as empty in the config, and not present in state, so Terraform
would want to pull it down and sync it. This is probably, technically
speaking, a bug in Terraform, but we can work around it by just setting
role_entities to an empty value on every read.
This commit is contained in:
Paddy Carver 2018-06-25 13:02:05 -07:00
parent 101b15fb80
commit d7078ab309

View File

@ -130,6 +130,7 @@ func resourceStorageBucketAclCreate(d *schema.ResourceData, meta interface{}) er
}
}
if len(role_entity) > 0 {
current, err := config.clientStorage.BucketAccessControls.List(bucket).Do()
if err != nil {
@ -210,6 +211,8 @@ func resourceStorageBucketAclRead(d *schema.ResourceData, meta interface{}) erro
}
d.Set("role_entity", entities)
} else {
d.Set("role_entity", nil)
}
return nil