diff --git a/changelogs/fragments/975-waiters-eks_nodegroup.yml b/changelogs/fragments/975-waiters-eks_nodegroup.yml new file mode 100644 index 00000000000..67d6f939a49 --- /dev/null +++ b/changelogs/fragments/975-waiters-eks_nodegroup.yml @@ -0,0 +1,2 @@ +minor_changes: +- module_utils/waiters - Add waiters to manage eks_nodegroup module (https://github.com/ansible-collections/community.aws/pull/1415). \ No newline at end of file diff --git a/plugins/module_utils/waiters.py b/plugins/module_utils/waiters.py index 078894cb673..2abf390cbcf 100644 --- a/plugins/module_utils/waiters.py +++ b/plugins/module_utils/waiters.py @@ -535,6 +535,42 @@ "expected": "ResourceNotFoundException" } ] + }, + "NodegroupActive": { + "delay": 20, + "maxAttempts": 60, + "operation": "DescribeNodegroup", + "acceptors": [ + { + "state": "success", + "matcher": "path", + "argument": "nodegroup.status", + "expected": "ACTIVE" + }, + { + "state": "retry", + "matcher": "error", + "expected": "ResourceNotFoundException" + } + ] + }, + "NodegroupDeleted": { + "delay": 20, + "maxAttempts": 60, + "operation": "DescribeNodegroup", + "acceptors": [ + { + "state": "retry", + "matcher": "path", + "argument": "nodegroup.status == 'DELETING'", + "expected": True + }, + { + "state": "success", + "matcher": "error", + "expected": "ResourceNotFoundException" + } + ] } } } @@ -1108,6 +1144,18 @@ def route53_model(name): core_waiter.NormalizedOperationMethod( eks.describe_fargate_profile )), + ('EKS', 'nodegroup_active'): lambda eks: core_waiter.Waiter( + 'nodegroup_active', + eks_model('NodegroupActive'), + core_waiter.NormalizedOperationMethod( + eks.describe_nodegroup + )), + ('EKS', 'nodegroup_deleted'): lambda eks: core_waiter.Waiter( + 'nodegroup_deleted', + eks_model('NodegroupDeleted'), + core_waiter.NormalizedOperationMethod( + eks.describe_nodegroup + )), ('ElasticLoadBalancing', 'any_instance_in_service'): lambda elb: core_waiter.Waiter( 'any_instance_in_service', elb_model('AnyInstanceInService'),