Skip to content

Commit

Permalink
Add ResourceType on ec2 snapshot copy (ansible-collections#1419)
Browse files Browse the repository at this point in the history
Add ResourceType on ec2 snapshot copy

SUMMARY
Fixes this issue that shows up when tags are specified:
An error occurred waiting for the snapshot to become available.: An
error occurred (InvalidParameterValue) when calling the CopySnapshot
operation: Tag specification resource type must have a value

ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ec2_snapshot_copy
ADDITIONAL INFORMATION



# before

botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the CopySnapshot operation: Tag specification resource type must have a value                              
fatal: [localhost]: FAILED! => {                                                                                                                                                                   
    "boto3_version": "1.24.57",                                                                                                                                                                    
    "botocore_version": "1.27.58",                                                                                                                                                                 
    "changed": false,                                                                                                                                                                              
    "error": {                                                                                                                                                                                     
        "code": "InvalidParameterValue",                                                                                                                                                           
        "message": "Tag specification resource type must have a value"                                                                                                                             
    },  
....


# after  (no error message)

changed: [localhost] => {                                                                                                                                                                          
    "changed": true,                                                                                                                                                                               
    "invocation": {                                                                                                                                                                                
        "module_args": {       
.....

Reviewed-by: Mark Chappell <None>
Reviewed-by: Colby Shores <coleshores@gmail.com>
Reviewed-by: None <None>
  • Loading branch information
bplaxco committed Nov 25, 2022
1 parent f46ee66 commit a531f19
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ec2_snapshot_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def copy_snapshot(module, ec2):
params['KmsKeyId'] = module.params.get('kms_key_id')

if module.params.get('tags'):
params['TagSpecifications'] = boto3_tag_specifications(module.params.get('tags'))
params['TagSpecifications'] = boto3_tag_specifications(module.params.get('tags'), types=['snapshot'])

try:
snapshot_id = ec2.copy_snapshot(**params)['SnapshotId']
Expand Down

0 comments on commit a531f19

Please sign in to comment.