community.aws icon indicating copy to clipboard operation
community.aws copied to clipboard

List of community modules without integration tests

Open alinabuzachis opened this issue 3 years ago • 5 comments

Summary

The following modules do not have integrations tests:

  • [ ] application_scaling_policy
  • [ ] batch_compute_environment
  • [ ] batch_job_definition
  • [ ] batch_job_queue
  • [ ] cloudfront_distribution_info (cloudfront_distribution tests also broken)
  • [ ] cloudfront_invalidation
  • [ ] cloudfront_origin_access_identity
  • [x] cloudwatchevent_rule
  • [x] cloudwatchlogs_log_group_info
  • [ ] data_pipeline
  • [ ] directconnect_confirm_connection
  • [ ] directconnect_connection
  • [ ] directconnect_gateway
  • [ ] directconnect_link_aggregation_group
  • [ ] directconnect_virtual_interface
  • [ ] dynamodb_ttl
  • [ ] ec2_ami_copy
  • [x] ec2_asg_lifecycle_hook
  • [ ] ec2_customer_gateway
  • [ ] ec2_customer_gateway_info
  • [ ] ec2_snapshot_copy
  • [x] ec2_vpc_vgw_info
  • [x] ec2_vpc_vpn
  • [ ] ec2_win_password
  • [ ] ecs_attribute
  • [x] elasticache_info
  • [ ] elasticache_parameter_group
  • [ ] elasticache_snapshot
  • [x] elb_target_group_info
  • [ ] iam_mfa_device_info (no matching iam_mfa_device module)
  • [x] lambda_event
  • [x] rds_instance_snapshot
  • [x] rds_snapshot_info
  • [ ] redshift_cross_region_snapshots
  • [ ] s3_cors
  • [ ] s3_website
  • [ ] storagegateway_info (no matching storagegateway module)
  • [ ] sts_session_token (needs access to a user/password - may need to be unsupported)

Issue Type

Feature Idea

Component Name

Several modules

Additional Information


Code of Conduct

  • [X] I agree to follow the Ansible Code of Conduct

alinabuzachis avatar Mar 14 '22 12:03 alinabuzachis

Files identified in the description: None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Mar 14 '22 12:03 ansibullbot

*_info can be linked to the non info counterparts on most occasions I think, so that shouldn't be too hard to cover

marknet15 avatar Mar 15 '22 11:03 marknet15

@marknet15 Yes, exactly. At the moment, I didn't link them because the _info modules were not really used by the non info counterparts. I think we should have a couple of tasks using the _info module at least.

alinabuzachis avatar Mar 15 '22 13:03 alinabuzachis

aws_sgw_info

this is a very hard one, because there is no module to create a storage gateway yet.

markuman avatar Apr 06 '22 13:04 markuman

aws_sgw_info

this is a very hard one, because there is no module to create a storage gateway yet.

a few words more about the storage gateway (sgw).

To deploy a storage gateway, you'll need to deploy an EC2 instance with a special ami. easy.
Now it comes to the registration process. This is how we handle this.

- name: init sgw
  block:

    - name: get activation code
      uri:
        url: "http://{{ sgw_instance.instances[0].private_ip_address }}/?activationRegion={{ region }}"
        method: GET
        return_content: yes
      register: ACTICATION_TOKEN
      retries: 10
      delay: 30
      until: ACTICATION_TOKEN is not failed

    - name: register new sgw
      command: aws storagegateway activate-gateway \
        --activation-key {{ ACTICATION_TOKEN.url.split('activationKey=')[-1] }} \
        --gateway-name {{ sgw_name }} \
        --gateway-timezone GMT+1:00 \
        --gateway-region {{ region }} \
        --gateway-type FILE_S3

    - name: "list sgw: retries until gateway_operational_state is connected"
      aws_sgw_info:
        region: "{{ region }}"
        gather_file_shares: yes
        gather_local_disks: yes
        gather_tapes: no
        gather_volumes: no
      register: sgwfacts
      retries: 10
      delay: 30
      until: sgwfacts is not failed

After the instance has bootet, it took 1-3 minutes until you can curl the registration code. For this the node that runs the integration test must be

  • integrated in the VPC (in case of working with private ip)
  • or the EC2 instance needs a public IP where port 80 is available for the integration test node

To archive idempotent here, this block is only executed if the sgw isn't connected/available already

- name: list sgw
  aws_sgw_info:
    region: "{{ region }}"
    gather_file_shares: yes
    gather_local_disks: yes
    gather_tapes: no
    gather_volumes: no
  register: sgwfacts

- name: merge sgw names
  set_fact:
    sgws: "{{ sgwfacts.gateways |  map(attribute='gateway_name') | list }}"

- include_tasks: init_sgw.yml
  when: sgw_name not in sgws

So at the end, to test aws_sgw_info module, we'll need at least a sgw_activate_gateway (or some similar name, when it should also be used to delete the sgw) module, where this modules include also fetch of the registration code

- community.aws.sgw_activate_gateway:
    name: "{{ sgw_name }}"
    state: ['present','absent']
    ip: 1.2.3.4

...but it's also possible to glue everything with other modules together 😎

markuman avatar Apr 07 '22 04:04 markuman