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_health_check - Name tag lost on 2nd deploy #1188

Closed
1 task done
anjo-swe opened this issue Oct 20, 2022 · 3 comments · Fixed by #1253
Closed
1 task done

route53_health_check - Name tag lost on 2nd deploy #1188

anjo-swe opened this issue Oct 20, 2022 · 3 comments · Fixed by #1253
Assignees
Labels
bug This issue/PR relates to a bug has_pr jira module module plugins plugin (any type) python3

Comments

@anjo-swe
Copy link
Contributor

Summary

When updating a Route53 health check the Name tag is removed when using health_check_name: my-health-check

Tag is initially added by

tags['Name'] = health_check_name

Issue Type

Bug Report

Component Name

route53_health_check

Ansible Version

$ ansible --version

ansible [core 2.12.2]
  config file = /Users/<USER>/Source/dataintelligence-ansible/ansible.cfg
  configured module search path = ['/Users/<USER>/Source/dataintelligence-ansible/library']
  ansible python module location = /Users/<USER>/Source/dataintelligence-ansible/.runtime/.pyvenv/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/<USER>/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/<USER>/Source/dataintelligence-ansible/.runtime/.pyvenv/bin/ansible
  python version = 3.9.8 (main, Nov 18 2021, 16:08:04) [Clang 12.0.5 (clang-1205.0.22.9)]
  jinja version = 2.11.3
  libyaml = True

Collection Versions

Manually added https://github.com/ansible-collections/amazon.aws/blob/5.0.2/plugins/modules/route53_health_check.py to my local Ansible

AWS SDK versions

$ pip show boto boto3 botocore

Name: boto
Version: 2.49.0
Summary: Amazon Web Services Library
Home-page: https://github.com/boto/boto/
Author: Mitch Garnaat
Author-email: [email protected]
License: MIT
Location: /Users/<USER>/Source/dataintelligence-ansible/.runtime/.pyvenv/lib/python3.9/site-packages
Requires:
Required-by:
---
Name: boto3
Version: 1.20.48
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email:
License: Apache License 2.0
Location: /Users/<USER>/Source/dataintelligence-ansible/.runtime/.pyvenv/lib/python3.9/site-packages
Requires: botocore, jmespath, s3transfer
Required-by: aws-sam-cli, aws-sam-translator, serverlessrepo
---
Name: botocore
Version: 1.23.48
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email:
License: Apache License 2.0
Location: /Users/<USER>/Source/dataintelligence-ansible/.runtime/.pyvenv/lib/python3.9/site-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: awscli, boto3, s3transfer

Configuration

$ ansible-config dump --only-changed

OS / Environment

macOS 11.6

Steps to Reproduce

Run the following playbook twice

---
- hosts: localhost
  tasks:
    - name: Create a health-check
      route53_health_check:
        health_check_name: my-health-check
        use_unique_names: true
        fqdn: ***
        type: HTTPS
        resource_path: /
        request_interval: 30
        failure_threshold: 3
        tags:
          Service: my-service
          Owner: some-owner
          Lifecycle: dev
      register: my_health_check

Expected Results

Name tag added during first run and never removed

Actual Results

First run: Health check created, Name tag added

changed: [localhost] => changed=true
  health_check:
    action: create
    caller_reference: ***
    health_check_config:
      disabled: false
      enable_sni: true
      failure_threshold: 3
      fully_qualified_domain_name: ***
      inverted: false
      measure_latency: false
      port: 443
      request_interval: 30
      resource_path: /
      type: HTTPS
    health_check_version: 1
    id: ***
    tags:
      Lifecycle: dev
      Name: my-health-check
      Owner: some-owner
      Service: my-service

Second run: Health check marked as changed (expected noop [ok]), Name tag removed (not expected)

changed: [localhost] => changed=true
  health_check:
    action: null
    caller_reference: ***
    health_check_config:
      disabled: false
      enable_sni: true
      failure_threshold: 3
      fully_qualified_domain_name: ***
      inverted: false
      measure_latency: false
      port: 443
      request_interval: 30
      resource_path: /
      type: HTTPS
    health_check_version: 1
    id: ***
    tags:
      Lifecycle: dev
      Owner: some-owner
      Service: my-service

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@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

@mandar242
Copy link
Contributor

@anjo-swe thank you for reporting this issue!
I've opened a PR which would likely fix this. #1253
If possible, it would be great if you can test the patch with your current issue and let me know if that solved it.
Thanks!

softwarefactory-project-zuul bot pushed a commit that referenced this issue Nov 29, 2022
…1253)

route53_health_check: Fix "Name" tag key removal idempotentcy issue

SUMMARY
Depends-On: #1280

Fixes #1188

When using health_check_name as unique identifier (setting use_unique_names: True and providing a health_check_name) and health_check tags are set,
Current logic for adding name to a health_check causes an issue when rerunning the create/update task.
While ideally it should be idempotent, it removes the 'Name' tag (used for health_check_name) causing removal of health check name.
ISSUE TYPE


Bugfix Pull Request

COMPONENT NAME

route53_health_check
ADDITIONAL INFORMATION


To test, run the following sample playbook task twice
Expected output: Health check name should not disapper (i.e. 'Name' tag should not get removed on rerun)

---
- hosts: localhost
  gather_facts: False
  tasks:
    - name: Create a health-check
      amazon.aws.route53_health_check:
        health_check_name: my-test-hc
        use_unique_names: true
        fqdn: my-test-xyz.com
        type: HTTPS
        resource_path: /
        request_interval: 30
        failure_threshold: 3
        tags:
          Service: my-service
          Owner: my-test-xyz
          Lifecycle: dev

Reviewed-by: Mark Chappell <None>
Reviewed-by: GomathiselviS <None>
Reviewed-by: Mandar Kulkarni <[email protected]>
Reviewed-by: Mike Graves <[email protected]>
Reviewed-by: Gonéri Le Bouder <[email protected]>
Reviewed-by: Alina Buzachis <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 jira module module plugins plugin (any type) python3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants