Add JSON validation to the aws_elasticsearch_domain resource.
This commit adds support for new helper function which is used to normalise and validate JSON string. Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
This commit is contained in:
parent
e8a7b5d1c6
commit
d71ff1e122
|
@ -23,8 +23,9 @@ func resourceAwsElasticSearchDomain() *schema.Resource {
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"access_policies": &schema.Schema{
|
"access_policies": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
|
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
ValidateFunc: validateJsonString,
|
||||||
|
DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs,
|
||||||
},
|
},
|
||||||
"advanced_options": &schema.Schema{
|
"advanced_options": &schema.Schema{
|
||||||
Type: schema.TypeMap,
|
Type: schema.TypeMap,
|
||||||
|
@ -269,7 +270,8 @@ func resourceAwsElasticSearchDomainRead(d *schema.ResourceData, meta interface{}
|
||||||
ds := out.DomainStatus
|
ds := out.DomainStatus
|
||||||
|
|
||||||
if ds.AccessPolicies != nil && *ds.AccessPolicies != "" {
|
if ds.AccessPolicies != nil && *ds.AccessPolicies != "" {
|
||||||
d.Set("access_policies", normalizeJson(*ds.AccessPolicies))
|
policies, _ := normalizeJsonString(*ds.AccessPolicies)
|
||||||
|
d.Set("access_policies", policies)
|
||||||
}
|
}
|
||||||
err = d.Set("advanced_options", pointersMapToStringList(ds.AdvancedOptions))
|
err = d.Set("advanced_options", pointersMapToStringList(ds.AdvancedOptions))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue