Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'opensearch' and 'opensearch_info' modules #859

Merged

Conversation

sebastien-rosset
Copy link
Contributor

@sebastien-rosset sebastien-rosset commented Jan 12, 2022

SUMMARY
  1. Add opensearch module to create/update AWS OpenSearch/Elasticsearch domains.
  2. Add opensearch_info module to query AWS OpenSearch/Elasticsearch domains.

Fixes #858

Requires mattclay/aws-terminator#187

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

Creates OpenSearch or ElasticSearch domain.

ADDITIONAL INFORMATION
  1. The minimum version of botocore for these modules is 1.21.38.
  2. The integration tests take more than 4 hours to execute. Tests time out in the CI. I was able to run the integration tests locally.

@markuman
Copy link
Member

It does not come to the integration tests, because of some sanity failures.
You can run it easily locally

ansible-test sanity --python 3.8 plugins/modules/opensearch.py --docker default

@sebastien-rosset
Copy link
Contributor Author

@alinabuzachis , besides the module itself and the integration tests, are there other files I need to add?

@sebastien-rosset
Copy link
Contributor Author

The error below seems unrelated to my changes:

Run command: /root/.ansible/test/venv/sanity.yamllint/3.8/8bc751e2/bin/python /root/ansible/test/lib/ansible_test/_util/controller/tools/yamlcheck.py
Run command: /root/.ansible/test/venv/sanity.yamllint/3.8/8bc751e2/bin/python /root/ansible/test/lib/ansible_test/_util/controller/sanity/yamllint/yamllinter.py
WARNING: There following sanity test virtual environments are out-of-date in the "default" container: sanity-3.8, sanity.ansible-doc-3.8, sanity.changelog-3.8, sanity.import-3.8, sanity.pep8-3.8, sanity.pylint-3.8, sanity.runtime-metadata-3.8, sanity.validate-modules-3.8, sanity.yamllint-3.8
ERROR: The 5 sanity test(s) listed below (out of 32) failed. See error output above for details.
ansible-doc
import --python 3.8
pep8
pylint
validate-modules

Copy link
Contributor

@alinabuzachis alinabuzachis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebastien-rosset I left some initial review comments with some suggestions. But the PR looks really good!

tests/integration/targets/opensearch/aliases Show resolved Hide resolved
tests/integration/targets/opensearch/tasks/main.yml Outdated Show resolved Hide resolved
plugins/modules/opensearch.py Outdated Show resolved Hide resolved
plugins/modules/opensearch.py Outdated Show resolved Hide resolved
plugins/modules/opensearch.py Outdated Show resolved Hide resolved
plugins/modules/opensearch.py Outdated Show resolved Hide resolved
plugins/modules/opensearch.py Outdated Show resolved Hide resolved
plugins/modules/opensearch.py Outdated Show resolved Hide resolved
@alinabuzachis
Copy link
Contributor

@sebastien-rosset These are some validation errors that need to be addressed.

2022-01-13 07:44:14.176284 \| fedora-35 \| ERROR: Found 23 validate-modules issue(s) which need to be resolved:
--
2447 | 2022-01-13 07:44:14.178447 \| fedora-35 \| See documentation for help: https://docs.ansible.com/ansible-core/devel/dev_guide/testing/sanity/validate-modules.html
2448 | 2022-01-13 07:44:14.178502 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-choices-do-not-match-spec: Argument 'state' in argument_spec defines choices as (['present', 'absent']) but documentation defines choices as ([])
2449 | 2022-01-13 07:44:14.178510 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-default-does-not-match-spec: Argument 'enabled' in argument_spec found in cognito_options defines default as (None) but documentation defines default as (False)
2450 | 2022-01-13 07:44:14.178524 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-default-does-not-match-spec: Argument 'engine_version' in argument_spec defines default as (None) but documentation defines default as ('OpenSearch_1.1')
2451 | 2022-01-13 07:44:14.178530 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-default-does-not-match-spec: Argument 'instance_type' in argument_spec found in cluster_config defines default as (None) but documentation defines default as ('t2.small.search')
2452 | 2022-01-13 07:44:14.178599 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-default-does-not-match-spec: Argument 'state' in argument_spec defines default as ('present') but documentation defines default as (None)
2453 | 2022-01-13 07:44:14.178606 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-default-does-not-match-spec: Argument 'warm_enabled' in argument_spec found in cluster_config defines default as (None) but documentation defines default as (False)
2454 | 2022-01-13 07:44:14.178612 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-elements-mismatch: Argument 'security_groups' in argument_spec found in vpc_options specifies elements as str,but elements is not documented
2455 | 2022-01-13 07:44:14.178618 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-elements-mismatch: Argument 'subnets' in argument_spec found in vpc_options specifies elements as str,but elements is not documented
2456 | 2022-01-13 07:44:14.178624 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-missing-type: Argument 'state' in argument_spec uses default type ('str') but documentation doesn't define type
2457 | 2022-01-13 07:44:14.178631 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-required-mismatch: Argument 'enabled' in argument_spec found in ebs_options is not required, but is documented as being required
2458 | 2022-01-13 07:44:14.178636 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-required-mismatch: Argument 'volume_size' in argument_spec found in ebs_options is not required, but is documented as being required
2459 | 2022-01-13 07:44:14.178644 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-required-mismatch: Argument 'volume_type' in argument_spec found in ebs_options is not required, but is documented as being required
2460 | 2022-01-13 07:44:14.178650 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-type-does-not-match-spec: Argument 'cluster_config' in argument_spec defines type as <class 'dict'> but documentation defines type as 'dict'
2461 | 2022-01-13 07:44:14.178656 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-type-does-not-match-spec: Argument 'cognito_options' in argument_spec defines type as <class 'dict'> but documentation defines type as 'dict'
2462 | 2022-01-13 07:44:14.178662 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-type-does-not-match-spec: Argument 'cold_storage_options' in argument_spec found in cluster_config defines type as <class 'dict'> but documentation defines type as 'dict'
2463 | 2022-01-13 07:44:14.178668 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-type-does-not-match-spec: Argument 'ebs_options' in argument_spec defines type as <class 'dict'> but documentation defines type as 'dict'
2464 | 2022-01-13 07:44:14.178678 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-type-does-not-match-spec: Argument 'encryption_at_rest_options' in argument_spec defines type as <class 'dict'> but documentation defines type as 'dict'
2465 | 2022-01-13 07:44:14.178684 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-type-does-not-match-spec: Argument 'node_to_node_encryption_options' in argument_spec defines type as <class 'dict'> but documentation defines type as 'dict'
2466 | 2022-01-13 07:44:14.178690 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-type-does-not-match-spec: Argument 'snapshot_options' in argument_spec defines type as <class 'dict'> but documentation defines type as 'dict'
2467 | 2022-01-13 07:44:14.178696 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: doc-type-does-not-match-spec: Argument 'vpc_options' in argument_spec defines type as <class 'dict'> but documentation defines type as 'dict'
2468 | 2022-01-13 07:44:14.178705 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: no-log-needed: Argument 'roles_key' in argument_spec could be a secret, though doesn't have `no_log` set found in advanced_security_options -> saml
2469 | 2022-01-13 07:44:14.178716 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: no-log-needed: Argument 'subject_key' in argument_spec could be a secret, though doesn't have `no_log` set found in advanced_security_options -> saml
2470 | 2022-01-13 07:44:14.178722 \| fedora-35 \| ERROR: plugins/modules/opensearch.py:0:0: undocumented-parameter: Argument 'state' is listed in the argument_spec, but not documented in the module documentation
2471 | 2022-01-13 07:44:14.210330 \| fedora-35 \| Running sanity test "yamllint"

@sebastien-rosset sebastien-rosset changed the title draft implementation of opensearch module Add opensearch module Jan 13, 2022
@sebastien-rosset sebastien-rosset changed the title Add opensearch module Add 'opensearch' module Jan 13, 2022
@sebastien-rosset
Copy link
Contributor Author

sebastien-rosset commented Jan 14, 2022

It looks like the opensearch service was added in boto3 versions 1.18.38, 1.18.61, 1.20.
However, the integration tests are executed with boto3 version 1.16.0. I see the min version is specified in some of the files? What is the procedure to handle this scenario?

fatal: [testhost]: FAILED! => {
    "boto3_version": "1.16.0",
    "botocore_version": "1.19.0",

@softwarefactory-project-zuul
Copy link
Contributor

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.

requirements.txt Outdated Show resolved Hide resolved
@sebastien-rosset sebastien-rosset marked this pull request as ready for review January 14, 2022 07:17
Copy link
Contributor

@tremble tremble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the time you've spent on this module, it's very much appreciated.

I've not looked too closely at the rest of the code, this review is specifically with regards the boto3/botocore requirements.

Please don't adjust the global botocore/boto3 requirements.

The current collection policy is that we support the version of boto3/botocore released about 1 year prior to our current major release (currently botocore 1.19/boto3 1.16). While folks wanting support for a new AWS service may be happy constantly updating botocore/boto3 this can be frustrating for folks who find that their previously working environment stops working after a minor/patch release of the collection.

Individual modules, and deliberately fenced off features inside other modules can use newer versions of the AWS SDKs, however, they should be explicitly testing for them. Otherwise we do get issues/complaints caused by modules suddenly no longer working because we added support for a new feature they didn't care about. Unfortunately unless you're familiar with the types of errors you'll see it's also non-trivial to diagnose the issue (and non-trivial to automatically catch too).

Manually catching exactly which version a botocore feature was introduced generally doesn't work and as such, to ensure we don't accidentally depend on features from a later release, our tests are deliberately run against the minimum 'supported' version.

Tests for modules/features that need newer versions should themselves by testing against the minimum necessary botocore versions. This can be installed by using the helper role "setup_botocore_pip" and used by defining the ansible_python_interpreter. See ec2_asg_scheduled_action for an example. This mechanism is, unfortunately, currently poorly documented and only needed by a handful of modules, which we should fix.

plugins/modules/opensearch.py Show resolved Hide resolved
plugins/modules/opensearch.py Show resolved Hide resolved
requirements.txt Outdated Show resolved Hide resolved
tests/integration/constraints.txt Outdated Show resolved Hide resolved
tests/unit/constraints.txt Outdated Show resolved Hide resolved
tests/integration/targets/opensearch/meta/main.yml Outdated Show resolved Hide resolved
@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

get domain response on creation

do not set cold storage option if version is less than 7.9

add skeleton integration test

fix doc issues

Add domain endpoint config options

Add policy for test purpose

Add integration tests, fix code such that tests can pass

Add integration tests, fix code such that tests can pass

Add integration tests, fix code such that tests can pass

Add integration tests, fix code such that tests can pass

Fix doc issues, address PR comments

uncomment module defaults. add tasks in check mode

Add more integration tests. Simplify argument spec. Fix linter issues. Add support for check_mode. Remove dead code. Add code comments. Uncomment module defaults

add pylint comments

Add more integration tests with check mode

format code using black to fix pep8 issues

fix integration tests

fix linter issues

add support for advanced security options. Fix linter issue

add more examples

wait until VPC is created

add longer timeout for cluster upgrade test. Handle wait timeout error

Customize wait timeout of integration tests, based on actual execution runtime

fix pylint issues, autotune configuration

add more info to wait timeout status, add unit tests

upgrade boto3 for test purpose. Could be reverted later if needed

add encryption at rest

fix KMV key id parameter

specify version of botocore compatible with boto3

Create/Delete KMS key for encryption at rest, change ES instance type to support encryption at rest

add doc comment

provide test execution timeline

improve integration tests

Add wait for deletion of Cluster

provide test execution timeline

split common functions to module_utils

Specify minimum version of botocore

Co-authored-by: Mark Chappell <mchappel@redhat.com>

Revert changes for boto3 version

Co-authored-by: Mark Chappell <mchappel@redhat.com>

Specify virtual boto environment

Co-authored-by: Mark Chappell <mchappel@redhat.com>

Specify minimum version of botocore

Co-authored-by: Mark Chappell <mchappel@redhat.com>

Revert change for default boto3 version

Co-authored-by: Mark Chappell <mchappel@redhat.com>

Revert change for boto3 version

Co-authored-by: Mark Chappell <mchappel@redhat.com>

Specify minimum version of botocore

Co-authored-by: Mark Chappell <mchappel@redhat.com>

remove import which is no longer needed

improve name of test tasks, add timing information

fix assertion for auto-tune

refactor to simplify code

make auto-tune test more robust

do not raise exception if trying to delete a ES cluster that does not exist

handle deletion of resources in integration tests

Handle case when ES cluster is attached to the Internet

Handle case when ES cluster is attached to the Internet

Handle case when ES cluster is attached to the Internet

add code comments

Handle case when ES cluster is attached to the Internet

renamed ebs_options.enabled to ebs_enabled to make it consistent with the API

improve code comments

Add more test assertions

reformat code

reformat code

fix syntax error in main.yml

use key_arn instead of key_id

format code

custom_endpoint_enabled, fix assertion

fix imports

adding opensearch to runtime.yml, is it used for module defaults?

split the integration test tasks in multiple files

remove extra line

Add route53 zone for custom opensearch endpoint

Add timeout for HTTPs endpoint. Create Route53 CNAME record

Delete Route53 zone

Add blocks

Increase timeout. Set custom endpoint

fix doc issues

move auto-tune at the end of the integration tests

add unit tests. add function to compare versions. add support for upgrade through intermediate versions

improve documentation

don't wait for auto-tune background tasks to complete

fix zone discovery issue when running outside us-east-1. fix name of es cluster, it must start with a letter

fix test assertions

fix code formatting

fix linter issue

move ensure_tags to module_utils

use 'compare_policies'

fix linter issue

fix doc issues

create single block for integration test

add code comments, rename get_domain to get_domain_status

add opensearch_info module

improve integration tests

fix deletion of VPC resources

fix test assertion, add documentation

fix indentation

removed unused variables. Add assertions

fix variable assignment

add test

fix camel_dict for 'Endpoints' attribute

handle case when domain_status is None

move test

fix format issues

fix doc issues

add documentation

move task to obtain endpoints property

route53 is explicitly a global service

mistakenly commented out 'always' block

add 'allow_intermediate_upgrades' parameter

cleanup  route53 records

fix validation issue with upgrade compatible versions

fix doc issues

fix validation issue with upgrade compatible versions

add missing check mode in integration test

add documentation for SAML

improve integration tests

update KMS policy

remove trailing space

reduce time to execute integration tests
@ansibullbot ansibullbot added community_review and removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Mar 21, 2022
@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@alinabuzachis
Copy link
Contributor

recheck

@sebastien-rosset
Copy link
Contributor Author

Is there a chance this will be reviewed?

@ansibullbot ansibullbot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed community_review labels Jun 8, 2022
short_description: Creates OpenSearch or ElasticSearch domain.
description:
- Creates or modify a Amazon OpenSearch Service domain.
version_added: 3.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version_added: 3.1.0
version_added: 4.0.0

short_description: obtain information about one or more OpenSearch or ElasticSearch domain.
description:
- obtain information about one Amazon OpenSearch Service domain.
version_added: 3.1.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version_added: 3.1.0
version_added: 4.0.0

@tremble tremble added the mergeit Merge the PR (SoftwareFactory) label Jun 13, 2022
@tremble tremble dismissed their stale review June 13, 2022 18:48

will clean up once merged

@tremble tremble closed this Jun 13, 2022
@tremble tremble reopened this Jun 13, 2022
@github-actions
Copy link

github-actions bot commented Jun 13, 2022

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

@ansibullbot ansibullbot added community_review and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jun 13, 2022
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

ansible-galaxy-importer FAILURE in 3m 59s (non-voting)
✔️ build-ansible-collection SUCCESS in 4m 45s
✔️ ansible-test-sanity-docker-devel SUCCESS in 9m 59s (non-voting)
✔️ ansible-test-sanity-docker-milestone SUCCESS in 10m 41s
✔️ ansible-test-sanity-docker-stable-2.9 SUCCESS in 13m 02s
✔️ ansible-test-sanity-docker-stable-2.11 SUCCESS in 10m 48s
✔️ ansible-test-sanity-docker-stable-2.12 SUCCESS in 10m 33s
✔️ ansible-test-units-community-aws-python38 SUCCESS in 5m 48s
✔️ ansible-test-units-community-aws-python39 SUCCESS in 5m 52s
✔️ ansible-test-splitter SUCCESS in 2m 52s
⚠️ integration-community.aws-1 SKIPPED
⚠️ integration-community.aws-2 SKIPPED
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

ansible-galaxy-importer FAILURE in 4m 33s (non-voting)
✔️ build-ansible-collection SUCCESS in 4m 41s
✔️ ansible-test-sanity-docker-devel SUCCESS in 10m 07s (non-voting)
✔️ ansible-test-sanity-docker-milestone SUCCESS in 9m 26s
✔️ ansible-test-sanity-docker-stable-2.9 SUCCESS in 13m 27s
✔️ ansible-test-sanity-docker-stable-2.11 SUCCESS in 11m 32s
✔️ ansible-test-sanity-docker-stable-2.12 SUCCESS in 11m 09s
✔️ ansible-test-units-community-aws-python38 SUCCESS in 6m 09s
✔️ ansible-test-units-community-aws-python39 SUCCESS in 5m 59s
✔️ ansible-test-splitter SUCCESS in 2m 35s
⚠️ integration-community.aws-1 SKIPPED
⚠️ integration-community.aws-2 SKIPPED
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit f985c1a into ansible-collections:main Jun 13, 2022
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Jun 14, 2022
opensearch - Minor fixups

SUMMARY
Minor fixups from #859
Module hasn't been release yet, no need for changelog
ISSUE TYPE

Docs Pull Request
Feature Pull Request

COMPONENT NAME
opensearch
opensearch_info
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
abikouo pushed a commit to abikouo/community.aws that referenced this pull request Oct 24, 2023
fix incomplete enforce_count() return values

SUMMARY

This is the Ansible way.
Since a call to enforce_count() requires that a call to find_instances() has already been made, the information required to populate the instances return key is already held by the variable existing_matches. There are zero use cases where it makes sense not to output this information; if I want exactly one such instance and an existing instance matches the filter, I definitely always want to know its details.

Fixes ansible-collections#963, ansible-collections#859
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

ec2_instance
ADDITIONAL INFORMATION


See linked issues.

Before:
{                                                                                                                                                                                                                                                                                                                                                                          
    "changed": false,                                                                                                                                                                                                                                                                                                                                                                         
    "invocation": {                                                                                                                                                                                                                                                                                                                                                                           
        "module_args": {                                                                                                                                                                                                                                                                                                                                                                      
            "availability_zone": null,                                                                                                                                                                                                                                                                                                                                                        
            "aws_access_key": null,                                                                                                                                                                                                                                                                                                                                                           
            "aws_ca_bundle": null,                                                                                                                                                                                                                                                                                                                                                            
            "aws_config": null,                                                                                                                                                                                                                                                                                                                                                               
            "aws_secret_key": null,                                                                                                                                                                                                                                                                                                                                                           
            "count": null,                                                                                                                                                                                                                                                                                                                                                                    
            "cpu_credit_specification": null,                                                                                                                                                                                                                                                                                                                                                 
            "cpu_options": null,                                                                                                                                                                                                                                                                                                                                                              
            "debug_botocore_endpoint_logs": false,                                                                                                                                                                                                                                                                                                                                            
            "detailed_monitoring": false,                                                                                                                                                                                                                                                                                                                                                     
            "ebs_optimized": true,                                                                                                                                                                                                                                                                                                                                                            
            "ec2_url": null,                                                                                                                                                                                                                                                                                                                                                                  
            "exact_count": 1,                                                                                                                                                                                                                                                                                                                                                                 
            "filters": {                                                                                                                                                                                                                                                                                                                                                                      
                "tag:Name": "something",                                                                                                                                                                                                                                                                                                                                             
                "tag:env": "prod"                                                                                                                                                                                                                                                                                                                                                             
            },
            "image": null,                                                                                                                                                                                                                                                                                                                                                                    
            "image_id": "REDACTED",                                                                                                                                                                                                                                                                                                                                              
            "instance_ids": [],                                                                                                                                                                                                                                                                                                                                                               
            "instance_initiated_shutdown_behavior": null,                                                                                                                                                                                                                                                                                                                                     
            "instance_role": "REDACTED",                                                                                                                                                                                                                                                                                                                                                       
            "instance_type": "m5.2xlarge",                                                                                                                                                                                                                                                                                                                                                    
            "key_name": "REDACTED",                                                                                                                                                                                                                                                                                                                                                          
            "launch_template": null,                                                                                                                                                                                                                                                                                                                                                          
            "metadata_options": null,                                                                                                                                                                                                                                                                                                                                                         
            "name": null,                                                                                                                                                                                                                                                                                                                                                                     
            "network": {                                                                                                                                                                                                                                                                                                                                                                      
                "source_dest_check": true                                                                                                                                                                                                                                                                                                                                                     
            },                                                                                                                                                                                                                                                                                                                                                                                
            "placement_group": null,                                                                                                                                                                                                                                                                                                                                                          
            "profile": null,                                                                                                                                                                                                                                                                                                                                                                  
            "purge_tags": false,                                                                                                                                                                                                                                                                                                                                                              
            "region": "us-west-2",                                                                                                                                                                                                                                                                                                                                                            
            "security_group": null,                                                                                                                                                                                                                                                                                                                                                           
            "security_groups": [                                                                                                                                                                                                                                                                                                                                                              
                "default"                                                                                                                                                                                                                                                                                                                                                                     
            ],                                                                                                                                                                                                                                                                                                                                                                                
            "security_token": null,                                                                                                                                                                                                                                                                                                                                                           
            "state": "present",                                                                                                                                                                
            "tags": {                                                                                                                                                                                                                                                                                                                                                                         
                "Name": "something",                                                                                                                                                                                                                                                                                                                                                         
                "env": "prod",
            },
            "tenancy": null,
            "termination_protection": null,
            "tower_callback": null,
            "user_data": "REDACTED",
            "validate_certs": true,
            "volumes": [
                {
                    "device_name": "/dev/sda1",
                    "ebs": {
                        "delete_on_termination": true,
                        "encrypted": true,
                        "volume_size": 20,
                        "volume_type": "gp3"
                    }
                },
                {
                    "device_name": "/dev/xvdo",
                    "ebs": {
                        "delete_on_termination": true,
                        "encrypted": true,
                        "volume_size": 20,
                        "volume_type": "gp3"
                    }
                },
                {
                    "device_name": "/dev/xvdp",
                    "ebs": {
                        "delete_on_termination": true,
                        "encrypted": true,
                        "volume_size": 10,
                        "volume_type": "gp3"
                    }
                },
                {
                    "device_name": "/dev/xvdi",
                    "ebs": {
                        "delete_on_termination": true,
                        "encrypted": true,
                        "volume_size": 100,
                        "volume_type": "gp3"
                    }
                }
            ],
            "vpc_subnet_id": "REDACTED",
            "wait": true,
            "wait_timeout": 300
        }
    },
    "msg": "1 instances already running, nothing to do."
}
After:
{                                                                                                                                                                                                                                                                                                                                                                          
    "changed": false,                                                                                                                                                                                                                                                                                                                                                                         
    "instance_ids": [                                                                                                                                                                                                                                                                                                                                                                         
        "REDACTED"                                                                                                                                                                                                                                                                                                                                                                 
    ],
    "instances": [
        {
            "ami_launch_index": 0,
            "architecture": "x86_64",
            "block_device_mappings": [
                {
                    "device_name": "/dev/sda1",
                    "ebs": {
                        "attach_time": "2022-08-10T19:50:24+00:00",
                        "delete_on_termination": true,
                        "status": "attached",
                        "volume_id": "REDACTED"
                    }
                },
                {
                    "device_name": "/dev/xvdo",
                    "ebs": {
                        "attach_time": "2022-08-10T19:50:24+00:00",
                        "delete_on_termination": true,
                        "status": "attached",
                        "volume_id": "REDACTED"
                    }
                },
                {
                    "device_name": "/dev/xvdp",
                    "ebs": {
                        "attach_time": "2022-08-10T19:50:24+00:00",
                        "delete_on_termination": true,
                        "status": "attached",
                        "volume_id": "REDACTED"
                    }
                },
                {
                    "device_name": "/dev/xvdi",
                    "ebs": {
                        "attach_time": "2022-08-10T19:50:24+00:00",
                        "delete_on_termination": true,
                        "status": "attached",
                        "volume_id": "REDACTED"
                    }
                }
            ],
            "capacity_reservation_specification": {
                "capacity_reservation_preference": "open"
            },
            "client_token": "REDACTED",
            "cpu_options": {
                "core_count": 4,
                "threads_per_core": 2
            },
            "ebs_optimized": true,
            "ena_support": true,
            "enclave_options": {
                "enabled": false
            },
            "hibernation_options": {
                "configured": false
            },
            "hypervisor": "xen",
            "iam_instance_profile": {
                "arn": "REDACTED",
                "id": "REDACTED"
            },
            "image_id": "REDACTED",
            "instance_id": "REDACTED",
            "instance_type": "m5.2xlarge",
            "key_name": "REDACTED",
            "launch_time": "2022-08-10T19:50:23+00:00",
            "maintenance_options": {
                "auto_recovery": "default"
            },
            "metadata_options": {
                "http_endpoint": "enabled",
                "http_protocol_ipv6": "disabled",
                "http_put_response_hop_limit": 1,
                "http_tokens": "optional",
                "instance_metadata_tags": "disabled",
                "state": "applied"
            },
            "monitoring": {
                "state": "disabled"
            },
            "network_interfaces": [
                {
                    "attachment": {
                        "attach_time": "2022-08-10T19:50:23+00:00",
                        "attachment_id": "REDACTED",
                        "delete_on_termination": true,
                        "device_index": 0,
                        "network_card_index": 0,
                        "status": "attached"
                    },
                    "description": "",
                    "groups": [
                        {
                            "group_id": "REDACTED",
                            "group_name": "REDACTED"
                        }
                    ],
                    "interface_type": "interface",
                    "ipv6_addresses": [],
                    "mac_address": "REDACTED",
                    "network_interface_id": "REDACTED",
                    "owner_id": "REDACTED",
                    "private_dns_name": "REDACTED",
                    "private_ip_address": "REDACTED",
                    "private_ip_addresses": [
                        {
                            "primary": true,
                            "private_dns_name": "REDACTED",
                            "private_ip_address": "REDACTED"
                        }
                    ],
                    "source_dest_check": true,
                    "status": "in-use",
                    "subnet_id": "REDACTED",
                    "vpc_id": "REDACTED"
                }
            ],
            "placement": {
                "availability_zone": "us-west-2a",
                "group_name": "",
                "tenancy": "default"
            },
            "platform_details": "Linux/UNIX",
            "private_dns_name": "REDACTED",
            "private_dns_name_options": {
                "enable_resource_name_dns_a_record": false,
                "enable_resource_name_dns_aaaa_record": false,
                "hostname_type": "ip-name"
            },
            "private_ip_address": "REDACTED",
            "product_codes": [],
            "public_dns_name": "",
            "root_device_name": "/dev/sda1",
            "root_device_type": "ebs",
            "security_groups": [
                {
                    "group_id": "REDACTED",
                    "group_name": "REDACTED"
                }
            ],
            "source_dest_check": true,
            "state": {
                "code": 16,
                "name": "running"
            },
            "state_transition_reason": "",
            "subnet_id": "REDACTED",
            "tags": {
                "Name": "something",
                "env": "prod",
            },
            "usage_operation": "RunInstances",
            "usage_operation_update_time": "2022-08-10T19:50:23+00:00",
            "virtualization_type": "hvm",
            "vpc_id": "REDACTED"
        }
    ],
    "invocation": {                                                                                                                                                                                                                                                                                                                                                                           
        "module_args": {                                                                                                                                                                                                                                                                                                                                                                      
            "availability_zone": null,                                                                                                                                                                                                                                                                                                                                                        
            "aws_access_key": null,                                                                                                                                                                                                                                                                                                                                                           
            "aws_ca_bundle": null,                                                                                                                                                                                                                                                                                                                                                            
            "aws_config": null,                                                                                                                                                                                                                                                                                                                                                               
            "aws_secret_key": null,                                                                                                                                                                                                                                                                                                                                                           
            "count": null,                                                                                                                                                                                                                                                                                                                                                                    
            "cpu_credit_specification": null,                                                                                                                                                                                                                                                                                                                                                 
            "cpu_options": null,                                                                                                                                                                                                                                                                                                                                                              
            "debug_botocore_endpoint_logs": false,                                                                                                                                                                                                                                                                                                                                            
            "detailed_monitoring": false,                                                                                                                                                                                                                                                                                                                                                     
            "ebs_optimized": true,                                                                                                                                                                                                                                                                                                                                                            
            "ec2_url": null,                                                                                                                                                                                                                                                                                                                                                                  
            "exact_count": 1,                                                                                                                                                                                                                                                                                                                                                                 
            "filters": {                                                                                                                                                                                                                                                                                                                                                                      
                "tag:Name": "something",                                                                                                                                                                                                                                                                                                                                             
                "tag:env": "prod"                                                                                                                                                                                                                                                                                                                                                             
            },
            "image": null,                                                                                                                                                                                                                                                                                                                                                                    
            "image_id": "REDACTED",                                                                                                                                                                                                                                                                                                                                              
            "instance_ids": [],                                                                                                                                                                                                                                                                                                                                                               
            "instance_initiated_shutdown_behavior": null,                                                                                                                                                                                                                                                                                                                                     
            "instance_role": "REDACTED",                                                                                                                                                                                                                                                                                                                                                       
            "instance_type": "m5.2xlarge",                                                                                                                                                                                                                                                                                                                                                    
            "key_name": "REDACTED",                                                                                                                                                                                                                                                                                                                                                          
            "launch_template": null,                                                                                                                                                                                                                                                                                                                                                          
            "metadata_options": null,                                                                                                                                                                                                                                                                                                                                                         
            "name": null,                                                                                                                                                                                                                                                                                                                                                                     
            "network": {                                                                                                                                                                                                                                                                                                                                                                      
                "source_dest_check": true                                                                                                                                                                                                                                                                                                                                                     
            },                                                                                                                                                                                                                                                                                                                                                                                
            "placement_group": null,                                                                                                                                                                                                                                                                                                                                                          
            "profile": null,                                                                                                                                                                                                                                                                                                                                                                  
            "purge_tags": false,                                                                                                                                                                                                                                                                                                                                                              
            "region": "us-west-2",                                                                                                                                                                                                                                                                                                                                                            
            "security_group": null,                                                                                                                                                                                                                                                                                                                                                           
            "security_groups": [                                                                                                                                                                                                                                                                                                                                                              
                "default"                                                                                                                                                                                                                                                                                                                                                                     
            ],                                                                                                                                                                                                                                                                                                                                                                                
            "security_token": null,                                                                                                                                                                                                                                                                                                                                                           
            "state": "present",                                                                                                                                                                
            "tags": {                                                                                                                                                                                                                                                                                                                                                                         
                "Name": "something",                                                                                                                                                                                                                                                                                                                                                         
                "env": "prod",
            },
            "tenancy": null,
            "termination_protection": null,
            "tower_callback": null,
            "user_data": "REDACTED",
            "validate_certs": true,
            "volumes": [
                {
                    "device_name": "/dev/sda1",
                    "ebs": {
                        "delete_on_termination": true,
                        "encrypted": true,
                        "volume_size": 20,
                        "volume_type": "gp3"
                    }
                },
                {
                    "device_name": "/dev/xvdo",
                    "ebs": {
                        "delete_on_termination": true,
                        "encrypted": true,
                        "volume_size": 20,
                        "volume_type": "gp3"
                    }
                },
                {
                    "device_name": "/dev/xvdp",
                    "ebs": {
                        "delete_on_termination": true,
                        "encrypted": true,
                        "volume_size": 10,
                        "volume_type": "gp3"
                    }
                },
                {
                    "device_name": "/dev/xvdi",
                    "ebs": {
                        "delete_on_termination": true,
                        "encrypted": true,
                        "volume_size": 100,
                        "volume_type": "gp3"
                    }
                }
            ],
            "vpc_subnet_id": "REDACTED",
            "wait": true,
            "wait_timeout": 300
        }
    },
    "msg": "1 instances already running, nothing to do."
}

Reviewed-by: Alina Buzachis
Reviewed-by: Mark Chappell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community_review has_issue integration tests/integration mergeit Merge the PR (SoftwareFactory) module module new_module New module new_plugin New plugin plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenSearch, ElasticSearch module
6 participants