mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Handle JSON parsing error in the ReadFunc for the access policies document.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
This commit is contained in:
parent
d71ff1e122
commit
dd1d41ddce
@ -9,6 +9,7 @@ import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
elasticsearch "github.com/aws/aws-sdk-go/service/elasticsearchservice"
|
||||
"github.com/hashicorp/errwrap"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
)
|
||||
@ -270,7 +271,10 @@ func resourceAwsElasticSearchDomainRead(d *schema.ResourceData, meta interface{}
|
||||
ds := out.DomainStatus
|
||||
|
||||
if ds.AccessPolicies != nil && *ds.AccessPolicies != "" {
|
||||
policies, _ := normalizeJsonString(*ds.AccessPolicies)
|
||||
policies, err := normalizeJsonString(*ds.AccessPolicies)
|
||||
if err != nil {
|
||||
return errwrap.Wrapf("access policies contain an invalid JSON: {{err}}", err)
|
||||
}
|
||||
d.Set("access_policies", policies)
|
||||
}
|
||||
err = d.Set("advanced_options", pointersMapToStringList(ds.AdvancedOptions))
|
||||
|
Loading…
Reference in New Issue
Block a user