diff --git a/changelogs/fragments/2162-opensearch-remove-current-state-parameter.yml b/changelogs/fragments/2162-opensearch-remove-current-state-parameter.yml new file mode 100644 index 00000000000..218b23111ba --- /dev/null +++ b/changelogs/fragments/2162-opensearch-remove-current-state-parameter.yml @@ -0,0 +1,2 @@ +bugfixes: + - opensearch - Remove CurrentState parameter from the domain config (https://github.com/ansible-collections/community.aws/pull/2162). diff --git a/plugins/module_utils/opensearch.py b/plugins/module_utils/opensearch.py index 13d90bd6a78..6d9c296fec7 100644 --- a/plugins/module_utils/opensearch.py +++ b/plugins/module_utils/opensearch.py @@ -63,6 +63,10 @@ def get_domain_config(client, module, domain_name): for k in response["DomainConfig"]: if "Options" in response["DomainConfig"][k]: domain_config[k] = response["DomainConfig"][k]["Options"] + # describe_domain_config method returns both CurrentState and DesiredState + # while update_domain_config only expects DesiredState + if k == "AIMLOptions" and "CurrentState" in domain_config[k]: + del domain_config[k]["AIMLOptions"]["CurrentState"] domain_config["DomainName"] = domain_name # If ES cluster is attached to the Internet, the "VPCOptions" property is not present. if "VPCOptions" in domain_config: