Skip to content

opensearch Module Fails to Update Existing Domains #2161

Open
@ichekaldin

Description

@ichekaldin

Summary

opensearch module fails to update existing domains with the following error:

Couldn't update domain example-name: Parameter validation failed:\nUnknown parameter in AIMLOptions.NaturalLanguageQueryGenerationOptions: \"CurrentState\", must be one of: DesiredState

I believe this happens because describe_domain_config method returns the following values under AIMLOptions.Options.NaturalLanguageQueryGenerationOptions:

          'AIMLOptions': {
            'Options': {
                'NaturalLanguageQueryGenerationOptions': {
                    'DesiredState': 'ENABLED'|'DISABLED',
                    'CurrentState': 'NOT_ENABLED'|'ENABLE_COMPLETE'|'ENABLE_IN_PROGRESS'|'ENABLE_FAILED'|'DISABLE_COMPLETE'|'DISABLE_IN_PROGRESS'|'DISABLE_FAILED'
                }
            },
...

whereas update_domain_config method expects only DesiredState:

    AIMLOptions={
        'NaturalLanguageQueryGenerationOptions': {
            'DesiredState': 'ENABLED'|'DISABLED'
        }
    }

I believe this can be fixed by removing CurrentState in get_domain_config method in plugins/module_utils/opensearch.py

Issue Type

Bug Report

Component Name

opensearch

Ansible Version

$ ansible --version
ansible [core 2.17.4]
  config file = /Users/placeholder/.ansible.cfg
  configured module search path = [''/usr/share/ansible/plugins/modules']
  ansible collection location = /Users/placeholder/.ansible/collections:
  python version = 3.12.6 (main, Sep  6 2024, 19:03:47) [Clang 15.0.0 (clang-1500.3.9.4)]
  jinja version = 3.1.4
  libyaml = True

Collection Versions

$ ansible-galaxy collection list
Collection            Version
--------------------- -------
amazon.aws            8.2.1  
ansible.netcommon     7.1.0  
ansible.posix         1.6.0  
ansible.utils         5.1.1  
community.aws         8.0.0  
community.general     9.4.0  

AWS SDK versions

$ pip show boto boto3 botocore
Name: boto3
Version: 1.35.29
---
Name: botocore
Version: 1.35.29

Configuration

No response

OS / Environment

No response

Steps to Reproduce

- community.aws.opensearch:
    domain_name: example
    access_policies: "{{ access_policy }}"
    cluster_config:
      availability_zone_count: 3
      dedicated_master: false
      instance_count: 3
      instance_type: t3.medium.search
      zone_awareness: true
    domain_endpoint_options:
      enforce_https: true
      tls_security_policy: Policy-Min-TLS-1-2-2019-07'
    ebs_options:
      ebs_enabled: true
      volume_size: 25
      volume_type: gp3
    engine_version: OpenSearch_1.3
    vpc_options:
      security_groups:
        - sg-1234abcd
      subnets:
        - subnet-1234abcd
        - subnet-1234abce
        - subnet-1234abcf
    wait: true
    wait_timeout: 1500
    state: present

Expected Results

Opensearch domain is updated.

Actual Results

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Unknown parameter in AIMLOptions.NaturalLanguageQueryGenerationOptions: "CurrentState", must be one of: DesiredState
fatal: [localhost]: FAILED! => {"boto3_version": "1.35.29", "botocore_version": "1.35.29", "changed": false, "msg": "Couldn't update domain example-name: Parameter validation failed:\nUnknown parameter in AIMLOptions.NaturalLanguageQueryGenerationOptions: \"CurrentState\", must be one of: DesiredState"}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions