func resourceAwsSnapshotCreateVolumePermissionStateRefreshFunc(conn *ec2.EC2, snapshot_id string, account_id string) resource.StateRefreshFunc { return func() (interface{}, string, error) { attrs, err := conn.DescribeSnapshotAttribute(&ec2.DescribeSnapshotAttributeInput{ SnapshotId: aws.String(snapshot_id), Attribute: aws.String("createVolumePermission"), }) if err != nil { return nil, "", fmt.Errorf("Error refreshing snapshot createVolumePermission state: %s", err) } for _, vp := range attrs.CreateVolumePermissions { if *vp.UserId == account_id { return attrs, "granted", nil } } return attrs, "denied", nil } }