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

route53: error when creating records in private zone with vpc_id #509

Closed
boutetnico opened this issue Mar 29, 2021 · 2 comments · Fixed by #510
Closed

route53: error when creating records in private zone with vpc_id #509

boutetnico opened this issue Mar 29, 2021 · 2 comments · Fixed by #510
Labels
bug This issue/PR relates to a bug has_pr module module needs_triage plugins plugin (any type) python3 traceback

Comments

@boutetnico
Copy link
Contributor

SUMMARY

route53 has a special behaviour when working on private zones and vpc_id option is provided. As stated in documentation:

When used in conjunction with private_zone: true, this will only modify records in the private hosted zone attached to this VPC.
This allows you to have multiple private hosted zones, all with the same name, attached to different VPCs.

The following error occurs when creating or updating a record in such zone: AttributeError: 'dict' object has no attribute 'id'.

In case anyone wonders, this is not a duplicate of #434 because no vpc_id option is used there.

I'll provide a PR soon.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

route53

ANSIBLE VERSION
ansible 2.10.5
  config file = /home/admin/ansible/ansible.cfg
  configured module search path = ['/home/admin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
CONFIGURATION
ALLOW_WORLD_READABLE_TMPFILES(/home/admin/ansible/ansible.cfg) = True
ANSIBLE_SSH_CONTROL_PATH(/home/admin/ansible/ansible.cfg) = %(directory)s/%%h-%%p-%%r
DEFAULT_NO_TARGET_SYSLOG(/home/admin/ansible/ansible.cfg) = True
DEFAULT_ROLES_PATH(/home/admin/ansible/ansible.cfg) = ['/home/admin/ansible/roles']
INTERPRETER_PYTHON(/home/admin/ansible/ansible.cfg) = /usr/bin/python3
RETRY_FILES_ENABLED(/home/admin/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Debian 10

STEPS TO REPRODUCE

Ensure a private zone exists, then run the following task.

- hosts: all
  tasks:
      route53:
        aws_access_key: "{{ aws_access_key }}"
        aws_secret_key: "{{ aws_secret_key }}"
        overwrite: true
        private_zone: true
        record: "test-ansible.internal.example.com"
        state: present
        type: A
        value: "1.2.3.4"
        vpc_id: vpc-xyz1234
        zone: "internal.example.com"
EXPECTED RESULTS

The record is created inside the zone.

ACTUAL RESULTS

An error occured.

The full traceback is:
Traceback (most recent call last):
  File "/home/admin/.ansible/tmp/ansible-tmp-1617023331.5792427-11521-49668929273150/AnsiballZ_route53.py", line 102, in <module>
    _ansiballz_main()
  File "/home/admin/.ansible/tmp/ansible-tmp-1617023331.5792427-11521-49668929273150/AnsiballZ_route53.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/admin/.ansible/tmp/ansible-tmp-1617023331.5792427-11521-49668929273150/AnsiballZ_route53.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.community.aws.plugins.modules.route53', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_route53_payload_n6znsp0f/ansible_route53_payload.zip/ansible_collections/community/aws/plugins/modules/route53.py", line 626, in <module>
  File "/tmp/ansible_route53_payload_n6znsp0f/ansible_route53_payload.zip/ansible_collections/community/aws/plugins/modules/route53.py", line 529, in main
  File "/tmp/ansible_route53_payload_n6znsp0f/ansible_route53_payload.zip/ansible_collections/community/aws/plugins/modules/route53.py", line 413, in get_zone_id_by_name
AttributeError: 'dict' object has no attribute 'id'
@ansibullbot
Copy link

Files identified in the description:

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
Copy link

@ansibullbot ansibullbot added bug This issue/PR relates to a bug has_pr module module needs_triage plugins plugin (any type) python3 traceback labels Mar 29, 2021
alinabuzachis pushed a commit to alinabuzachis/community.aws that referenced this issue May 25, 2022
ec2_vol: Add check_mode support to ec2_vol

SUMMARY

Add check_mode support to ec2_vol.

ISSUE TYPE


Feature Pull Request

COMPONENT NAME

ec2_vol

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Mandar Kulkarni <[email protected]>
Reviewed-by: Jill R <None>
Reviewed-by: Mark Chappell <None>
Reviewed-by: None <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug has_pr module module needs_triage plugins plugin (any type) python3 traceback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants