neoave / mrack

Multicloud use-case based multihost async provisioner for CIs and testing during development
Apache License 2.0
11 stars 14 forks source link

feat(AWS): Move tagging into creation request itself #175

Closed Tiboris closed 2 years ago

Tiboris commented 2 years ago

Move tagging into creation request itself

When the creation of the instance is too slow on the ec2 side we get a traceback that instance does not exist (yet) and we need would need to wait a bit in order to tag it. Move tagging into request itself and do it at instance creation

adding some trivial patches:

Tiboris commented 2 years ago

This could solve https://github.com/neoave/mrack/issues/173

pvoborni commented 2 years ago

Hi, it will be cleaner and probably more maintainable to do the tagging after official wait. I.e. introduce e.g. in base provider a post-provision action. Create a 'tagging' method in the aws provider and call this method in and override of the post-provision-action method.

Tiboris commented 2 years ago

Makes sense let me do it.

dav-pascual commented 2 years ago

I found an alternative solution. You can set the tags in the moment of EC2 instance creation including the parameter TagSpecifications in create_instances See reference https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.ServiceResource.create_instances

Tiboris commented 2 years ago

I went with @dav-pascual solution for that. :)

pvoborni commented 2 years ago

Yes, that's simpler and better solution.