Repository: ansible/ansible

Issue:
2.1.1: ec2_vpc does not update/change routing table tags
##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
ec2_vpc_route_table module

##### ANSIBLE VERSION

```
ansible 2.1.1.0
```
##### CONFIGURATION

[defaults]
inventory = ~/inventory/production
host_key_checking = False
log_path = ~/ansible.log

[ssh_connection]
pipelining = True
##### OS / ENVIRONMENT

N/A
##### SUMMARY

Before with Ansible 1.9.6 and the patch mentioned here: http://grokbase.com/t/gg/ansible-project/149pfx39dg/tagging-ec2-vpc-route-tables-and-gateways#20150304gdcdptnuteldhgubbx3m2wfuie , after changing the routing table tag in my playbook or on the AWS console, the routing table tags got changed to the value of my playbook on rerun.

In Ansible 2.1.1 the initial tags are set, but not updated on a rerun after changing it in my playbook or on the AWS console.
##### STEPS TO REPRODUCE

run playbook with for instance:

```
 route_tables:
           - subnets:
             - "10.0.1.0/24"
             - "10.0.2.0/24"
             routes:
               - dest: 0.0.0.0/0
                 gw: igw
             resource_tags: { "Name" : dmz" }
```

Now change the tags value 'dmz' to 'public' in the playbook or on the AWS console and re-run playbook.
See that the tag value does not get changed 
##### EXPECTED RESULTS

I expect the tag value to correspond with the playbook after running it.
##### ACTUAL RESULTS

Tag value did not get updated.

2.1.1: ec2_vpc does not update/change routing table tags
##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
ec2_vpc_route_table module

##### ANSIBLE VERSION

```
ansible 2.1.1.0
```
##### CONFIGURATION

[defaults]
inventory = ~/inventory/production
host_key_checking = False
log_path = ~/ansible.log

[ssh_connection]
pipelining = True
##### OS / ENVIRONMENT

N/A
##### SUMMARY

Before with Ansible 1.9.6 and the patch mentioned here: http://grokbase.com/t/gg/ansible-project/149pfx39dg/tagging-ec2-vpc-route-tables-and-gateways#20150304gdcdptnuteldhgubbx3m2wfuie , after changing the routing table tag in my playbook or on the AWS console, the routing table tags got changed to the value of my playbook on rerun.

In Ansible 2.1.1 the initial tags are set, but not updated on a rerun after changing it in my playbook or on the AWS console.
##### STEPS TO REPRODUCE

run playbook with for instance:

```
 route_tables:
           - subnets:
             - "10.0.1.0/24"
             - "10.0.2.0/24"
             routes:
               - dest: 0.0.0.0/0
                 gw: igw
             resource_tags: { "Name" : dmz" }
```

Now change the tags value 'dmz' to 'public' in the playbook or on the AWS console and re-run playbook.
See that the tag value does not get changed 
##### EXPECTED RESULTS

I expect the tag value to correspond with the playbook after running it.
##### ACTUAL RESULTS

Tag value did not get updated.



Discussion:
This appears to be a submission about a module (ec2_vpc_route_table in amazon-modules-extras)

We would appreciate if you can submit this there (https://github.com/ansible/ansible-modules-extras)
instead. (If we move it, the owner of the issue resets to ansible instead of you).

Re-opening due to repomerge.
cc @wimnat
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
This appears to be a submission about a module (ec2_vpc_route_table in amazon-modules-extras)

We would appreciate if you can submit this there (https://github.com/ansible/ansible-modules-extras)
instead. (If we move it, the owner of the issue resets to ansible instead of you).

Re-opening due to repomerge.
cc @wimnat
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table.py
--- a/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_route_table.py
@@ -590,6 +590,7 @@ def ensure_route_table_present(connection, module):
     if not tags_valid and tags is not None:
         result = ensure_tags(connection, route_table.id, tags,
                              add_only=True, check_mode=module.check_mode)
+        route_table.tags = result['tags']
         changed = changed or result['changed']
 
     if subnets:


Test patch: