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

Use tiny_prefix to limit the length of the 'unique' component of ELB name #406

Merged
merged 2 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tests/integration/targets/ec2_elb_lb/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# defaults file for test_ec2_eip
tag_prefix: '{{resource_prefix}}'
# defaults file for ec2_elb_lb
unique_id: "{{ resource_prefix | hash('md5') | truncate(16, True, '') }}"
elb_name: 'ansible-test-{{ unique_id }}'
22 changes: 11 additions & 11 deletions tests/integration/targets/ec2_elb_lb/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

- name: Create ELB
ec2_elb_lb:
name: "{{ tag_prefix }}"
name: "{{ elb_name }}"
state: present
zones:
- "{{ aws_region }}a"
Expand Down Expand Up @@ -98,7 +98,7 @@

- name: Change AZ's
ec2_elb_lb:
name: "{{ tag_prefix }}"
name: "{{ elb_name }}"
state: present
zones:
- "{{ aws_region }}c"
Expand Down Expand Up @@ -131,7 +131,7 @@

- name: Update AZ's
ec2_elb_lb:
name: "{{ tag_prefix }}"
name: "{{ elb_name }}"
state: present
zones:
- "{{ aws_region }}a"
Expand Down Expand Up @@ -159,7 +159,7 @@

- name: Purge Listeners
ec2_elb_lb:
name: "{{ tag_prefix }}"
name: "{{ elb_name }}"
state: present
zones:
- "{{ aws_region }}a"
Expand Down Expand Up @@ -187,7 +187,7 @@

- name: Add Listeners
ec2_elb_lb:
name: "{{ tag_prefix }}"
name: "{{ elb_name }}"
state: present
zones:
- "{{ aws_region }}a"
Expand Down Expand Up @@ -227,7 +227,7 @@
# ============================================================
- name: test with only name (state missing)
ec2_elb_lb:
name: "{{ tag_prefix }}"
name: "{{ elb_name }}"
register: result
ignore_errors: true

Expand All @@ -241,7 +241,7 @@
# ============================================================
- name: test invalid region parameter
ec2_elb_lb:
name: "{{ tag_prefix }}"
name: "{{ elb_name }}"
state: present
region: 'asdf querty 1234'
zones:
Expand All @@ -265,7 +265,7 @@
# ============================================================
- name: test no authentication parameters
ec2_elb_lb:
name: "{{ tag_prefix }}"
name: "{{ elb_name }}"
state: present
aws_access_key: '{{ omit }}'
aws_secret_key: '{{ omit }}'
Expand All @@ -291,7 +291,7 @@
# ============================================================
- name: test credentials from environment
ec2_elb_lb:
name: "{{ tag_prefix }}"
name: "{{ elb_name }}"
state: present
aws_access_key: "{{ omit }}"
aws_secret_key: "{{ omit }}"
Expand Down Expand Up @@ -322,13 +322,13 @@
# ============================================================
- name: remove the test load balancer completely
ec2_elb_lb:
name: "{{ tag_prefix }}"
name: "{{ elb_name }}"
state: absent
register: result

- name: assert the load balancer was removed
assert:
that:
- 'result.changed'
- 'result.elb.name == "{{tag_prefix}}"'
- 'result.elb.name == "{{ elb_name }}"'
- 'result.elb.status == "deleted"'