<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">elasticache</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.2.0
  config file = /home/tessa/.ansible.cfg
  configured module search path = [u'/home/tessa/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]"><pre class="notranslate"><code class="notranslate">ansible 2.4.2.0
  config file = /home/tessa/.ansible.cfg
  configured module search path = [u'/home/tessa/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="⟫ ansible-config dump --only-changed
ALLOW_WORLD_READABLE_TMPFILES(/home/tessa/.ansible.cfg) = True
DEFAULT_FORKS(/home/tessa/.ansible.cfg) = 16
DEPRECATION_WARNINGS(/home/tessa/.ansible.cfg) = False
HOST_KEY_CHECKING(/home/tessa/.ansible.cfg) = False"><pre class="notranslate"><code class="notranslate">⟫ ansible-config dump --only-changed
ALLOW_WORLD_READABLE_TMPFILES(/home/tessa/.ansible.cfg) = True
DEFAULT_FORKS(/home/tessa/.ansible.cfg) = 16
DEPRECATION_WARNINGS(/home/tessa/.ansible.cfg) = False
HOST_KEY_CHECKING(/home/tessa/.ansible.cfg) = False
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">ubuntu 17.10</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">the elasticache module now thinks there's always changes to our redis deploy, when there are no changes to be made. worse, it says the changes always require "hard_modify = yes", so now every time our playbook runs it tears down and rebuilds our redis cluster. this is pretty brutal.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    - name: create EC redis instance
      elasticache:
        region: &quot;us-west-2&quot;
        name: &quot;redis&quot;
        parameter_group: &quot;mainapp-28&quot;
        engine: redis
        cache_engine_version: 2.8.19
        cache_subnet_group: &quot;redis-subnets&quot;
        node_type: cache.m3.medium
        security_group_ids: &quot;some sg&quot;
        num_nodes: 1
        state: present
        hard_modify: yes
        wait: yes"><pre class="notranslate">    - <span class="pl-ent">name</span>: <span class="pl-s">create EC redis instance</span>
      <span class="pl-ent">elasticache</span>:
        <span class="pl-ent">region</span>: <span class="pl-s"><span class="pl-pds">"</span>us-west-2<span class="pl-pds">"</span></span>
        <span class="pl-ent">name</span>: <span class="pl-s"><span class="pl-pds">"</span>redis<span class="pl-pds">"</span></span>
        <span class="pl-ent">parameter_group</span>: <span class="pl-s"><span class="pl-pds">"</span>mainapp-28<span class="pl-pds">"</span></span>
        <span class="pl-ent">engine</span>: <span class="pl-s">redis</span>
        <span class="pl-ent">cache_engine_version</span>: <span class="pl-s">2.8.19</span>
        <span class="pl-ent">cache_subnet_group</span>: <span class="pl-s"><span class="pl-pds">"</span>redis-subnets<span class="pl-pds">"</span></span>
        <span class="pl-ent">node_type</span>: <span class="pl-s">cache.m3.medium</span>
        <span class="pl-ent">security_group_ids</span>: <span class="pl-s"><span class="pl-pds">"</span>some sg<span class="pl-pds">"</span></span>
        <span class="pl-ent">num_nodes</span>: <span class="pl-c1">1</span>
        <span class="pl-ent">state</span>: <span class="pl-s">present</span>
        <span class="pl-ent">hard_modify</span>: <span class="pl-s">yes</span>
        <span class="pl-ent">wait</span>: <span class="pl-s">yes</span></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Say "no changes" and continue.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">continuously destroys and rebuilds our redis instance.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [create EC redis instance] ***********************************************************************************************************************************************************************************
task path: /home/tessa/ansible/vpc-redis.yml:60
Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/cloud/amazon/elasticache.py
&lt;127.0.0.1&gt; ESTABLISH LOCAL CONNECTION FOR USER: tessa
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'echo ~ &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p &quot;` echo /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448 `&quot; &amp;&amp; echo ansible-tmp-1517443020.15-70458660838448=&quot;` echo /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448 `&quot; ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; PUT /tmp/tmpfjy7aP TO /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/elasticache.py
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'chmod u+x /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/ /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/elasticache.py &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '/usr/bin/python /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/elasticache.py; rm -rf &quot;/home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/&quot; &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
changed: [localhost] =&gt; {
    &quot;changed&quot;: true, 
    &quot;elasticache&quot;: {
        &quot;data&quot;: {
            &quot;AtRestEncryptionEnabled&quot;: false, 
            &quot;AuthTokenEnabled&quot;: false, 
            &quot;AutoMinorVersionUpgrade&quot;: true, 
            &quot;CacheClusterCreateTime&quot;: &quot;2018-02-01T00:05:33.508000+00:00&quot;, 
            &quot;CacheClusterId&quot;: &quot;redis&quot;, 
            &quot;CacheClusterStatus&quot;: &quot;available&quot;, 
            &quot;CacheNodeType&quot;: &quot;cache.m3.medium&quot;, 
            &quot;CacheNodes&quot;: [
                {
                    &quot;CacheNodeCreateTime&quot;: &quot;2018-02-01T00:05:33.508000+00:00&quot;, 
                    &quot;CacheNodeId&quot;: &quot;0001&quot;, 
                    &quot;CacheNodeStatus&quot;: &quot;available&quot;, 
                    &quot;CustomerAvailabilityZone&quot;: &quot;us-west-2b&quot;, 
                    &quot;Endpoint&quot;: {
                        &quot;Address&quot;: &quot;some-endpoint.cache.amazonaws.com&quot;, 
                        &quot;Port&quot;: 6379
                    }, 
                    &quot;ParameterGroupStatus&quot;: &quot;in-sync&quot;
                }
            ], 
            &quot;CacheParameterGroup&quot;: {
                &quot;CacheNodeIdsToReboot&quot;: [], 
                &quot;CacheParameterGroupName&quot;: &quot;mainapp-28&quot;, 
                &quot;ParameterApplyStatus&quot;: &quot;in-sync&quot;
            }, 
            &quot;CacheSecurityGroups&quot;: [], 
            &quot;CacheSubnetGroupName&quot;: &quot;redis-subnets&quot;, 
            &quot;ClientDownloadLandingPage&quot;: &quot;https://console.aws.amazon.com/elasticache/home#client-download:&quot;, 
            &quot;Engine&quot;: &quot;redis&quot;, 
            &quot;EngineVersion&quot;: &quot;2.8.19&quot;, 
            &quot;NumCacheNodes&quot;: 1, 
            &quot;PendingModifiedValues&quot;: {}, 
            &quot;PreferredAvailabilityZone&quot;: &quot;us-west-2b&quot;, 
            &quot;PreferredMaintenanceWindow&quot;: &quot;sat:07:00-sat:08:00&quot;, 
            &quot;SecurityGroups&quot;: [
                {
                    &quot;SecurityGroupId&quot;: &quot;sg-0694177d&quot;, 
                    &quot;Status&quot;: &quot;active&quot;
                }
            ], 
            &quot;SnapshotRetentionLimit&quot;: 0, 
            &quot;SnapshotWindow&quot;: &quot;10:30-11:30&quot;, 
            &quot;TransitEncryptionEnabled&quot;: false
        }, 
        &quot;name&quot;: &quot;staging-redis&quot;, 
        &quot;status&quot;: &quot;available&quot;
    }, 
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;aws_access_key&quot;: null, 
            &quot;aws_secret_key&quot;: null, 
            &quot;cache_engine_version&quot;: &quot;2.8.19&quot;, 
            &quot;cache_parameter_group&quot;: &quot;mainapp-28&quot;, 
            &quot;cache_port&quot;: null, 
            &quot;cache_security_groups&quot;: [], 
            &quot;cache_subnet_group&quot;: &quot;redis-subnets&quot;, 
            &quot;ec2_url&quot;: null, 
            &quot;engine&quot;: &quot;redis&quot;, 
            &quot;hard_modify&quot;: true, 
            &quot;name&quot;: &quot;redis&quot;, 
            &quot;node_type&quot;: &quot;cache.m3.medium&quot;, 
            &quot;num_nodes&quot;: 1, 
            &quot;parameter_group&quot;: &quot;mainapp-28&quot;, 
            &quot;profile&quot;: null, 
            &quot;region&quot;: &quot;us-west-2&quot;, 
            &quot;security_group_ids&quot;: [
                &quot;sg-something&quot;
            ], 
            &quot;security_token&quot;: null, 
            &quot;state&quot;: &quot;present&quot;, 
            &quot;validate_certs&quot;: true, 
            &quot;wait&quot;: true, 
            &quot;zone&quot;: &quot;&quot;
        }
    }
}"><pre class="notranslate"><code class="notranslate">TASK [create EC redis instance] ***********************************************************************************************************************************************************************************
task path: /home/tessa/ansible/vpc-redis.yml:60
Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/cloud/amazon/elasticache.py
&lt;127.0.0.1&gt; ESTABLISH LOCAL CONNECTION FOR USER: tessa
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'echo ~ &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p "` echo /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448 `" &amp;&amp; echo ansible-tmp-1517443020.15-70458660838448="` echo /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448 `" ) &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; PUT /tmp/tmpfjy7aP TO /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/elasticache.py
&lt;127.0.0.1&gt; EXEC /bin/sh -c 'chmod u+x /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/ /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/elasticache.py &amp;&amp; sleep 0'
&lt;127.0.0.1&gt; EXEC /bin/sh -c '/usr/bin/python /home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/elasticache.py; rm -rf "/home/tessa/.ansible/tmp/ansible-tmp-1517443020.15-70458660838448/" &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
changed: [localhost] =&gt; {
    "changed": true, 
    "elasticache": {
        "data": {
            "AtRestEncryptionEnabled": false, 
            "AuthTokenEnabled": false, 
            "AutoMinorVersionUpgrade": true, 
            "CacheClusterCreateTime": "2018-02-01T00:05:33.508000+00:00", 
            "CacheClusterId": "redis", 
            "CacheClusterStatus": "available", 
            "CacheNodeType": "cache.m3.medium", 
            "CacheNodes": [
                {
                    "CacheNodeCreateTime": "2018-02-01T00:05:33.508000+00:00", 
                    "CacheNodeId": "0001", 
                    "CacheNodeStatus": "available", 
                    "CustomerAvailabilityZone": "us-west-2b", 
                    "Endpoint": {
                        "Address": "some-endpoint.cache.amazonaws.com", 
                        "Port": 6379
                    }, 
                    "ParameterGroupStatus": "in-sync"
                }
            ], 
            "CacheParameterGroup": {
                "CacheNodeIdsToReboot": [], 
                "CacheParameterGroupName": "mainapp-28", 
                "ParameterApplyStatus": "in-sync"
            }, 
            "CacheSecurityGroups": [], 
            "CacheSubnetGroupName": "redis-subnets", 
            "ClientDownloadLandingPage": "https://console.aws.amazon.com/elasticache/home#client-download:", 
            "Engine": "redis", 
            "EngineVersion": "2.8.19", 
            "NumCacheNodes": 1, 
            "PendingModifiedValues": {}, 
            "PreferredAvailabilityZone": "us-west-2b", 
            "PreferredMaintenanceWindow": "sat:07:00-sat:08:00", 
            "SecurityGroups": [
                {
                    "SecurityGroupId": "sg-0694177d", 
                    "Status": "active"
                }
            ], 
            "SnapshotRetentionLimit": 0, 
            "SnapshotWindow": "10:30-11:30", 
            "TransitEncryptionEnabled": false
        }, 
        "name": "staging-redis", 
        "status": "available"
    }, 
    "invocation": {
        "module_args": {
            "aws_access_key": null, 
            "aws_secret_key": null, 
            "cache_engine_version": "2.8.19", 
            "cache_parameter_group": "mainapp-28", 
            "cache_port": null, 
            "cache_security_groups": [], 
            "cache_subnet_group": "redis-subnets", 
            "ec2_url": null, 
            "engine": "redis", 
            "hard_modify": true, 
            "name": "redis", 
            "node_type": "cache.m3.medium", 
            "num_nodes": 1, 
            "parameter_group": "mainapp-28", 
            "profile": null, 
            "region": "us-west-2", 
            "security_group_ids": [
                "sg-something"
            ], 
            "security_token": null, 
            "state": "present", 
            "validate_certs": true, 
            "wait": true, 
            "zone": ""
        }
    }
}
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">elasticache</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.0.0
  config file = /Users/lkostka/devbox/prov/ansible.cfg
  configured module search path = [u'/Users/lkostka/devbox/prov/modules']
  ansible python module location = /Users/lkostka/.virtualenvs/prov/lib/python2.7/site-packages/ansible
  executable location = /Users/lkostka/.virtualenvs/prov/bin/ansible
  python version = 2.7.13 (default, Dec 18 2016, 07:03:39) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]"><pre class="notranslate"><code class="notranslate">ansible 2.4.0.0
  config file = /Users/lkostka/devbox/prov/ansible.cfg
  configured module search path = [u'/Users/lkostka/devbox/prov/modules']
  ansible python module location = /Users/lkostka/.virtualenvs/prov/lib/python2.7/site-packages/ansible
  executable location = /Users/lkostka/.virtualenvs/prov/bin/ansible
  python version = 2.7.13 (default, Dec 18 2016, 07:03:39) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ANSIBLE_PIPELINING(/Users/lkostka/devbox/prov/ansible.cfg) = True
ANSIBLE_SSH_ARGS(env: ANSIBLE_SSH_ARGS) =
DEFAULT_CALLBACK_PLUGIN_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/callbacks']
DEFAULT_FILTER_PLUGIN_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/filters']
DEFAULT_FORKS(/Users/lkostka/devbox/prov/ansible.cfg) = 40
DEFAULT_LOOKUP_PLUGIN_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/lookups']
DEFAULT_MODULE_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/modules']
DEFAULT_SCP_IF_SSH(/Users/lkostka/devbox/prov/ansible.cfg) = true
DEFAULT_TRANSPORT(/Users/lkostka/devbox/prov/ansible.cfg) = ssh
DEPRECATION_WARNINGS(/Users/lkostka/devbox/prov/ansible.cfg) = True
RETRY_FILES_ENABLED(/Users/lkostka/devbox/prov/ansible.cfg) = False"><pre class="notranslate"><code class="notranslate">ANSIBLE_PIPELINING(/Users/lkostka/devbox/prov/ansible.cfg) = True
ANSIBLE_SSH_ARGS(env: ANSIBLE_SSH_ARGS) =
DEFAULT_CALLBACK_PLUGIN_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/callbacks']
DEFAULT_FILTER_PLUGIN_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/filters']
DEFAULT_FORKS(/Users/lkostka/devbox/prov/ansible.cfg) = 40
DEFAULT_LOOKUP_PLUGIN_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/lookups']
DEFAULT_MODULE_PATH(/Users/lkostka/devbox/prov/ansible.cfg) = [u'/Users/lkostka/devbox/prov/modules']
DEFAULT_SCP_IF_SSH(/Users/lkostka/devbox/prov/ansible.cfg) = true
DEFAULT_TRANSPORT(/Users/lkostka/devbox/prov/ansible.cfg) = ssh
DEPRECATION_WARNINGS(/Users/lkostka/devbox/prov/ansible.cfg) = True
RETRY_FILES_ENABLED(/Users/lkostka/devbox/prov/ansible.cfg) = False
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">mac os</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Module must receive null (None in python) to be able to work. If <code class="notranslate">zone</code> is not specified then module receives <code class="notranslate">''</code>. We do not care about in which az redis is. Without explicit zone, module fails because it receives empty string as a value of zone and <a href="https://github.com/ansible/ansible/blob/v2.4.0.0-1/lib/ansible/modules/cloud/amazon/elasticache.py#L420">tries to do destructive change</a>.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Just create a cluster without specifying <code class="notranslate">zone</code>.</p>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Module should try to do destructive change when no zone key is missing from yaml file.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto"><a href="https://github.com/ansible/ansible/blob/v2.4.0.0-1/lib/ansible/modules/cloud/amazon/elasticache.py#L420">https://github.com/ansible/ansible/blob/v2.4.0.0-1/lib/ansible/modules/cloud/amazon/elasticache.py#L420</a></p>
<p dir="auto">No zone key in module params causes module to see <code class="notranslate">zone</code> key value as <code class="notranslate">''</code></p>