Skip to content

Commit

Permalink
ec2_eni - Migrate to boto3 (ansible-collections#142)
Browse files Browse the repository at this point in the history
* ec2_eni: Move to boto3, add support for tags and name

Initial port from ansible/ansible#54950
Co-authored-by: Mike Healey <[email protected]>
Co-authored-by: Tim <[email protected]>
Co-authored-by: s-hertel <[email protected]>

* early retry - doesn't do anything

* Use random CIDR for VPC to reduce the risk of conflicts
Start the ec2 instances early so we don't need to wait so long for them

* Add AWSRetry to ec2_eni_info

* ec2_eni_info - Add support for eni_id

* Add minimal tests for ec2_eni
Fix association / attachment documentation
- Technically this changed with the boto2 -> boto3 migration.
  Since it's been this way for so long (Ansible 2.5), don't try adding backwards compatibility.

* Add retries to ec2_eni

* Add 'tags' as an output for ec2_eni_info for consistency

* Purging IP addresses sometimes takes time.

* Update version_added
  • Loading branch information
tremble authored Sep 25, 2020
1 parent e4bf840 commit 83bba4d
Show file tree
Hide file tree
Showing 14 changed files with 1,878 additions and 172 deletions.
6 changes: 6 additions & 0 deletions changelogs/fragments/141-ec2_eni-boto3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
minor_changes:
- ec2_eni - Port ec2_eni module to boto3 and add an integration test suite.
- ec2_eni - Add support for tagging.
- ec2_eni_info - Add retries on transient AWS failures.
- ec2_eni_info - Add support for providing an ENI ID.
24 changes: 24 additions & 0 deletions plugins/module_utils/waiters.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,24 @@
},
]
},
"NetworkInterfaceAttached": {
"operation": "DescribeNetworkInterfaces",
"delay": 5,
"maxAttempts": 40,
"acceptors": [
{
"expected": "attached",
"matcher": "pathAll",
"state": "success",
"argument": "NetworkInterfaces[].Attachment.Status"
},
{
"expected": "InvalidNetworkInterfaceID.NotFound",
"matcher": "error",
"state": "failure"
},
]
},
"RouteTableExists": {
"delay": 5,
"maxAttempts": 40,
Expand Down Expand Up @@ -304,6 +322,12 @@ def rds_model(name):
core_waiter.NormalizedOperationMethod(
ec2.describe_internet_gateways
)),
('EC2', 'network_interface_attached'): lambda ec2: core_waiter.Waiter(
'network_interface_attached',
ec2_model('NetworkInterfaceAttached'),
core_waiter.NormalizedOperationMethod(
ec2.describe_network_interfaces
)),
('EC2', 'route_table_exists'): lambda ec2: core_waiter.Waiter(
'route_table_exists',
ec2_model('RouteTableExists'),
Expand Down
Loading

0 comments on commit 83bba4d

Please sign in to comment.